Drstein99 Posted October 14, 2003 Posted October 14, 2003 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. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Administrators PlausiblyDamp Posted October 14, 2003 Administrators Posted October 14, 2003 Could you just shell the command Net time \\servername /set /yes Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Drstein99 Posted October 14, 2003 Author Posted October 14, 2003 "NET time" comes up as invalid commands is there a library i need to include? Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Administrators PlausiblyDamp Posted October 14, 2003 Administrators Posted October 14, 2003 Dim ps As New System.Diagnostics.ProcessStartInfo ps.FileName = "Net" ps.Arguments = "SEND \\ /set /yes" Dim p As New System.Diagnostics.Process p.StartInfo = ps p.Start() p.WaitForExit() Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Drstein99 Posted October 14, 2003 Author Posted October 14, 2003 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. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Administrators PlausiblyDamp Posted October 14, 2003 Administrators Posted October 14, 2003 If you ever see me hit me for being stupid ;) was holding a conversation at the same time should be TIME not SEND. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Drstein99 Posted October 14, 2003 Author Posted October 14, 2003 That worked fine, thanks. One more thing: How do i stop the DOS box from flashing? Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Drstein99 Posted October 14, 2003 Author Posted October 14, 2003 Also - how come I can do p.dispose, but not ps.dispose? Dont I have to release that object from memory? Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Administrators PlausiblyDamp Posted October 14, 2003 Administrators Posted October 14, 2003 before you call the Start method add the line 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Drstein99 Posted October 14, 2003 Author Posted October 14, 2003 Ok mission accomplished. thanks alot! Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.