# Detect-TimeZone-CET-24H.ps1 # Exit 0 = compliant, Exit 1 = not compliant # 1) Timezone compliance: CET/CEST offset (works for SE/NO/DK/RS) $tzOk = $false try { $offset = [TimeZoneInfo]::Local.GetUtcOffset((Get-Date)).TotalHours # CET/CEST is +1 winter, +2 summer if ($offset -in 1, 2) { $tzOk = $true } } catch { $tzOk = $false } # 2) 24-hour clock defaults (.DEFAULT hive) $intlPath = "Registry::HKEY_USERS\.DEFAULT\Control Panel\International" $timeOk = $false try { $p = Get-ItemProperty -Path $intlPath -ErrorAction Stop $short = [string]$p.sShortTime $iTime = [string]$p.iTime if ($short -eq "HH:mm" -and $iTime -eq "1") { $timeOk = $true } } catch { $timeOk = $false } Write-Output "TZ offset hours: $offset (OK=$tzOk)" Write-Output "HKU\.DEFAULT sShortTime: $short, iTime: $iTime (OK=$timeOk)" if ($tzOk -and $timeOk) { exit 0 } else { exit 1 }