Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logon bat to sync time with a server

Status
Not open for further replies.
Mar 29, 2006
5
0
0
US
I need to create a logon.bat file that will sync users comuters time with a server. Our users do not have permissions to change the time on their local workstation. Is there a was to use "runas" in the bat file?
 
No, but Windows has its own time synchronization services - I'd check your event logs and read up more on it - Windows authentication REQUIRES clocks to be synced up fairly closely.

Not sure if this still applies - it was for NT4 which didn't care as much about time:
 
Windows authentication REQUIRES clocks to be synced up fairly closely.

Only if you are using Active Directory and Kerberos authentication, which is why i asked. If you are just wanting to set the time in a workgroup a bat file will work.

You know what Jack Burton always says at a time like this...
 
While I grant you, we don't have a definitive answer from bluenowhere17, I would think he DOES have a domain because:
1. They have a server
2. Users do not have permission to change the time
3. Trying to use a logon script which typically only runs from a domain.

Admittedly, none of these is CLEAR indication of AD use, but they are all implying it.

Kerberos authentication is used in any NATIVE Mode domain. In my experience, more and more domains are native mode as the years past, further, any small business server based network will run in Native mode.

Rather than "work around" with a third party app, I would suggest getting time sync working with the DCs is more impotant - even if still in mixed mode, this way you are prepared for native mode.
 
Yes we are in a domain and using active directory - the domain admins can use NET TIME \\ServerName /SET /YES because the domain admins have permission to change time. We are currently using logon bats to map network drives and printers and I am looking for a way to run NET TIME as a domain admin in the logon bat.
 
bluenowhere17 - did you read my post? You cannot do this. RUNAS cannot have a password entered into it. To prevent future problems, you should consult the documentation I provided in my first link and synchronize the time using Active Directory and the Windows Time Service.

Technically, you can alter the domain policy to allow standard users to set the time, but this is NOT a good idea.
 
lwcomputing is absolutly right here, if you use active directory then the built in windows time service should keep your clients within 5 mins of the server time. If this is not the casee then you need to investigate why the time service is not functioning.

You know what Jack Burton always says at a time like this...
 
Blue,
You have the answer right there. Just put in your logon.bat the "Net Time" command. I did the same thing to sync all workstations with the PDC. Basically I put the Net Time command as the first thing to run, then it continues with the mapping.
 
The point here is that the .bat file is not required the windows time service should keep all stations in sync if it isn't then something is wrong and needs investigating.

You know what Jack Burton always says at a time like this...
 
You shouldn't use NET TIME in a login script in AD. A properly configured Active Directory will sync machines automatically. Using NET TIME will result in excessive network traffic for time sync.

Pat Richard, MCSE MCSA:Messaging CNA
Want to know how email works? Read for yourself -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top