Solved

Batch File: NET TIME (or, w32tm)

Posted on 2011-09-26
8
1,496 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
ID: 36601933
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
ID: 36601948
Windows server 2003 R2

Thanks for helping,
Rene
0
 
LVL 10

Author Comment

by:ReneGe
ID: 36602568
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 10

Author Comment

by:ReneGe
ID: 36710918
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
 
LVL 10

Author Comment

by:ReneGe
ID: 36710919
Could you please cancel my close request?
Thanks
0
 
LVL 10

Author Comment

by:ReneGe
ID: 36710924
Sorry for the confusion, and thanks again for your help.

Cheers,
Rene
0
 
LVL 26

Expert Comment

by:pony10us
ID: 36710982
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
ID: 36711213
Thanks
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

831 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