I need to check the timezone and time of different servers. I have written this script but not getting the output in a proper format . Can anyone help with the format .
The script is:-
$time = get-wmiobject win32_localtime -computername "localhost"| select Hour, Minute, Second
$timezoneobj= get-wmiobject win32_timezone -computername "localhost"
$timezone= $timezoneobj.Caption
write-output " $server $timezone $time" | Format-table
When i run this script i get output as :- localhost (UTC-08:00) Pacific Time (US & Canada) @{Hour=11; Minute=17; Second= 31} but i want the output as
Servename Timezone
Time
localhost (UTC-08:00) Pacific Time (US & Canada) Hour=11; Minute=17; Second= 31
How do i get whether is AM or PM ?
thanks for the help.