Difference between revisions of "NTP client configuration"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
m
Line 1: Line 1:
 
How to enable or disable NTP client on Windows.
 
How to enable or disable NTP client on Windows.
  
<package id="ntp-client" name="NTP time synchronization" revision="1" priority="999" reboot="false" execute="once">
+
<source lang="xml">
 +
<package id="ntp-client" name="NTP time synchronization" revision="1" priority="999" reboot="false" execute="once">
 
         <install cmd='cmd /c sc config w32time start= auto' />
 
         <install cmd='cmd /c sc config w32time start= auto' />
 
         <install cmd='cmd /c net time /setsntp:192.168.0.1' />
 
         <install cmd='cmd /c net time /setsntp:192.168.0.1' />
Line 10: Line 11:
 
         <remove cmd='cmd /c net stop w32time & net start w32time' />
 
         <remove cmd='cmd /c net stop w32time & net start w32time' />
 
         <remove cmd='cmd /c w32tm /resync /nowait' />
 
         <remove cmd='cmd /c w32tm /resync /nowait' />
</package>
+
</package>
 +
</source>
  
 
or:
 
or:
  
<package
+
<source lang="xml">
 +
<package
 
         id="ntp-client"
 
         id="ntp-client"
 
         name="ntp client configuration"
 
         name="ntp client configuration"
Line 24: Line 27:
 
         <upgrade cmd="%SOFTWARE%\ntp\install.bat" />
 
         <upgrade cmd="%SOFTWARE%\ntp\install.bat" />
 
         <remove cmd="%SOFTWARE%\ntp\uninstall.bat" />
 
         <remove cmd="%SOFTWARE%\ntp\uninstall.bat" />
</package>
+
</package>
 +
</source>
  
 
install.bat:
 
install.bat:
sc config w32time start= auto
+
<source lang="dos">
net time /setsntp:192.168.0.100
+
sc config w32time start= auto
net stop w32time & net start w32time
+
net time /setsntp:192.168.0.100
w32tm /resync /nowait
+
net stop w32time & net start w32time
 +
w32tm /resync /nowait
 +
</source>
  
 
uninstall.bat:
 
uninstall.bat:
net time /setsntp:time.windows.com
+
<source lang="dos">
net stop w32time & net start w32time
+
net time /setsntp:time.windows.com
w32tm /resync /nowait
+
net stop w32time & net start w32time
 +
w32tm /resync /nowait
 +
</source>
  
 
[[Category: Silent Installers]]
 
[[Category: Silent Installers]]
 
[[Category: Changing Windows settings]]
 
[[Category: Changing Windows settings]]

Revision as of 20:51, 20 February 2008

How to enable or disable NTP client on Windows.

<package id="ntp-client" name="NTP time synchronization" revision="1" priority="999" reboot="false" execute="once">
        <install cmd='cmd /c sc config w32time start= auto' />
        <install cmd='cmd /c net time /setsntp:192.168.0.1' />
        <install cmd='cmd /c net time \\192.168.0.1 /set /yes' />
        <install cmd='cmd /c net stop w32time & net start w32time' />
        <install cmd='cmd /c w32tm /resync /nowait' />
        <remove cmd='cmd /c net time /setsntp:time.windows.com' />
        <remove cmd='cmd /c net stop w32time & net start w32time' />
        <remove cmd='cmd /c w32tm /resync /nowait' />
</package>

or:

<package
        id="ntp-client"
        name="ntp client configuration"
        revision="1"
        reboot="false"
        priority="1"
        execute="once">
        <install cmd="%SOFTWARE%\ntp\install.bat" />
        <upgrade cmd="%SOFTWARE%\ntp\install.bat" />
        <remove cmd="%SOFTWARE%\ntp\uninstall.bat" />
</package>

install.bat:

sc config w32time start= auto
net time /setsntp:192.168.0.100
net stop w32time & net start w32time
w32tm /resync /nowait

uninstall.bat:

net time /setsntp:time.windows.com
net stop w32time & net start w32time
w32tm /resync /nowait