Recipe 6.1. Automatically Setting the Time on a Domain-Connected PC


Problem

You're on a PC connected to a domain, and you want the PC to have its clock set to the proper time automatically, without your intervention.

Solution

Using a graphical user interface

  1. At the Run box, type services.msc and press Enter. This will run the services management module.

  2. Scroll down to the Windows Time entry and double-click on it.

  3. From the Startup type drop-down box, choose Automatic, as shown in Figure 6-1. Click OK. From now on, your PC will automatically synchronize its time with the domain controller every time the PC starts. (Note: This setting is turned on by default, but there is a chance that it has been turned off on your system, so it's a good idea to double-check.)

Figure 6-1. If you're connected to a domain, the Windows Time service will automatically connect to a domain controller to synchronize its clock


Using a command-line interface

At the command line, type net start w32time and press Enter. That will start the Windows Time service. To stop the service, at the command line type net stop w32time and press Enter. That will stop the Windows Time service. When you use the command line to start the Windows Time service, the service only runs for that single session. If you want the service to start every time you start XP you can use the service's management module, or you can use the sc.exe utility (run sc /config for more information).

Discussion

Only computers running Windows XP Professional can connect to domains, so XP Professional has Windows Time service, while the XP Home Edition does not. By default, the Windows Time service runs automatically on Windows XP Professional computers.

Time synchronization takes place with the Windows Time service during system startup. During startup, the Net Logon service looks for a domain controller that can synchronize time with the PC. It follows the Active Directory hierarchy. When the service finds a domain controller, it sends a request for time and waits for a reply. The communication is an exchange of SNTP packets that calculates the time offset and the roundtrip delay between the two computers.

You can also use the Registry to synchronize a PC's time with a domain controller on stsartup. Open the Registry Editor, and go to the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters. Create a REG_SZ value called Type and give it the value Nt5DS. That will tell the computer to synchronize its time with a domain controller on startup. If you give it the value NoSync, it will tell the computer not to synchronize its time with a domain controller.

See Also

For more details about using the Windows Time service, see http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/xpmanaged/27_xpwts.mspx. For more in-formation about using the Registry and the Windows Time service, see http://www.winguides.com/registry/display.php/1118.



Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net