?
Solved

Create SNTP Report for AD Domain?

Posted on 2011-09-27
7
Medium Priority
?
422 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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

752 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