Ramblings From The Litter Tray of Life

Posts Tagged ‘command line’

How to set an SNTP server by command line

Posted by graycat on 22 July 2008

Ok, I know this one won’t interest most people but it’s something I’ve had to do twice this month so I thought I’d throw it out there.

First you might be asking yourself “why is it important to set a time server? The clock looks about right to me!”

Well, my well meaning friend, the authentication protocol that windows uses within domains (kerberos) uses time as part of it’s calculations and it’s a bit picky about how far out you get. I’ve seen one server that just would not let a senior admin logon no matter what he did …. until he spotted the clock was right but the date was out by a month! Once that was corrected, he was off and running!

Normally within a domain you will be assigning IP addresses using DHCP and you can add the time server in there as one of the options. However, if you get into the situation where you need to check it is synchronising with the right box you can use this command:

Net time /querysntp

This will then spit out where it’s getting its time from. If nothing is being syncronised with then it will also report this too.

To add a server you’ve need theĀ  /setsntp: switch so something like this would do the job:

Net time /setsntp: timeserver.mydomain.com

If you run the querysntp again, it should report the current SNTP server you’ve just set.

A bit of advice though – it doesn’t matter if you set the clock 45 minutes out of whack with the rest of the world …. as long as all you’re machines are set like that!

Posted in IT | Tagged: , , , , | 2 Comments »