Check the time on multiple servers

After the recent change in our clocks due to BST I noticed that one of our servers was a hour slow. I wanted to check the rest since we run a lot of time dependant processes. Now we have Powershell any thought of manually checking each one is madness. Here’s a quick script I knocked up to check the time on multiple servers. Just create a text file called servers.txt with each server name on a new line. Place this onto your desktop and you’re ready to go.

Since my standard Windows Domain account didn’t have access to these servers I’ve used the Get-Credential cmdlet. When you execute the script you will see the below window asking for authentication details.

I know this is an old thread, but I like the idea of the text file with a list of specified servers as not all of the servers may need to be checked. We check 5 servers using a command line batch file on XP, but NTP in Windows 7 doesn’t work the same in batch files. Shocking as it may seem, PowerShell seems to be the alternative. The example above might come in handy for us.