1 Windows 20001.1 命令介绍Windows 2000下有关时间的命令有两个,net time和W32tm,下面对这两个命令的语法和参数加以说明。 1.1.1 NET TIMEnet time命令使计算机的时钟与另一个计算机或域的时钟同步。如果在没有 /set 选项的情况下使用,则显示另一个计算机或域的时间。net time的语法为:
参数说明: l 无参数,显示被指派为本地计算机的Windows服务器域时间服务器的当前时间。 l \computername,指定要检查或与之同步的服务器的名称。 l /domain[:domainname],指定要同步时间的域。 l /rtsdomain[:domainname],指定要与之同步的可信时间服务器所在的域。 l /set,使计算机的时钟与指定的计算机或域的时间同步。 l /querysntp,显示当前为本地计算机或 \computername 所指定的计算机配置网络时间协议(NTP)服务器的名称。 l /setsntp[:ntp server list],指定本地计算机所使用的NTP时间服务器的列表。该列表可以包含IP地址或DNS名称,用空格分开。如果要使用多个时间服务器,该列表必须用引号引起来。例如net time /setsntp:"time.nist.gov,0x1 time-a.nist.gov,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。 1.1.2 W32timeW32tm是用来同步本地计算机与远程计算机或域时间的类似命令。在域控制器上使用W32tm前必须停止W32Time,完成后再启动W32Time。W32tm的语法为:
关于W32tm语法的详细说明,可以在命令提示符下键入W32tm /?,将列出语法和所有参数的说明。 1.2 注册表项以下注册表项位于 HKLM\SYSTEM\CurrentControlSet\Services\W32Time 1.2.1 Parameters\PeriodHKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\Period 注册表项控制着 Windows 时间服务同步的频率。为它指定的值只能是以下列表中的某个特殊值: l 65531, "DailySpecialSkew" - 设置为每隔 45 分钟同步一次,直到有一次成功,然后每天同步一次。 l 65532, "SpecialSkew" - 设置为每隔 45 分钟同步一次,直到有三次成功,然后每隔八小时同步一次。这是默认设置。 l 65533, "Weekly" - 设置为每隔七天同步一次。 l 65534, "Tridaily" - 设置为每隔三天同步一次。 l 65535, "BiDaily" - 设置为每隔两天同步一次。 l 0 - 对于 NT5DS,则每隔 45 分钟同步一次,直到有三次成功,然后每隔八小时同步一次。对于 NTP,则每隔 8 小时同步一次。 l freq - freq 代表您希望 Windows 时间服务每天同步的次数。如果您不想使用那些事先指定好的值,则必须使用此选项。 1.3 设置示例设置 Windows Time 服务:在“控制面板”中打开“管理工具”,再打开“服务”;在服务中找到“Windows Time”,双击服务名称,在打开的“Windows Time的属性”中设置“启动类型”为“自动”,再按下启动按钮。 在“运行(R)”中用“cmd”命令进入在DOS命令行窗体;执行以下命令(注意空格):
1.4 可能出现的问题计算机没有同步。因为没有可用的时间数据。(The computer did not resync because no time data was available) 出现该问题的原因可能是windows time service没有正确的启动,或者与组策略中的时间配置冲突。请在组策略(gpedit.msc)中将配置更改为“未配置”。 2 Windows XP2.1 命令介绍Windows XP下有关时间的命令有两个,net time和W32tm,下面对这两个命令的语法和参数加以说明。 2.1.1 NET TIMEnet time命令使计算机的时钟与另一个计算机或域的时钟同步。如果在没有 /set 选项的情况下使用,则显示另一个计算机或域的时间。net time的语法为:
参数说明: l 无参数,显示被指派为本地计算机的Windows服务器域时间服务器的当前时间。 l \computername,指定要检查或与之同步的服务器的名称。 l /domain[:domainname],指定要同步时间的域。 l /rtsdomain[:domainname],指定要与之同步的可信时间服务器所在的域。 l /set,使计算机的时钟与指定的计算机或域的时间同步。 l /querysntp,显示当前为本地计算机或 \computername 所指定的计算机配置网络时间协议(NTP)服务器的名称。 l /setsntp[:ntp server list],指定本地计算机所使用的NTP时间服务器的列表。该列表可以包含IP地址或DNS名称,用空格分开。如果要使用多个时间服务器,该列表必须用引号引起来。例如net time /setsntp:"time.nist.gov,0x1 time-a.nist.gov,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。 2.1.2 W32timeW32tm是用来同步本地计算机与远程计算机或域时间的类似命令。在域控制器上使用W32tm前必须停止W32Time,完成后再启动W32Time。W32tm的语法为:w32
关于W32tm语法的详细说明,可以在命令提示符下键入W32tm /?,将列出语法和所有参数的说明。 2.2 注册表项以下注册表项位于 HKLM\SYSTEM\CurrentControlSet\Services\W32Time
2.2.1 Parameters\NtpServerHKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\NtpServer
Description Stores a list of time sources that this computer uses to synchronize its time. The time sources appear either as a DNS name or an IP address of the time source server. The list is space-delimited, with one address per line. Each time source may also be followed by a comma and a DWORD containing flags for special handling of that time source. If the flags are not specified, they default to 0x0. The available flags are:
例如net time /setsntp:"time.nist.gov,0x1 time-a.nist.gov,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。 Change Method You can change the value of this entry by using the /setsntp parameter of the net time command at the command line. For more information about net time, see Help and Support Center for Windows XP. 2.2.1 Parameters\TypeHKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
Description Specifies the type of time sources, if any, to which the computer synchronizes its time.
Change Method To change the value of this entry, use the command-line tool w32tm.exe (specifically, the command w32tm /config /syncfromflags). For more information about w32tm.exe, see Windows Server 2003 Help and Support Center. Activation Method To make changes to this entry effective, at the command line, type: w32tm /config /update 2.3 设置示例2.3.1 使用“时间和日期 属性”设置对话框双击任务栏右下角“时间”,打开“时间和日期 属性”设置对话框; 选择“Internet时间”标签; 选中“自动与Internet时间服务器同步”选项,在“服务器”中填入网络时间服务器的IP地址,如“192.168.1.232”(只能输入1个服务器地址)。按“立即更新”可直接同步。 2.3.2 命令方式在“运行(R)”中用“cmd”命令进入在DOS命令行窗体;执行以下命令(注意空格):
2.4 可能出现的问题计算机没有同步。因为没有可用的时间数据。(The computer did not resync because no time data was available) 出现该问题的原因可能是windows time service没有正确的启动,或者与组策略中的时间配置冲突。请在组策略(gpedit.msc)中将配置更改为“未配置”。 3 Windows Server 20033.1 命令介绍Windows Server 2003下有关时间的命令有两个,net time和W32tm,下面对这两个命令的语法和参数加以说明。 3.1.1 NET TIMEnet time命令使计算机的时钟与另一个计算机或域的时钟同步。如果在没有 /set 选项的情况下使用,则显示另一个计算机或域的时间。net time的语法为:
参数说明: l 无参数,显示被指派为本地计算机的Windows服务器域时间服务器的当前时间。 l \computername,指定要检查或与之同步的服务器的名称。 l /domain[:domainname],指定要同步时间的域。 l /rtsdomain[:domainname],指定要与之同步的可信时间服务器所在的域。 l /set,使计算机的时钟与指定的计算机或域的时间同步。 l /querysntp,显示当前为本地计算机或 \computername 所指定的计算机配置网络时间协议(NTP)服务器的名称。 l /setsntp[:ntp server list],指定本地计算机所使用的NTP时间服务器的列表。该列表可以包含IP地址或DNS名称,用空格分开。如果要使用多个时间服务器,该列表必须用引号引起来。参见注册表项中NtpServer项说明。 3.1.2 W32timeW32tm是用来同步本地计算机与远程计算机或域时间的类似命令。在域控制器上使用W32tm前必须停止W32Time,完成后再启动W32Time。W32tm的语法为:
关于W32tm语法的详细说明,可以在命令提示符下键入W32tm /?,将列出语法和所有参数的说明。 3.2 注册表项以下注册表项位于 HKLM\SYSTEM\CurrentControlSet\Services\W32Time
3.2.1 Parameters\NtpServerHKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\NtpServer
Description Stores a list of time sources that this computer uses to synchronize its time. The time sources appear either as a DNS name or an IP address of the time source server. The list is space-delimited, with one address per line. Each time source may also be followed by a comma and a DWORD containing flags for special handling of that time source. If the flags are not specified, they default to 0x0. The available flags are:
例如net time /setsntp:"time.nist.gov,0x1 time-a.nist.gov,0x1”,其中的0x1是在使用完整域名称作为NTP服务器的时候需要的,如果使用IP地址则可以忽略。 Change Method You can change the value of this entry by using the /setsntp parameter of the net time command at the command line. For more information about net time, see Help and Support Center for Windows Server 2003. 3.2.2 Parameters\TypeHKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
Description Specifies the type of time sources, if any, to which the computer synchronizes its time.
Change Method To change the value of this entry, use the command-line tool w32tm.exe (specifically, the command w32tm /config /syncfromflags). For more information about w32tm.exe, see Windows Server 2003 Help and Support Center. Activation Method To make changes to this entry effective, at the command line, type: w32tm /config /update 3.3 设置示例3.3.1 使用“时间和日期 属性”设置对话框双击任务栏右下角“时间”,打开“时间和日期 属性”设置对话框; 选择“Internet时间”标签; 选中“自动与Internet时间服务器同步”选项,在“服务器”中填入网络时间服务器的IP地址,如“192.168.1.232”(只能输入1个服务器地址)。按“立即更新”可直接同步。 3.3.2 命令方式在“运行(R)”中用“cmd”命令进入在DOS命令行窗体;执行以下命令(注意空格):
3.4 可能出现的问题计算机没有同步。因为没有可用的时间数据。(The computer did not resync because no time data was available) 出现该问题的原因可能是windows time service没有正确的启动,或者与组策略中的时间配置冲突。请在组策略(gpedit.msc)中将配置更改为“未配置”。 4 参考有关 Windows 时间服务的更多信息,请单击下面的文章编号,以查看 Microsoft 知识库中相应的文章: 216734 如何在 Windows 2000 中配置权威时间服务器 321708 如何在 Windows 2000 中使用网络诊断工具 (Netdiag.exe) 314054 如何在 Windows XP 中配置权威时间服务器 816042 如何在 Windows Server 2003 中配置权威时间服务器 816043 如何打开 Windows 时间服务中的调试日志 884776 配置 Windows 时间服务以防出现大的时间偏移 |
|