Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

Thanks.

share|improve this question
2  
"Plz give me teh codez" questions are discouraged on Stack Exchange. See meta.stackoverflow.com/questions/142870/… –  DragonLord 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
add comment

2 Answers

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 –  Alen 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
show 6 more comments

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.