Set Windows system time from command line similar to Linux rdate command

0

I need to set the time on a Windows 2008 server via an internet clock server from a command line, and ensure that Windows 2008 doesn't do it by itself.

I will use this for a .cmd file which looks like this:

:start
RunApp
SetSystemTimeViaInternet
goto start

The purpose is to ensure, that the server has the correct time, but that the time doesn't change while the app is running.

I tried to look at w32tm and "net time", but none of those seem to work. Any ideas?

Lars D

Posted 2011-02-09T15:27:21.870

Reputation: 291

is this server a virtual machine? – wullxz – 2011-05-31T21:07:14.440

Answers

0

Install and configure NTP to synchronize to your external server(s). I suppose NTP is already in Windows 2008.

NTP corrects the time in very little steps, so you won't notice it and you will have always the right time.

Or what do you really mean with "the time doesn't change while the app is running" ? Do you want to stop the system clock? This is probably not possible ...

rems

Posted 2011-02-09T15:27:21.870

Reputation: 1 850

Basically, I noticed that the system clock goes backwards on sundays at 00:00 UTC on that machine, and the application doesn't seem to tolerate that the time goes backwards. Since the machine is a completely clean Windows 2008 installation with just that app, I strongly assume that Windows 2008 is preconfigured to adjust the time on sundays at 00:00, and that the hardware simply has a clock that goes too fast. Therefore, I have disabled the built-in time sync in Windows 2008. – Lars D – 2011-02-10T06:35:45.123