Jump to content

Update date and time


Recommended Posts

I want to be able to update the date and time on a system automatically via a command line or vbscript.

Currently I can update the time via a net time command, but this doesnt update the date as well. Is there a way to do this?

Link to comment
Share on other sites

  • 2 weeks later...

?

Try the next autoit script:

Run("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl,,0")
WinWait("Date and Time Properties", "&Time")
Send("{TAB 9}")
Send("{RIGHT 2}")
WinWait("Date and Time Properties", "&Update Now")
ControlClick("Date and Time Properties", "&Update Now", "Button2")
WinWait("Date and Time Properties", "The time has been successfully synchronized with time.windows.com")
ControlClick("Date and Time Properties", "&Update Now", "Button3")

If it works, then compile and execute when is needed.

Edit: works only for updating time.

Edited by radix
Link to comment
Share on other sites

Is there a 3rd party app that can pull date/time settings from a server and automatically change the local system date/time? I vaguely remember seeing one before on a thin client but my mind doesn't seem to recall the name of that specific app. Portable would be better so I can run it from a network store.

Basically the reason why I am trying to do this is so I can completely have a hands off PXE boot unattended install of Windows XP. This is the last step in the whole process and I cannot seem to get it..... any other workarounds would be appreciated :thumbup

Link to comment
Share on other sites

So I finally figured it out on my own.

Basically I run 3 commands:

net time /setsntp:<servername>

net stop w32time

net start w32time

It's a little more complex than it needs to be but it works.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...