win_security_policy: allow removing values (resolves #40869) (#41125)

* win_security_policy: allow removing values (resolves #40869)

* Removing warning

* Adding test for remove policy setting

* Fixing string comparison
This commit is contained in:
jamessemai
2018-06-27 01:13:31 +02:00
committed by Jordan Borean
parent 1401fa74cc
commit f2bd6b6bfd
2 changed files with 40 additions and 0 deletions

View File

@@ -194,6 +194,8 @@ if ($will_change -eq $true) {
if ($new_value -cne $value) {
Fail-Json $result "Failed to change the value for key '$key' in section '$section', the value is still $new_value"
}
} elseif ([string]$value -eq "") {
# Value was empty, so OK if no longer in the result
} else {
Fail-Json $result "The key '$key' in section '$section' is not a valid key, cannot set this value"
}