Script that will write the time on all machines in the network to a file

EE,

   A large number of my workstation on my network did not take the daylight savings time setting. I am looking for a way to search the network and see what machines have the wrong time setting. Hoping there is a way to run a script to look at all machines and copy the machine name and the time it is showing.

We are running windows Xp on server 2003 servers.

Thanks in advance for your help.
/R
dh061
LVL 1
dh061Asked:
Who is Participating?
 
pnormsCommented:
Here is a bat that works nice just change:
"c:\temp\timelist.txt"
To the path you would like to output the list to
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
cls
for /f %%c in ('dsquery computer -limit 3000 -o rdn') do @(
REM CHANGE 3000 ABOVE TO LIMIT OF PCS
    net time \\%%~c >nul
    if !errorlevel!==0 (
        for /f "tokens=6,7 delims= " %%i in ('net time \\%%~c') do echo %%~c - %%i - %%j >> "c:\temp\timelist.txt"
    )
)
cls
echo All Done
pause

Open in new window

0
 
MaximumIQCommented:
Sorry I don't have time to tweak this for you. but take a look at this from the Scripting Guy
http://blogs.technet.com/b/heyscriptingguy/archive/2007/03/08/how-can-i-verify-the-system-time-on-a-remote-computer.aspx
0
 
TomasPCommented:
sysinternals (Microsoft) has a utility that is scriptable. You can read and set time and other things
http://forum.sysinternals.com/cannot-set-time-via-psexec_topic4236.html

You will see that you can read the time and set it if it is incorrect and you just need to fill in the pc name
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
pnormsCommented:
And if you have more than 3000 machines in your domain increase line4 3000 to whatever
0
 
pnormsCommented:
It can take some time so you will want to be patient and wait until you see "All Done". I need not say that it has to be run as domain admin.
0
 
dh061Author Commented:
pnorms,

Running it now will let you know when it is complete.

Thanks for your time.
0
 
MarkieSCommented:
Can you not just synch to a DC time server?

http://support.microsoft.com/kb/307897
0
 
pnormsCommented:
Can you not just synch to a DC time server?
http://support.microsoft.com/kb/307897 


Thats what willl need to be done after they gather a list of the machines out of sync.
0
 
dh061Author Commented:
Thank you for this Bat file worked great. thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.