Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need the script to automate Time Server update. I suspect the internal battery that keeps time up-to-date is dead and I don't want to change the battery because I'll discard the laptop soon for a new one.

Every time i start-up, I must - Right-click > Adjust date/time (Taskbar) > Internet Time Setting > "Synchronize with an internet time server" and click "Update now" to update the time. Once updated, the time runs correctly throughout because I edited the number of SpecialPollInterval in the registry to poll time server every 660 seconds.

Could someone please give me a VB script and how to use it. Or if there's another way possible, let me know. I'm tired of doing this manually in each Startup and sometimes I do forget, only to be reminded after a software stops working due to the wrong time. The worse is to send outdated emails.


share|improve this question
"Plz give me teh codez" questions are discouraged on Stack Exchange. See… – bwDraco Dec 18 '12 at 0:11
Sorry I'm new here. I only tried to explain my problem. – Frank Dec 18 '12 at 1:51

You don't need a VB script you can just use .bat file with a windows command you can also start from command prompt manually

w32tm /resync

just put the above command in .bat file and put that file in your start up folder.

  1. make a new text file lets say, sync_time.txt and put that command in it
  2. rename the .txt file to .bat so you that you have a sync_time.bat file
  3. either start that file manually or put it in startup folder so it starts automatically every time you log on.
share|improve this answer
I've done exactly what you instructed. I'll back here give feedback on whether it worked or not. But I believe will work. – Frank Dec 18 '12 at 1:40
It didn't work and double-clicking on the bat file didn't work either. – Frank Dec 18 '12 at 16:15
try right click bat file (or right click cmd and select runa as administrator and then do w32tm /resync command) and run as Administrator, also you can put the bat file in task scheduler mark Run with highest privileges, and on triggers select run at startup to automate it – rAlen Dec 18 '12 at 16:19
Ran the bat as admin, it didn't work. Ran CMD as admin got this; 'code C:\Windows\system32>w32tm /resync Sending resync command to local computer The computer did not resync because the required time change was too big. C:\Windows\system32>' – Frank Dec 18 '12 at 16:50
Please "'code" and "'" not a part of it. – Frank Dec 18 '12 at 16:52

In Windows 7 time sync is a scheduled task. If you start up the task scheduler you can adjust the task so that it runs at start up in addition to the already scheduled updates. You can access task scheduler via control panel, administrative tools.

share|improve this answer
I'll try your solution if the one I'm trying now doesn't work. Thank you. – Frank Dec 18 '12 at 1:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .