Synchronize Windows Server 2008 During Startup

      

Click in the clock with the right mouse button and select Adjust date/time, then go to the Internet Time tab, hit Change settings and Update now. If it works, we can proceed.

Create a file with the following contents in C:\sync-clock.php

<?php
// Attempt resync
system(‘w32tm /resync /nowait’, $return_var);

while( $return_var !== 0 )
{
// Fix w32time errors
system(‘net stop w32time’);
system(‘w32tm /unregister’);
system(‘w32tm /register’);
system(‘net start w32time’);

// Sleep to avoid excessive looping
sleep(5);

// Attempt resync
system(‘w32tm /resync /nowait’, $return_var);
}

// Successful exit
exit(0);
?>

 

Run Computer Management ( compmgmt.msc ) from Control Panel > System and Security > Administrative Tools.

Go to Task Scheduler Library and Create a Basic Task with When the computer starts as Trigger.

Action will be to Start a Program, Input the path to your php executable (php.exe) in Program/Script.
Add Arguments: -n -f “C:\sync-clock.php”

After task is created, edit its properties:
Change User or Group and type SYSTEM, then confirm
Tick Run with highest privileges
Confirm the changes.

About

Sandeep who always wants to explore and share interesting Tips, Tricks, Tutorials, Guides and More. Catch him on Twitter, Join Facebook Fan Page. Subscribe to wRock feed via RSS or EMAIL to receive instant updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Human Verification: In order to verify that you are a human and not a spam bot.