Script for remote synchronization of workstation's time with PDC

Here's a small batch file that allows the administrator to remotely synchronize a workstation's time with the PDC.

Here's a small batch file that allows an administrator to remotely synchronize a workstation's time with the PDC (primary domain controller) as the defualt domain user doesn't have the right to sync the time of the PC.

To sync the workstation time with the PDC, the admin will need to copy the small batch file FixTime.bat from below. Also, he or she will need the utility PsExec.exe from Sysinternals.com.

The contents of the batch file are as follows:

===FixTime.bat===

@echo on
If .%1==. goto syntax

rem
rem Replace with the name of the domain.
rem

psexec %1 net time //domain: //set //y

goto end

:syntax

echo.
echo.
echo * Invaild Argument *
echo.
echo.
echo Syntax :
echo Fixtime MachineName
echo.
echo.
goto end


:end
==========================

This batch file needs to be executed from the same directory as the PsExec.exe or you can copy psexec.exe to a folder in the PATH variable so that it can be executed from any place. Also, the batch file takes into account that the net.exe and net1.exe files are available in the path variable of the remote PC.

Thats it. Just type:

Fixtime

And the machine's time will be synced with the PDC/BDC (backup domain controller) of the domain.

Note:- As this command needs Admin privilege to execute, you will need to execute this batch file while logged on as a domain admin on your PC. Code:
This was first published in December 2001

Dig deeper on Windows Operating System Management

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close