Checking time on remote server

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
JBurger
Junior Coder
Posts: 33
Joined: Wed Nov 12, 2003 7:16 pm
Location: NY

Checking time on remote server

Post by JBurger » Thu Sep 01, 2005 5:38 pm

Does anyone know how to query a server (win2000 and unix) to let me the current time the serverr thinks it is. I have a bunch of computers that are supposed to hit an NTP server and sync the time but it doesn't seem to be working on all. I need to query a bunch of servers to determine which ones have their time incorrect.

Thanks
-Joe

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Sep 01, 2005 5:59 pm

Use the NET TIME command and pipe results to a text file?

Let>RP_WAIT=1
Run>NET TIME //computername >> c:\time.txt
//now read c:\time.txt ... etc
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Sep 01, 2005 5:59 pm

Cannot try this now, but have you tried NET?

I believe the syntax is something like:
NET TIME \\COMPUTERNAME

Once you have the correct syntax you could redirect the output to a text file, then parse the text file to extract the Time.

Then you can use IF and branch your script based on the results of the Time you extracted.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Sep 01, 2005 6:02 pm

Great minds not only think alike, they think alike at precisely the same time. Which is spooky given this question was about time itself!
MJT Net Support
[email protected]

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Sep 01, 2005 6:36 pm

Scary indeed...

I thought that NET TIME queries a time server, whereas if I understand the OP's question correctly he wants to check just the regular clock on some servers to see if they have synced with a time server.

JBurger
Junior Coder
Posts: 33
Joined: Wed Nov 12, 2003 7:16 pm
Location: NY

Post by JBurger » Thu Sep 01, 2005 7:15 pm

That's it. Tried it on servers in different time zones and it gave me the server time in that time zone.

Don't know why I couln't remember that. Thanks Guys!!

-Joe

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts