Solved

query Time Server & set(ie NET TIME \\<SERVER> /SET /Y)

Posted on 2004-04-28
10
521 Views
Last Modified: 2008-02-26
As the subject heading says, I have a client/server setup in where log files are time sensitive and therefore need to synchronize the time between the server and client machine when one of the client machine reboots.

I know how to set the sntp server :

net time /setsntp:<timeserver>

and how to sync the time (assuming it does this on boot as well)

NET TIME \\<SERVER> /SET /Y

how can I query the network and find  a list of time servers so that I can give the user a choice of which one to use?

Thanks.

0
Comment
Question by:bswiftly
  • 5
  • 3
10 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10948509
I don't know of ways of enumerating external servers, but there are lists:

Public NTP Time Servers
http://www.eecis.udel.edu/~mills/ntp/servers.html

Bob
0
 
LVL 1

Author Comment

by:bswiftly
ID: 10960411
i am interested in enumerating time servers on the local netowrk.. not remote.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10961320
Aaah, a completely different story.

I have some code in VB6 that used NetServerEnum to enumerate SQL servers, and other types of servers as needed.  There is a bit that indicates TimeSource, so it would be easy to modify.  Unfortunately, since I didn't have a need to run this in .NET yet, I haven't converted this.  I tried to do that this morning, and failed, as it didn't find anything.  There are significant differences in the "managed" world of .NET and the "unmanaged" world of Windows API, so it might take me some time.

Bob
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 1

Author Comment

by:bswiftly
ID: 11008493
if you want i can give you partial points for effort..because I solved the problem  and no one posted an answer that I was looking for.  otherwise I'm going to clean this thread up.

thanks
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11008499
Curious how you solved your problem?

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11008507
Points not too important here.  Interested in learning.

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11008734
I would like to see a solution to this question.  If one is provided, then it can be PAQ'ed, otherwise delete.

Bob
0
 
LVL 1

Author Comment

by:bswiftly
ID: 11008803
I didn't really solve it the way I wanted to.  Its still not even 100% robust.

I went through and found the differences between the xp version of dos and the one in win2k.  

this is the chunk of the select statement that  writes the batch file.  with xp i didn't use the w32tm command because it seemd to work better without it. but with xp you can't set a 'period' for it to re-sync.... i assume it does this automatically?

                    Case 0 'Win2k
                        s.WriteLine("NET TIME /SETSNTP:" & timeServer)
                        s.WriteLine("net stop w32time")
                        s.WriteLine("w32tm -once -period 1440")
                        s.WriteLine("net start w32time")

                    Case 1 'WinXP
                        s.WriteLine("NET TIME /SETSNTP:" & timeServer)
                        s.WriteLine("NET TIME /SET /Y")




however I did not find a way of enumerating any time servers on the system.  
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 11034749
Closed, 125 points refunded.
PashaMod
Community Support Moderator
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question