Update check-time-zone.ps1 and list-timezone.ps1

This commit is contained in:
Markus Fleschutz 2022-10-15 10:42:44 +02:00
parent 742c44d8aa
commit e29b6db89a
2 changed files with 9 additions and 6 deletions

View File

@ -12,9 +12,11 @@
#>
try {
$TimeZone = (Get-Timezone)
"✅ Time zone is $($TimeZone.DisplayName)."
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
$Time = $((Get-Date).ToShortTimeString())
$TZ = (Get-Timezone)
if ($TZ.SupportsDaylightSavingTime) { $DST="+01DST" } else { $DST="" }
"$Time $($TZ.Id) (UTC+$($TZ.BaseUtcOffset) $DST)."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,6 +1,6 @@
<#
.SYNOPSIS
Lists the details of the current time zone
Lists time zone details
.DESCRIPTION
This PowerShell script lists the details of the current time zone.
.EXAMPLE
@ -19,7 +19,8 @@
#>
try {
get-timezone
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
Get-Timezone
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"