Time synchronization

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

This one synchronizes time on a Windows workstation against some other Windows machine (i.e., domain controller etc.).

        name="Time Synchronization"
        <install cmd="sc config w32time start= auto" />
        <install cmd="net start w32time" >
            <exit code='any' />
        <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) -->

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[edit]

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.

        name="Time Synchonization"
<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' />