#PSTip Enumerating available time zones

Note: This tip requires PowerShell 2.0 or above.

Some applications or scripts might require the presence of a specific time zone on the system to be able to execute the actions defined by the application. For example, your script might have to adjust to the date/time format used in the script or consider daylight savings to ensure the script or application task scheduling is accurate. This is just one example of a time zone-aware application.

For the time zone-awareness, we need to be able to identify what time zones are available. We can do this using the TimeZoneInfo .NET class.

PS> [TimeZoneInfo]::GetSystemTimeZones() | select Id, DisplayName
Share on: