Difference between revisions of "Time synchronization"
Link2Twenty (Talk | contribs) |
|||
Line 4: | Line 4: | ||
<package | <package | ||
id="time" | id="time" | ||
− | name="Time | + | name="Time Synchronization" |
revision="1" | revision="1" | ||
− | |||
− | |||
− | |||
execute="always"> | execute="always"> | ||
− | + | ||
− | <install cmd="net | + | <install cmd="sc config w32time start= auto" /> |
+ | <install cmd="net start w32time" > | ||
+ | <exit code='any' /> | ||
+ | </install> | ||
+ | <install cmd="w32tm /config /manualpeerlist:timeserver /syncfromflags:MANUAL /update" /> | ||
+ | <install cmd="w32tm /resync" /> | ||
+ | |||
+ | <remove cmd="w32tm /config /syncfromflags:domhier /update" /> <!-- put it back to defaults (member of a domain) --> | ||
</package> | </package> |
Latest revision as of 09:02, 5 December 2014
This one synchronizes time on a Windows workstation against some other Windows machine (i.e., domain controller etc.).
<package
id="time"
name="Time Synchronization"
revision="1"
execute="always">
<install cmd="sc config w32time start= auto" />
<install cmd="net start w32time" >
<exit code='any' />
</install>
<install cmd="w32tm /config /manualpeerlist:timeserver /syncfromflags:MANUAL /update" />
<install cmd="w32tm /resync" />
<remove cmd="w32tm /config /syncfromflags:domhier /update" /> <!-- put it back to defaults (member of a domain) -->
</package>
If you're using WPKG Client, it's a good idea to put just net time \\timeserver /set /yes
in a "pre" script.
This command succeeds and works even if your date is off by a lot(unlike normal NTP).
Net Time Plus NTP
This package performs a net time sync plus it also sets your domain NTP server as the primary NTP source and configures ntp.org pool servers as fallback NTP sources. The latter is worthwhile for laptop users who aren't necessarily logged on to your domain.
The hex flag 0x8 after the primary NTP server means use standard NTP client behaviour, the hex flag 0x2 designates the NTP server as a fallback to be used if the primary is not available.
<package
id="time"
name="Time Synchonization"
revision="1"
reboot="false"
priority="100"
notify="false"
execute="once">
<install cmd='net time \\yourntpserver /set /yes' />
<install cmd='%COMSPEC% /c w32tm /config /update /manualpeerlist:"yourntpserver,0x8 0.pool.ntp.org,0x2 1.pool.ntp.org,0x2" /syncfromflags:MANUAL' />
<upgrade cmd='net time \\yourntpserver /set /yes' />
<upgrade cmd='%COMSPEC% /c w32tm /config /update /manualpeerlist:"yourntpserver,0x8 0.pool.ntp.org,0x2 1.pool.ntp.org,0x2" /syncfromflags:MANUAL' />
</package>