We help IT Professionals succeed at work.

Time syncronization without granting user rights

2,089 Views
Last Modified: 2008-01-09
I would like to sync the time of a set of peer machines (i.e. not part of a domain) in the lan at startup. The old net time solution is fine, but it requires to enable the user to change the time, wich is not good.

The current MS solution is Time service in Windows XP. The whole NTPServer protocol seems too cumbersome to me, since I do not neet all these continuous monitoring of the clocks and the adjustments of their frequencies to a master time server, etc. All I want is an initial sync when the machine starts, but not at the cost of having to enable users set the time. In addtion, all machines are just peers, not members of a domain.

Any ideas?
Comment
Watch Question

Commented:
I think the best solution really is to enable time synchronization by right clicking the clock>Adjust Date/Time and enabling it on those tabs. There's no extra configuration required. Aside from that, running some kind of protected script on startup would involve a lot of messy permissions. Your other option would be to go third part with a tool such as:

http://www.argosoft.com/rootpages/TimeSync/Default.aspx

Hope this helps.

Author

Commented:
I cannot do the clicking thing because this has to run automatically in a number of PC's every day without the user having to bother or even know about it.

The Argosoft sofware looks like an option. Do you know wether it can be run from a bat file?

Commented:
I use ntp and the following script to sync the clocks on my clients:-

net time /setsntp:<ntp-server>,0x8
net stop w32time
net start w32time

The stop/start causes the time service to requery the ntp server.

Setting NTP up on unix/linux is not that difficult, or use a public NTP server (http://ntp.isc.org/bin/view/Servers/WebHome)

Author

Commented:
Mehuge,
1) If I do what you say I get no errors but no time change edither.

2) Is there anything to be done in the server (Win2K in this case) besides starting the Windows Time service?

3) Is there any better description of the net command than the (very scarce) on line help?

4) When your scrip finishes you leave the w32time running?

Commented:
1. My solution uses an NTP server rather than a Win2k time service.  We sync our client PCs with a linux server on our network.  If your trying to sync to a Win2k server using my script it wont work.

2. If your trying to sync windows clients with a win2k server, have you looked at:

http://support.microsoft.com/kb/120944

which links to:-

http://support.microsoft.com/kb/216734/EN-US/  - How to Configure an Authoritative Time Server in Windows 2000
http://support.microsoft.com/kb/307897/EN-US/  - HOW TO: Synchronize the Time Using the Windows Time Service

3. See 2

4. Our client PCs leave w32time service running yes, although the service seems a little unreliable and a stop/start gives them the kick they need.  We dont run our clients in a domain and we use linux servers which is why I chose ntp method.  The ,0x8 after the host name proved to be key to getting this to work with an ntp server.

Author

Commented:
1)  Is there any way to use a similar script against a Win2k workstation?

2) These are the two references I started with. The heading of this thread is refering to exactly this solution. I am lookign for something simpler. Net time command would be perfect, but it needs to provide rights to the user.

3) My question is not about time services but about the NET command in general

4) What is the ,0x8 for? This is one of the reasons for my question in 3)

Commented:
> 4) What is the ,0x8 for? This is one of the reasons for my question in 3)

I couldnt relocate the original reference which described the ,0x8 which was a KB article which specifically talked about using net time /setsntp for setting the time and the current references to this I can find describes it differently from what I remember but its for 2003 server.  How I remember it described was that it affects the protocol that windows uses to talk to the server, and I found that 0x8 make it compatable with the ntpd daemon that runs on the public and unix/linux time servers.  0x1 is the default I believe (from memory).

> 1)  Is there any way to use a similar script against a Win2k workstation?

Which machine is providing the reliable time?  i.e. which machine do you want to synchronise your clocks with?  For a win2k machine running the sntp server, use

net time /setsntp:<sntp-server>
net stop w32time
net start w32time

"You can change a registry entry to make one of your Win2K systems into an SNTP server. In HKEY_LOCAL_MACHINE\ SYSTEM\CurrentControlSet\Services\W32 Time\Parameters, find the REG_DWORD subkey called LocalNTP. Change the subkey value from 0 to 1. After you restart Windows Time Service, your Win2K system will function as an SNTP server."

> 3) My question is not about time services but about the NET command in general

Its about a year since I was looking into all this for our network and it seems most documentation is 2003 focused now.  If you have not seen the following, maybe they can help you:

http://msdn2.microsoft.com/en-us/library/ms954427.aspx

http://www.microsoft.com/technet/prodtechnol/Windows2000Pro/maintain/w2kmngd/16_2kwts.mspx#EPC

Author

Commented:
Fine, the script you provide works against a Win2k without having to enable the user to change the time, however I find two limitations:

1) It does not work against a plain NAT device. What I was doing so far was "net use <server> /set" this works against anything: Win2K, Linux, and even a NAT device wich only runs some sort of Lan Manager. In my network the only machine that it's all the time on is the NAT device, so this would be the best candidate where to sync the time.

2) It is not clean leaving an application running that is not needed, although this is a minor concern.


I still like more the old solution, if I could just solve the problem with the time setting permission. Any ideas?

Commented:
w32time is a windows service and is designed to be running all the time.  It isnt constantly polling, most of the time its idle.

http://support.microsoft.com/kb/224799

"The time server client performs periodic checks.• The client connects to the authenticating domain controller once each "period."
• The initial default period is 45 minutes.
 
d.  If the time synchronization attempt is successful three consecutive times, then the interval check period is increased to 8 hours. If it is not successful three consecutive times, then it is reset to 45 minutes. "

> I still like more the old solution, if I could just solve the problem with the time setting permission.

What about using windows task scheduler to schedule a task to run at startup (or whenever you like) to run net time \\server /set and make that task run under the administrator account.

Author

Commented:
Yes, I know that and I agree that it is not a heavy burden, as I said this is a minor concern. The point is that if the added functionality of the NPT (checking periodically with a low frequency and establishing a pyramidal structure of time servers, both of which I don't need) is going to cost me not being able to use my preferred time server, I am not convinced of the change.

Your second option would be an option *IF* there is a way to run a script under administrator account without having to write down the admin pw or having to logg in as admin. If this is possible, please tell me how.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
The task scheduler is is exactly what I was lookign for ...

if if could just make it work: since I created the task I am permanently getting now a
System Error 5.
Access denied.
in the XP machine when I try to get the time from the Win2K, even when I run the command in a command window. What could happen?

Author

Commented:
Ok, I  could solve this last problem.
As said before, the task schedules is my prefered solution for my problem.

Thanks for your help.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.