diff --git a/Intune_Remediation_Timezone/detection.ps1 b/Intune_Remediation_Timezone/detection.ps1 index d8a347d..0f9a2b0 100644 --- a/Intune_Remediation_Timezone/detection.ps1 +++ b/Intune_Remediation_Timezone/detection.ps1 @@ -1,17 +1,8 @@ -try { - if (-not (Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location")) { - return $false - exit 1 - } - if ((Get-ItemPropertyValue -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location' -Name 'Value' -ea SilentlyContinue) -eq 'Allow') { - return $true +if (Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location") { + $value = Get-ItemPropertyValue -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location' -Name 'Value' -ErrorAction SilentlyContinue + if ($value -eq 'Allow') { exit 0 - } else { - return $false - exit 1 } -} -catch { - return $false - exit 1 -} \ No newline at end of file +} + +exit 1 \ No newline at end of file