Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Create SNTP Report for AD Domain?

Posted on 2011-09-27
7
Medium Priority
?
424 Views
Last Modified: 2012-05-12
Does any one know of a tool that could pull the NTP information from every windows server in a domain? I want to make sure that all of the 100+ servers I'm in charge of are all pointing to the same place.

Thanks!
0
Comment
Question by:THe_Revolver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 6

Accepted Solution

by:
netjgrnaut earned 2000 total points
ID: 36710961
The syntax of this command is:

NET TIME
[\\computername | /DOMAIN[:domainname] | /RTSDOMAIN[:domainname]] [/SET]
         [\\computername] /QUERYSNTP
         [\\computername] /SETSNTP[:ntp server list]

So (assuming you've got a domain admin account handy), you need only script the NET TIME command against a list of servers.

Personally, I prefer PowerShell.  The following assumes you have a list of your servers in a text file (servers.txt).  Here's a quick-n-dirty...

$result = ""
gc C:\Users\me\Documents\servers.txt | 
% { 
    $winsvr = "\\" + $_
    $result += "-----"
    $result += $winsvr
    $result += net time $winsvr /querysntp
}
Out-File C:\Users\me\Documents\results.txt -InputObject $result -Encoding default

Open in new window


This will produce a file that looks like this...

-----
\\SERVER01
The current SNTP value is: time.windows.com,0x1

The command completed successfully.

-----
\\SERVER02
This computer is not currently configured to use a specific SNTP server.

The command completed successfully.

-----
\\SERVER03
This computer is not currently configured to use a specific SNTP server.

The command completed successfully.


Hope that helps!
0
 
LVL 8

Expert Comment

by:Amitabh Singh
ID: 36710988
hi try this
for /F "tokens=1 delims= " %%s in (servers.txt) do for /f "tokens=*" %%x in ('reg query "\\%%s\HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters /v NtpServer^|find /i "REG_SZ""') do echo %%s;%%x>>output.csv

Open in new window

create a new text file past fallowing code save as "run.bat"
create a new text file servers.txt and provide list of server in it
open cmd and run run.bat
it will create a file called output.csv you able to open this file in excel for batter view

code Example  
----------------------------------------------------------------------------------------------------------
D:\>for /f "tokens=*" %x in ('reg query HKLM\SYSTEM\CurrentControlSet\Services\W
32Time\Parameters /v NtpServer ^|find /i "REG_SZ"') do echo %hostname%;%x

D:\>echo localhost;NtpServer    REG_SZ  time.windows.com,0x1
MYPC01;NtpServer     REG_SZ  time.windows.com,0x1

D:\>
0
 

Author Comment

by:THe_Revolver
ID: 36710995
I'm not all that familiar with PowerShell but I will tinker around a bit. I also do not have a list of servers. I could make one pretty quickly though. What would the list look like?
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 8

Expert Comment

by:Amitabh Singh
ID: 36711012
the list for my bat looks like fallowing format File name servers.txt
Server1
server2
Server3
0
 
LVL 6

Expert Comment

by:netjgrnaut
ID: 36711017
One server name per line. If all the servers are in the same domain, and DNS is working as expected, just the hostname should do.

SERVER01
SERVER02
SERVER03

If needs be, you can use the FQDN...

SERVER01.mydomain.local
SERVER02.mydomain.local
...
0
 

Author Comment

by:THe_Revolver
ID: 36711020
Makes sense. I will give it a go and report back. Thanks guys!
0
 

Author Closing Comment

by:THe_Revolver
ID: 36713325
This was a perfect explanation and worked flawlessly. For having almost no scripting experience and zero powershell experience, I was able to use this solution quite easily.

Thanks!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
Suggested Courses

604 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