Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created June 28, 2016 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guitarrapc/055acdd7a3a5d9c85a9bead504b43747 to your computer and use it in GitHub Desktop.
Save guitarrapc/055acdd7a3a5d9c85a9bead504b43747 to your computer and use it in GitHub Desktop.
function Get-TimeZone
{
[CmdletBinding()]
param()
Write-Verbose -Message ($LocalizedData.GettingTimezoneCimMessage)
$TimeZone = (Get-CimInstance `
-ClassName WIN32_Timezone `
-Namespace root\cimv2).StandardName
Write-Verbose -Message ($LocalizedData.CurrentTimezoneMessage `
-f $Timezone)
return $TimeZone
}
function Get-TimeZoneId
{
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[System.String]
$TimeZone
)
# Convert TimeZone Standard Name to TimeZone Id
$timeZoneInfo = [System.TimeZoneInfo]::GetSystemTimeZones() |
Where-Object StandardName -eq $TimeZone
return $timeZoneInfo.Id
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment