Hey PowerShell Guy!, How Can I Retrieve Time Zone Information for a Computer?
As you can see in former posts also I picked up my Hey PowerShell guy series again, I did stop when the ScriptCenter started to provide PowerShell examples also see : Hey, PowerShell Guy ! How Can I .. Sorry forget about it I allready Know .
But this stopped after a short time, I talked about this with the Scripting Guys at the IT Forum, June Blender from the PowerShell team did do the translations , but she is very busy doing great work on the PowerShell documentation and she did this all on personal account.
Hence I picked up again and while the Scripting Guy's are on holiday , and I have also some free time to spare again I will work a bit trough the archives : Hey, Scripting Guy! Archive by Date
In this post I will provide a translation for :
How Can I Retrieve Time Zone Information for a Computer?
I prototyped this as a oneLiner :
if ((gwmi -q 'Select * From Win32_ComputerSystem').DaylightInEffect){gwmi -q 'Select * From Win32_TimeZone' | fl DaylightName}else{gwmi -q 'Select * From Win32_TimeZone' | fl StandardName}
A bit more "ScriptLike" :
if ((get-WmiObject -Query 'Select * From Win32_ComputerSystem').DaylightInEffect){
get-WmiObject -Query 'Select * From Win32_TimeZone' | Format-List DaylightName
}else{
get-WmiObject -Query 'Select * From Win32_TimeZone' | Format-List StandardName
}
As this does not very much differ from the Vbscript version, looking at both versions side by side gives a good impression of the syntax differences
Enjoy,
Greetings /\/\o\/\/
PS Sorry June, you working hard for my CTP Doc's and I stealing the making fun of VbScript here in the meanwhile, .. but thanks !