We have machines that run our software in a demo mode. In order to do this they have to change the time (to as far back as 2010). We can’t ‘net time \servername /set /y’ because we’ll get ‘permission denied’ from our domain controller. Is there an outside source I could grab the correct time? I’d like to have a .bat file that will set the system time to the correct (current) time and run it w/ scheduled tasks nightly so anyone who forgot to fix the time won’t leave the system inaccessible the next morning (unable to logon to domain because time is way off).

Thanks in advance,

Russ

8 Spice ups

I use these; 0.north-america.pool.ntp.org, 1.north-america.pool.ntp.org, 2.north-america.pool.ntp.org, 3.north-america.pool.ntp.org

I set our DC up to use them with this; w32tm /config /manualpeerlist:“0.north-america.pool.ntp.org, 1.north-america.pool.ntp.org, 2.north-america.pool.ntp.org, 3.north-america.pool.ntp.org” /syncfromflags:manual /reliable:yes /update

Might work on your one server as well.

forgot to add these as well after you set the manualpeerlist

w32tm /query /peers

net stop w32time

net start w32time

w32tm /resync /nowait

1 Spice up

I think you want to use w32tm, not net time. But I’m not sure it will change the time by such a large amount - I seem to recall that there is a limit on how much it will change.

Here - I just found this:

If you’re using a recent Windows version, you can use the ntp client that is built into the system. As administrator enter

w32tm /config /syncfromflags:manual /manualpeerlist:0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org

at the command prompt. This will work on Windows 2003 and newer. If you use an older version of windows you can try

net time /setsntp:“0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org

The same can be achieved by, as administrator, right-clicking the clock in the taskbar, selecting ‘Adjust Date/Time’ and entering the server name in the ‘Internet Time’ tab.

From here: pool.ntp.org: How do I setup NTP to use the pool?

1 Spice up

Thank you for your replies but neither worked / I already tried both of those.

Both commands were completed successfully but time was not changed from 8/8/2010 07:40. Screenshot attached.

Any other ideas?

Thanks,

Russ

As I said above I don’t think you can change the time by such a large amount this way.

Here is some info about this issue:

1 Spice up

First, this: http://blogs.msdn.com/b/w32time/ See the post about Net Time and w32time.

Also, if this is a virtual machine, the host might be controlling the time. I followed this to disable time sync in vmware: VMware Knowledge Base

1 Spice up

Is it a DNS issue? Can you resolve pool.ntp.org (and the other ones)?

Also, be aware, these commands do not make an instant time change. They sync the clock, slowly. I’ve used them on my network and watched (using the stripchart command) as the clock would jump several seconds for each second.

And, I guess I wasn’t paying too much attention to what I copied and pasted… after you set the time server you still need to tell it to sync the clock, as Jason posted above.

  1. I can resolve pool.ntp.org

  2. yes this is a vm but time synch is disabled (hyper-v)

  3. ok so… If I do what larry said ONCE per machine and then do what Jason said nightly and I should be good to go? If so, thank you both very much.

  4. Yes, you’re right… it does take a while for time to change.

Thanks,

Russ

Looks like this already got answered, but in case it was missed here is the TechNet article for best practices when using Windows Time Service:

That should work, yes. Of course, test it first to be sure. I don’t know how long it would take for an adjustment of 3 years.

And, depending on the OS, you may need to make a registry adjustment of the MaxPosPhaseCorrection and MaxNegPhaseCorrection entries, as shown in article I linked above.

you can use NTPDATE utility for syncing server date and time

sudo /usr/sbin/ntpdate 0.north-america.pool.ntp.org 1.north-america.pool.ntp.org 2.north-america.pool.ntp.org 3.north-america.pool.ntp.org