##########################################################################################
# CHECK-TZONE.PS1
#
# Report local time and time zone for list of servers
#
##########################################################################################
$colResults = get-content C:\UTIL\WSUS-GROUPS\WSUS-USA-REMOTE.TXT
$time_zones = @()
clear-host
"SERVER TIME ZONES"
""
"SERVER `tTIME `t TIME ZONE"
"----------------`t--------`t --------------------------------------"
foreach ($result in $colResults) {
$hour = ""
$min = ""
$sec = ""
$comp = ""
$t = ""
$computer = $result
$comp = "{0,-16}" -f $computer
$timezone = Get-WMIObject -class Win32_TimeZone -ComputerName $computer -erroraction SilentlyContinue
$dt = gwmi win32_localtime -computer $computer -erroraction SilentlyContinue
[string] $hour = [System.Convert]::ToString($dt.Hour)
$hour = $hour.padleft(2,"0")
[string] $min = [System.Convert]::ToString($dt.Minute)
$min = $min.padleft(2,"0")
[string] $sec = [System.Convert]::ToString($dt.Second)
$sec = $sec.padleft(2,"0")
$t = $hour + ":" + $min + ":" + $sec
if ($dt) { write-host "$comp`t$t`t" $timezone.Description }
}
6/24/2011
check server time zones
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment