Update detection without trycatch
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
exit 1
|
||||
Reference in New Issue
Block a user