Solved

Create SNTP Report for AD Domain?

Posted on 2011-09-27
7
403 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 6

Accepted Solution

by:
netjgrnaut earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Want to promote your upcoming event?

Attending an event? Speaking at a conference? Or exhibiting at a tradeshow? Easily inform your contacts by using a promotional banner in your email signature. This will ensure your organization’s most important contacts are in the know.

 
LVL 8

Expert Comment

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

Expert Comment

by:netjgrnaut
Comment Utility
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
Comment Utility
Makes sense. I will give it a go and report back. Thanks guys!
0
 

Author Closing Comment

by:THe_Revolver
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

743 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

17 Experts available now in Live!

Get 1:1 Help Now