Friday, 2 August 2013

CMD: How to check the time on Multiple Machines simultaneously using CMD

Creating and Saving a file with all the machine details

01. Create a new text file and for each machines IP add the following lines:

net time \\10.201.2.60
net time \\10.201.2.70
net time \\10.201.2.100
net time \\10.201.2.101
net time \\10.201.2.120
net time \\10.201.2.130
net time \\10.201.2.140
net time \\10.201.7.200
net time \\10.201.7.206
net time \\10.201.2.102
net time \\10.201.2.103
net time \\10.201.2.80
net time \\10.201.2.90
net time \\10.201.2.91
net time \\10.201.7.207

02. Save the file on your C Drive and call it Checktime.txt.
03. Change the file to a .bat file by changing the extension.

Running the .bat file 

04. Run the following commands:


05. You will find that a a file called TimeResults.txt will be generated in you're C Drive and if you open it will show all the machines and their times:

Current time at \\10.201.2.60 is 25/07/2013 11:20
Current time at \\10.201.2.70 is 25/07/2013 11:20
Current time at \\10.201.2.100 is 25/07/2013 11:20
Current time at \\10.201.2.101 is 25/07/2013 11:20
Current time at \\10.201.2.120 is 25/07/2013 11:20
Current time at \\10.201.2.130 is 25/07/2013 11:20
Current time at \\10.201.2.140 is 25/07/2013 11:20
Current time at \\10.201.7.200 is 25/07/2013 11:20
Current time at \\10.201.7.206 is 25/07/2013 11:20
Current time at \\10.201.2.102 is 25/07/2013 11:20
Current time at \\10.201.2.103 is 25/07/2013 11:20 
Current time at \\10.201.2.80 is 25/07/2013 11:20
Current time at \\10.201.2.90 is 25/07/2013 11:20
Current time at \\10.201.2.91 is 25/07/2013 11:20
Current time at \\10.201.7.207 is 25/07/2013 11:20

Note: An assumption is made that the machine that this command is run on has access to the other machines in the network i.e firewall rules allow access to  the machines is they are on different domains.

No comments:

Post a Comment