mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-30 15:08:49 +02:00
Update check-time-zone.ps1 and list-timezone.ps1
This commit is contained in:
parent
742c44d8aa
commit
e29b6db89a
@ -12,9 +12,11 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$TimeZone = (Get-Timezone)
|
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
|
||||||
|
$Time = $((Get-Date).ToShortTimeString())
|
||||||
"✅ Time zone is $($TimeZone.DisplayName)."
|
$TZ = (Get-Timezone)
|
||||||
|
if ($TZ.SupportsDaylightSavingTime) { $DST="+01DST" } else { $DST="" }
|
||||||
|
"✅ $Time $($TZ.Id) (UTC+$($TZ.BaseUtcOffset) $DST)."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Lists the details of the current time zone
|
Lists time zone details
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script lists the details of the current time zone.
|
This PowerShell script lists the details of the current time zone.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
@ -19,9 +19,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
get-timezone
|
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
|
||||||
|
Get-Timezone
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user