Gettime from server

Drstein99

Junior Contributor
Joined
Sep 26, 2003
Messages
283
Location
Audubon, Nj
Hello all, I have a simple question, I can't seem to find the answer to please help.

I want to get the time from my windows domain server, and also possibly synchronize that time on the local machine.

I'm writing software that tracks statistics, so it's very important for me to have the precise time when I record the data. Thanks.
 
Visual Basic:
Dim ps As New System.Diagnostics.ProcessStartInfo
        ps.FileName = "Net"
        ps.Arguments = "SEND \\<servername> /set /yes"

        Dim p As New System.Diagnostics.Process
        p.StartInfo = ps
        p.Start()
        p.WaitForExit()
 
I cut and pasted your code into a commandbutton click sub

replaced <<servername>> with the server I want to get time from, i .e:

"SEND \\MYSERV /set /yes"


Does not synchronize time with the server.
 
before you call the Start method add the line
Visual Basic:
ps.WindowStyle=ProcessWindowStyle.Hidden

Dispose isn't really needed on ps as it doesn't have any unmanged resources so the Garbage collector will sort it out for you anyway.
 
Back
Top