Retrieve registry value properly

This commit is contained in:
Manuel Thalmann 2024-08-10 19:26:53 +02:00
parent f5d971922a
commit b48821eeff

View file

@ -454,7 +454,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 };