[玩转系统] 通过 CMD、PowerShell 和 GPO 更改 Windows 中的时区设置
作者:精品下载站 日期:2024-12-14 23:07:12 浏览:16 分类:玩电脑
通过 CMD、PowerShell 和 GPO 更改 Windows 中的时区设置
时区与时间和日期一样,是计算机的关键参数之一。为了使 Windows 和应用程序正常工作,必须根据计算机的地理位置设置时区。在本文中,我们将了解如何通过 GUI、命令提示符、PowerShell 和使用组策略更改 Windows 中的时区。
新的“设置”应用程序在 Windows 10 和 Windows Server 2019/2016 中用于设置日期和时区。您可以通过右键单击系统托盘中的时钟图标并选择调整日期/时间,从 GUI 设置时区。默认情况下,Windows 会尝试自动选择时区(启用自动设置时区选项)。您可以禁用此选项并通过在下拉列表中选择来手动设置所需的时区。
提示。您还可以使用经典的“日期和时间”控制面板小程序来更改 Windows 中的时区设置。运行命令
timedate.cpl
。
允许或阻止用户更改 Windows 中的时区
默认情况下,用户不需要管理员权限即可更改时区(与更改日期/时间不同)。可以使用本地安全设置控制台更改此行为(
secpol.msc
)。转到安全设置 -> 本地策略 -> 用户权限分配。该政策称为更改时区。如您所见,系统、管理员和所有用户都可以更改时区。要防止用户更改时区,请从此策略的帐户列表中删除用户组。
在 Windows Server 中,只有本地服务和管理员才有更改时区的权限。
在 Hyper-V Server 和 Windows Server Core 中,您可以使用内置的 sconfig 实用程序设置时区。
TZUtil.exe:如何在 Windows 10 CMD 中更改时区?
要更改Windows 11/10/8.1和Windows Server 2019/2016/2012 R2/中的时区,需要使用特殊的命令行工具tzutil.exe(Windows时区实用程序)。它首次出现在Windows 7中。该工具的可执行文件位于
%WINDIR%\System32
目录。
让我们考虑一下 TZUtil.exe 工具的特性和功能。
运行命令提示符(
cmd.exe
)。要查找当前时区及其标识符 (TimeZoneID),请运行以下命令:
tzutil /g
在此示例中,太平洋标准时间是当前时区标识符。
显示所有可用时区的列表,如下所示:
tzutil /l
TimeZone Id | TimeZone DisplayName
Dateline Standard Time | (UTC-12:00) International Date Line West
UTC-11 | (UTC-11:00) Coordinated Universal Time-11
Aleutian Standard Time | (UTC-10:00) Aleutian Islands
Hawaiian Standard Time | (UTC-10:00) Hawaii
Marquesas Standard Time | (UTC-09:30) Marquesas Islands
Alaskan Standard Time | (UTC-09:00) Alaska
UTC-09 | (UTC-09:00) Coordinated Universal Time-09
Pacific Standard Time (Mexico) | (UTC-08:00) Baja California
UTC-08 | (UTC-08:00) Coordinated Universal Time-08
Pacific Standard Time | (UTC-08:00) Pacific Time (US & Canada)
US Mountain Standard Time | (UTC-07:00) Arizona
Mountain Standard Time (Mexico) | (UTC-07:00) Chihuahua, La Paz, Mazatlan
Mountain Standard Time | (UTC-07:00) Mountain Time (US & Canada)
Central America Standard Time | (UTC-06:00) Central America
Central Standard Time | (UTC-06:00) Central Time (US & Canada)
Easter Island Standard Time | (UTC-06:00) Easter Island
Central Standard Time (Mexico) | (UTC-06:00) Guadalajara, Mexico City, Monterrey
Canada Central Standard Time | (UTC-06:00) Saskatchewan
SA Pacific Standard Time | (UTC-05:00) Bogota, Lima, Quito, Rio Branco
Eastern Standard Time (Mexico) | (UTC-05:00) Chetumal
Eastern Standard Time | (UTC-05:00) Eastern Time (US & Canada)
Haiti Standard Time | (UTC-05:00) Haiti
Cuba Standard Time | (UTC-05:00) Havana
US Eastern Standard Time | (UTC-05:00) Indiana (East)
Turks And Caicos Standard Time | (UTC-05:00) Turks and Caicos
Paraguay Standard Time | (UTC-04:00) Asuncion
Atlantic Standard Time | (UTC-04:00) Atlantic Time (Canada)
Venezuela Standard Time | (UTC-04:00) Caracas
Central Brazilian Standard Time | (UTC-04:00) Cuiaba
SA Western Standard Time | (UTC-04:00) Georgetown, La Paz, Manaus, San Juan
Pacific SA Standard Time | (UTC-04:00) Santiago
Newfoundland Standard Time | (UTC-03:30) Newfoundland
Tocantins Standard Time | (UTC-03:00) Araguaina
E. South America Standard Time | (UTC-03:00) Brasilia
SA Eastern Standard Time | (UTC-03:00) Cayenne, Fortaleza
Argentina Standard Time | (UTC-03:00) City of Buenos Aires
Greenland Standard Time | (UTC-03:00) Greenland
Montevideo Standard Time | (UTC-03:00) Montevideo
Magallanes Standard Time | (UTC-03:00) Punta Arenas
Saint Pierre Standard Time | (UTC-03:00) Saint Pierre and Miquelon
Bahia Standard Time | (UTC-03:00) Salvador
UTC-02 | (UTC-02:00) Coordinated Universal Time-02
Mid-Atlantic Standard Time | (UTC-02:00) Mid-Atlantic - Old
Azores Standard Time | (UTC-01:00) Azores
Cape Verde Standard Time | (UTC-01:00) Cabo Verde Is.
UTC | (UTC) Coordinated Universal Time
Morocco Standard Time | (UTC+00:00) Casablanca
GMT Standard Time | (UTC+00:00) Dublin, Edinburgh, Lisbon, London
Greenwich Standard Time | (UTC+00:00) Monrovia, Reykjavik
W. Europe Standard Time | (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
Central Europe Standard Time | (UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
Romance Standard Time | (UTC+01:00) Brussels, Copenhagen, Madrid, Paris
Sao Tome Standard Time | (UTC+01:00) Sao Tome
Central European Standard Time | (UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb
W. Central Africa Standard Time | (UTC+01:00) West Central Africa
Jordan Standard Time | (UTC+02:00) Amman
GTB Standard Time | (UTC+02:00) Athens, Bucharest
Middle East Standard Time | (UTC+02:00) Beirut
Egypt Standard Time | (UTC+02:00) Cairo
E. Europe Standard Time | (UTC+02:00) Chisinau
Syria Standard Time | (UTC+02:00) Damascus
West Bank Standard Time | (UTC+02:00) Gaza, Hebron
South Africa Standard Time | (UTC+02:00) Harare, Pretoria
FLE Standard Time | (UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius
Israel Standard Time | (UTC+02:00) Jerusalem
Kaliningrad Standard Time | (UTC+02:00) Kaliningrad
Sudan Standard Time | (UTC+02:00) Khartoum
Libya Standard Time | (UTC+02:00) Tripoli
Namibia Standard Time | (UTC+02:00) Windhoek
Arabic Standard Time | (UTC+03:00) Baghdad
Turkey Standard Time | (UTC+03:00) Istanbul
Arab Standard Time | (UTC+03:00) Kuwait, Riyadh
Belarus Standard Time | (UTC+03:00) Minsk
Russian Standard Time | (UTC+03:00) Moscow, St. Petersburg, Volgograd
E. Africa Standard Time | (UTC+03:00) Nairobi
Iran Standard Time | (UTC+03:30) Tehran
Arabian Standard Time | (UTC+04:00) Abu Dhabi, Muscat
Astrakhan Standard Time | (UTC+04:00) Astrakhan, Ulyanovsk
Azerbaijan Standard Time | (UTC+04:00) Baku
Russia Time Zone 3 | (UTC+04:00) Izhevsk, Samara
Mauritius Standard Time | (UTC+04:00) Port Louis
Saratov Standard Time | (UTC+04:00) Saratov
Georgian Standard Time | (UTC+04:00) Tbilisi
Caucasus Standard Time | (UTC+04:00) Yerevan
Afghanistan Standard Time | (UTC+04:30) Kabul
West Asia Standard Time | (UTC+05:00) Ashgabat, Tashkent
Ekaterinburg Standard Time | (UTC+05:00) Ekaterinburg
Pakistan Standard Time | (UTC+05:00) Islamabad, Karachi
India Standard Time | (UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi
Sri Lanka Standard Time | (UTC+05:30) Sri Jayawardenepura
Nepal Standard Time | (UTC+05:45) Kathmandu
Central Asia Standard Time | (UTC+06:00) Astana
Bangladesh Standard Time | (UTC+06:00) Dhaka
Omsk Standard Time | (UTC+06:00) Omsk
Myanmar Standard Time | (UTC+06:30) Yangon (Rangoon)
SE Asia Standard Time | (UTC+07:00) Bangkok, Hanoi, Jakarta
Altai Standard Time | (UTC+07:00) Barnaul, Gorno-Altaysk
W. Mongolia Standard Time | (UTC+07:00) Hovd
North Asia Standard Time | (UTC+07:00) Krasnoyarsk
N. Central Asia Standard Time | (UTC+07:00) Novosibirsk
Tomsk Standard Time | (UTC+07:00) Tomsk
China Standard Time | (UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi
North Asia East Standard Time | (UTC+08:00) Irkutsk
Singapore Standard Time | (UTC+08:00) Kuala Lumpur, Singapore
W. Australia Standard Time | (UTC+08:00) Perth
Taipei Standard Time | (UTC+08:00) Taipei
Ulaanbaatar Standard Time | (UTC+08:00) Ulaanbaatar
North Korea Standard Time | (UTC+08:30) Pyongyang
Aus Central W. Standard Time | (UTC+08:45) Eucla
Transbaikal Standard Time | (UTC+09:00) Chita
Tokyo Standard Time | (UTC+09:00) Osaka, Sapporo, Tokyo
Korea Standard Time | (UTC+09:00) Seoul
Yakutsk Standard Time | (UTC+09:00) Yakutsk
Cen. Australia Standard Time | (UTC+09:30) Adelaide
AUS Central Standard Time | (UTC+09:30) Darwin
E. Australia Standard Time | (UTC+10:00) Brisbane
AUS Eastern Standard Time | (UTC+10:00) Canberra, Melbourne, Sydney
West Pacific Standard Time | (UTC+10:00) Guam, Port Moresby
Tasmania Standard Time | (UTC+10:00) Hobart
Vladivostok Standard Time | (UTC+10:00) Vladivostok
Lord Howe Standard Time | (UTC+10:30) Lord Howe Island
Bougainville Standard Time | (UTC+11:00) Bougainville Island
Russia Time Zone 10 | (UTC+11:00) Chokurdakh
Magadan Standard Time | (UTC+11:00) Magadan
Norfolk Standard Time | (UTC+11:00) Norfolk Island
Sakhalin Standard Time | (UTC+11:00) Sakhalin
Central Pacific Standard Time | (UTC+11:00) Solomon Is., New Caledonia
Russia Time Zone 11 | (UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky
New Zealand Standard Time | (UTC+12:00) Auckland, Wellington
UTC+12 | (UTC+12:00) Coordinated Universal Time+12
Fiji Standard Time | (UTC+12:00) Fiji
Kamchatka Standard Time | (UTC+12:00) Petropavlovsk-Kamchatsky - Old
Chatham Islands Standard Time | (UTC+12:45) Chatham Islands
UTC+13 | (UTC+13:00) Coordinated Universal Time+13
Tonga Standard Time | (UTC+13:00) Nuku'alofa
Samoa Standard Time | (UTC+13:00) Samoa
Line Islands Standard Time | (UTC+14:00) Kiritimati Island
Microsoft 提供的 Windows 中当前时区列表可在此处获取
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones。
如果您想快速查找所有可用时区(例如,
UTC -6
偏移量),运行命令:
tzutil /l | find /I "utc-06"
将当前时区更改为 (UTC-05:00) 东部时间(美国和加拿大):
tzutil /s "Eastern Standard Time"
当前时区存储在 Windows 注册表中。您可以检查它是否已更改,如下所示:
reg query HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
要禁用特定时区的夏令时,您必须指定带有后缀 _dstoff 的时区标识符,例如:
tzutil /s “Central European Standard Time_dstoff”
此命令将更改计算机的时区并禁用季节性时钟更改。
您可以显示有关时区和夏令时设置的完整信息,如下所示:
w32tm /tz
Time zone: Current:TIME_ZONE_ID_UNKNOWN Bias: 480min (UTC=LocalTime+Bias)
[Standard Name:"Pacific Standard Time" Bias:0min Date:(unspecified)]
[Daylight Name:"Pacific Standard Time" Bias:0min Date:(unspecified)]
要在 Windows XP 和 Windows Server 2003 中从命令提示符更改时区,您必须使用以下命令
RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Central America Standard Time
或者 :
Control.exe TIMEDATE.CPL,,/Z Central America Standard Time
通过 PowerShell 设置 Windows 时区
您可以从 PowerShell 控制台获取当前时区设置。运行命令:
[TimeZoneInfo]::Local
或者
Get-TimeZone
Id : Pacific Standard Time
DisplayName : (UTC-08:00) Pacific Time (US & Canada)
StandardName : Pacific Standard Time
DaylightName : Pacific Standard Time
BaseUtcOffset : -08:00:00
SupportsDaylightSavingTime : False
要查看Windows中所有可用的时区,可以使用PowerShell命令:
[System.TimeZoneInfo]::GetSystemTimeZones()
或者
Get-TimeZone -ListAvailable
时区列表很长。要查找所需时区的名称,请使用 PowerShell 过滤选项:
Get-TimeZone -ListAvailable | Where-Object {$_.displayname -like "*canada*"}
或者 :
Get-TimeZone -ListAvailable | Where-Object {$_.Id -like "*euro*"}
您可以按字母顺序列出所有时区:
Get-TimeZone -ListAvailable | Select Id | Sort Id
要从 PowerShell 更改当前时区,请运行命令
Set-TimeZone -Name "US Eastern Standard Time"
这些示例中使用了 PowerShell 版本 5.1,但它们也适用于较新的版本。
使用组策略配置时区
您可以使用组策略在 Active Directory 域中的计算机上配置时区。 GPO 中没有用于配置时区的内置策略参数。通过 GPO 设置时区的两个最常用选项是使用 GPO 登录脚本或将时区设置导入注册表。
要使用 GPO 登录脚本设置时区,您可以使用简单的 PowerShell 脚本(它适用于从 Windows XP 和 Windows Server 2003 开始的所有 Windows 版本):
$timeZone = "Central Europe Daylight Time"
$WinOSVerReg = Get-Item "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
$WinOSVer = $WinOSVerReg.GetValue("CurrentVersion")
if ($WinOSVer -GE 6){
tzutil.exe /s $timeZone
} Else {
$params = "/c Start `"Change timeZone`" /MIN %WINDIR%\System32\Control.exe TIMEDATE.CPL,,/Z "
$params += $timeZone
$proc = [System.Diagnostics.Process]::Start( "CMD.exe", $params )
}
为加入域的计算机设置时区的另一种方法是通过 GPO 将 HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation 注册表项的内容从具有正确配置的时间设置的参考计算机导入到其他计算机。本文介绍如何通过组策略导入注册表参数。
使用注册表浏览器选择此注册表项及其所有参数。因此,所有时区设置都将导入到 GPO 编辑器中(计算机配置 -> 首选项 -> Windows 设置 -> 注册表)。
如果要对不同的 Active Directory 站点使用不同的时区设置,请使用 GPP 项目级别定位将特定时区设置定位到 AD 站点。
如果您使用 RDS 基础设施,并且用户和 RDSH 服务器配置了不同的时区,则服务器时间将显示在用户的 RDP 会话中。不方便。您可以使用允许时区重定向 GPO 参数(计算机配置 > 策略 -> 管理模板 -> Windows 组件 -> 远程桌面服务 -> 远程桌面会话主机 -> 设备和资源重定向)将用户的本地时区重定向到 RDP 会话。
无法更改 Windows Server 2019 /Windows 10 上的时区:您没有权限
Windows Server 2019 RTM 和某些 Windows 10 版本包含通过 GUI 进行时区设置的烦人错误。如果您尝试从现代“设置”应用程序或通过经典的“控制面板”小程序更改时区,则会出现错误:
Date and time
Unable to continue.
You do not have permission to perform this task. Please contact your computer administrator for help.
首先,确保您使用具有管理员权限的帐户登录 Windows,并且更改时区本地安全策略设置中存在管理员组。
作为解决方法,在这种情况下,您必须从命令行更改时区:
tzutil /l
tzutil /s "Central Europe Standard Time"
或 PowerShell:
GetTimeZone -ListAvailable|? DisplayName -like "*Berlin*"|Set-TimeZone
如果您想从图形界面更改时区设置,则需要调整
timedate.cpl
从提升的命令提示符中打开小程序,或从服务器管理器(本地服务器 -> 时区)中打开它。
Exchange (Microsoft 365) 邮箱中的时区是根据 Windows 用户配置文件设置在第一次连接时设置的。
猜你还喜欢
- 03-30 [玩转系统] 如何用批处理实现关机,注销,重启和锁定计算机
- 02-14 [系统故障] Win10下报错:该文件没有与之关联的应用来执行该操作
- 01-07 [系统问题] Win10--解决锁屏后会断网的问题
- 01-02 [系统技巧] Windows系统如何关闭防火墙保姆式教程,超详细
- 12-15 [玩转系统] 如何在 Windows 10 和 11 上允许多个 RDP 会话
- 12-15 [玩转系统] 查找 Exchange/Microsoft 365 中不活动(未使用)的通讯组列表
- 12-15 [玩转系统] 如何在 Windows 上安装远程服务器管理工具 (RSAT)
- 12-15 [玩转系统] 如何在 Windows 上重置组策略设置
- 12-15 [玩转系统] 如何获取计算机上的本地管理员列表?
- 12-15 [玩转系统] 在 Visual Studio Code 中连接到 MS SQL Server 数据库
- 12-15 [玩转系统] 如何降级 Windows Server 版本或许可证
- 12-15 [玩转系统] 如何允许非管理员用户在 Windows 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[影视] 黑道中人 Alto Knights(2025)剧情 犯罪 历史 电影
[古装剧] [七侠五义][全75集][WEB-MP4/76G][国语无字][1080P][焦恩俊经典]
[实用软件] 虚拟手机号 电话 验证码 注册
[电视剧] 安眠书店/你 第五季 You Season 5 (2025) 【全10集】
[电视剧] 棋士(2025) 4K 1080P【全22集】悬疑 犯罪 王宝强 陈明昊
[软件合集] 25年6月5日 精选软件22个
[软件合集] 25年6月4日 精选软件36个
[短剧] 2025年06月04日 精选+付费短剧推荐33部
[短剧] 2025年06月03日 精选+付费短剧推荐25部
[软件合集] 25年6月3日 精选软件44个
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电视剧] 欢乐颂.5部全 (2016-2024)
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[影视] 【稀有资源】香港老片 艺坛照妖镜之96应召名册 (1996)
[剧集] 神经风云(2023)(完结).4K
[剧集] [BT] [TVB] [黑夜彩虹(2003)] [全21集] [粤语中字] [TV-RMVB]
[实用软件] 虚拟手机号 电话 验证码 注册
[资源] B站充电视频合集,包含多位重量级up主,全是大佬真金白银买来的~【99GB】
[影视] 内地绝版高清录像带 [mpg]
[书籍] 古今奇书禁书三教九流资料大合集 猎奇必备珍藏资源PDF版 1.14G
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电影] 美国队长4 4K原盘REMUX 杜比视界 内封简繁英双语字幕 49G
[电影] 死神来了(1-6)大合集!
[软件合集] 25年05月13日 精选软件16个
[精品软件] 25年05月15日 精选软件18个
[绝版资源] 南与北 第1-2季 合集 North and South (1985) /美国/豆瓣: 8.8[1080P][中文字幕]
[软件] 25年05月14日 精选软件57个
[短剧] 2025年05月14日 精选+付费短剧推荐39部
[短剧] 2025年05月15日 精选+付费短剧推荐36部
- 最新评论
-
- 热门tag