Solved

Batch File: NET TIME (or, w32tm)

Posted on 2011-09-26
8
1,473 Views
Last Modified: 2012-05-12
Hi there,

I need the followings:
-Batch file or Command line, to setup a Domain Controller to sync it's time with an Internet Atomic Clock, every 30minutes
-Batch file or Command line, to set all the domain PCs to sync their clock with the domain controller every 30minutes
-Command line to force remote PC to sync it's time with the domain controller immediatly.

Thanks for your help,
Rene
0
Comment
Question by:ReneGe
  • 6
  • 2
8 Comments
 
LVL 26

Accepted Solution

by:
pony10us earned 500 total points
Comment Utility
Are you running Server 2008 R2?  I believe there are registry settings that need to be made on the server and client for what you want. See:  http://www.fir3net.com/Windows-2008/configuring-windows-2008-r2-as-an-ntp-server.html
0
 
LVL 10

Author Comment

by:ReneGe
Comment Utility
Windows server 2003 R2

Thanks for helping,
Rene
0
 
LVL 10

Author Comment

by:ReneGe
Comment Utility
I just successfully scripted it.

Have any better ideas?

I'll close this post tomorrow

Cheers


@ECHO OFF

::SEPERATE WITH A COMMA, AND WITHOUT "\\"
	SET PDCemulators=DC-LAN1,DC-LAN2,DC-LAN3
::PDCEmulators SpecialPollInterval In Seconds and in decimal (not HEX)
	SET SpecialPollInterval=900
::ListOfPCs, ENTER HOW PC NAMES START, AND SEPERATED WITH A SPACE.
	SET ListOfPCs=\\PCLAN1 \\PCLAN2 \\PCLAN3


REM SETTING UP PDC EMULATORS
	FOR %%A IN (%PDCemulators%) DO (
		PSEXEC \\%%A w32tm /config /manualpeerlist:"0.ca.pool.ntp.org,1.ca.pool.ntp.org,3.ca.pool.ntp.org" /reliable:yes /update
		REG ADD "\\%%A\HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" /v SpecialPollInterval /t REG_DWORD /d %SpecialPollInterval% /f
		::RESTARTING TIME SERVICE
			PSEXEC \\%%A NET STOP w32time
			PSEXEC \\%%A NET START w32time
		::UPDATING TIME FROM INTERNET TIME SERVERS
			PSEXEC \\%%A W32tm /resync
	)

REM SYNCHRONISING ALL DOMAIN PCs
	FOR /F %%A IN ('NET VIEW ^| FINDSTR -i "%ListOfPCs%"') DO PSEXEC %%A W32TM /resync

PAUSE
EXIT

Open in new window

0
 
LVL 10

Author Comment

by:ReneGe
Comment Utility
I've requested that this question be closed as follows:

Accepted answer: 0 points for ReneGe's comment http:/Q_27328642.html#36602568
Assisted answer: 500 points for pony10us's comment http:/Q_27328642.html#36601933

for the following reason:

Thanks pony for helping.<br /><br />I will post script updates.<br /><br />Cheers,<br />Rene
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 10

Author Comment

by:ReneGe
Comment Utility
Could you please cancel my close request?
Thanks
0
 
LVL 10

Author Comment

by:ReneGe
Comment Utility
Sorry for the confusion, and thanks again for your help.

Cheers,
Rene
0
 
LVL 26

Expert Comment

by:pony10us
Comment Utility
There is a tool you could look at here:  http://www.dougknox.com/xp/utils/xp_inet_time.htm
0
 
LVL 10

Author Comment

by:ReneGe
Comment Utility
Thanks
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now