A PowerShell script that will check all of the server times for all servers in the SharePoint 2010 farm. This will enable system administrators to quickly check that all server times in the farm are in sync, for Project Server this is very important to avoid sleeping jobs. The script needs to run on one of the SharePoint servers in the farm using an account that has admin access on all servers in that farm.

This a very simple PowerShell script, please see a code snippet below:

 

PowerShell
Edit|Remove
#Script needs to be run on a SharePoint server 
#Run script with account that has admin access to all servers 
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0 
$servers = (Get-SPServer) | foreach {$_.Address}  
  
foreach($server in $servers) 
{ 
  
    $time = Get-WmiObject Win32_LocalTime -computer $server  -EA 0 
   
    $hour = $time.Hour 
    $minute = $time.Minute 
    $second = $time.Second 
    Write-Host "$server current time is $hour : $minute : $second" 
     
} 
Write-host "If the server times are not in sync please adjust the time settings. Press any key to continue" 
$null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
 

 

For an example output see:

http://pwmather.wordpress.com/2012/04/13/check-server-times-for-sharepoint-projectserver-farms-ps2010-sp2010-msproject-powershell/