Menu & Search
Get-TimeZone in PowerShell

Get-TimeZone in PowerShell

The Get-TimeZone command in PowerShell returns the current Time Zone of a computer, or it can be used to list all available Time Zones which will be useful if you’re planning on making changes to this.

In this post I’m showing 2 quick examples of use:

# Get the Time Zone of a Local Computer in PowerShell
# Script to Output Available Time Zones to a Local CSV File


Get the Time Zone of a Local Computer in PowerShell

Get-TimeZone

Script to Output Available Time Zones to a Local CSV File

# output available timezones to a local directory
$path = "c:\temp\"
$output_file_name = "timezones_available.csv"
$full_output_path = $path + $output_file_name

If(!(test-path $path))
{
    New-Item -ItemType Directory -Force -Path $path
}
Get-TimeZone -ListAvailable | Export-Csv -Path $full_output_path -NoTypeInformation -Force

I saved this script to my c:\temp and ran:

And here’s the CSV…

Share

0 Comments