Retrieve registry value properly

This commit is contained in:
Manuel Thalmann 2024-08-10 19:26:53 +02:00
parent 0f048cbb9e
commit 49a133e76a

View file

@ -451,7 +451,7 @@ $null = New-Module {
$timeZoneOption = "Start";
$timeZoneKey = "HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate";
$service = Get-Service W32Time;
$autoUpdate = Get-ItemProperty $timeZoneKey -Name $timeZoneOption;
$autoUpdate = (Get-Item $timeZoneKey).GetValue($timeZoneOption);
$stopped = ($service.Status -eq "Stopped");
$setUpdate = { param([int] $Value) Set-ItemProperty $timeZoneKey -Name $timeZoneOption $Value };