PowerShell Scriplet: Determine Time Zone and Current Time for your Servers

Scenario:  When attempting to run the Office 365 Hybrid Configuration wizard, we received an error similar to the following when attempting to validate domain ownership of a brand new email domain:   Failed – Unable to federate your domain. Your system time appears to be more than five minutes out of sync with the time on our federation servers.  Ensure your system time is correct and retry the Hybrid Configuration Wizard.

Scriptlet: This scriptlet below will pull the Exchange servers in and show you the Time Zone and Current Time for each server.

$Servers = get-exchangeserver
$servers | %{
$timeZone=Get-WmiObject -Class win32_timezone -ComputerName $_
$localTime = Get-WmiObject -Class win32_localtime -ComputerName $_
$output =@{‘ComputerName’ = $localTime.__SERVER;
‘Time Zone’ = $timeZone.Caption;
‘Current Time’ = (Get-Date -Day $localTime.Day -Month $localTime.Month);
}
$object = New-Object -TypeName PSObject -Property $output
$Object
}

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: