Tip

Script for remote synchronization of workstation's time with 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

Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.