# MS-DOS Commands to Sync Time



## furbyj (Oct 14, 2011)

Hey all, 

I've been reading forum posts on this site and a few others for the last few years. Everything has been really informative, but I've looked around a bit and can't find the answer to this question so I'm finally posting myself. 

I'm working on a small network (~8 computers) that is not connected to the internet. We are developing this network with two servers and a datalog computer. Recently I've been working on ensuring the time on all the computers is synchronized. 

I have all the computers now synching together at 4am everyday via Microsoft Scheduler that simply runs a batch file on every computer that contains the command:

```
net time \\datalogcomputer /set /y
```
simple enough and works. 

But now I want to create a file that can sych all of the computers manually. So that from any computer I can run the batch and have them all sync up. I've been looking around and can't seem to find anything that can push the time onto networked computers. Even trying to run the "net time" file simply syncs your time with the datalogcomputer. 

Does anyone have any suggestions as to how I can accomplish this?

Please help. 
Thanks.


----------



## Wand3r3r (Sep 17, 2010)

You are working way to hard on something that requires no effort at all.

You don't need to schedule the script. Just put it in the startup folder under all users and it will auto run everytime the computer is booted. You don't need to sync time as often as you are.

I take it you are not running Active Directory but are in a workgroup?

If you go to a cmd prompt you can type at /? note this is how you can schedule tasks from one station to the others. But there is no way I am aware of that you can set the time on all from one command.

But seriously you don't need to do any of this at all.


----------



## furbyj (Oct 14, 2011)

These computers will be barely ever rebooted. I was going to add that feature as well, but I don't think it will be used but once a month. 
I realize that daily time sync is unnecessary unless your clock is really terrible, but it is a requirement of the project to be able to sync the computers with the server and with the PLCs we have attached. 

And yes, we are in a standard Workgroup. 

There really has to be a way to manually set the time on a remote computer.... I mean, if you can reboot a computer remotely, then you should be able to simply set the time to what you want.


----------



## Wand3r3r (Sep 17, 2010)

I pointed you to the at command. That is how you would do it.

You do understand that once you have executed the command you only need to do so again AFTER a reboot? In other words there is no reason to issue it daily or ever if the computer is always on. Its like saying I need to change the oil after just doing so.


----------

