Skip to content

Commit

Permalink
Update logic of several tests Improve logic checks #360
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen Winternheimer committed Aug 25, 2023
1 parent 04ce0f9 commit eaa4d61
Show file tree
Hide file tree
Showing 32 changed files with 106 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
}
$setPolicy = [long]$setPolicy

if (($setPolicy -lt 24)) {
if (($setPolicy -gt 24 -or $setPolicy -lt 0)) {
return @{
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x >= 24"
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x <= 24 and x >= 0"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8788,13 +8788,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" `
-Name "MaxDevicePasswordFailedAttempts" `
| Select-Object -ExpandProperty "MaxDevicePasswordFailedAttempts"

if (($regValue -gt 10 -or $regValue -le 0)) {
if (($regValue -gt 10 -or $regValue -le 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 0"
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 3"
Status = "False"
}
}
Expand Down Expand Up @@ -10138,13 +10138,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Cryptography" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography" `
-Name "ForceKeyProtection" `
| Select-Object -ExpandProperty "ForceKeyProtection"

if (($regValue -lt 1)) {
if (($regValue -ne 1) -and ($regValue -ne 2)) {
return @{
Message = "Registry value is '$regValue'. Expected: x >= 1"
Message = "Registry value is '$regValue'. Expected: 1 or 2"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
}
$setPolicy = [long]$setPolicy

if (($setPolicy -lt 24)) {
if (($setPolicy -gt 24 -or $setPolicy -lt 0)) {
return @{
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x >= 24"
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x <= 24 and x >= 0"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6538,13 +6538,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" `
-Name "MaxDevicePasswordFailedAttempts" `
| Select-Object -ExpandProperty "MaxDevicePasswordFailedAttempts"

if (($regValue -gt 10 -or $regValue -le 0)) {
if (($regValue -gt 10 -or $regValue -le 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 0"
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 3"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
}
$setPolicy = [long]$setPolicy

if (($setPolicy -lt 24)) {
if (($setPolicy -gt 24 -or $setPolicy -lt 0)) {
return @{
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x >= 24"
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x <= 24 and x >= 0"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1181,9 +1181,9 @@ $windefrunning = CheckWindefRunning
-Name "RequirePlatformSecurityFeatures" `
| Select-Object -ExpandProperty "RequirePlatformSecurityFeatures"

if ($regValue -ne 3) {
if (($regValue -ne 1) -and ($regValue -ne 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: 3"
Message = "Registry value is '$regValue'. Expected: 1 or 3"
Status = "False"
}
}
Expand Down Expand Up @@ -1859,13 +1859,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" `
-Name "ConsentPromptBehaviorAdmin" `
| Select-Object -ExpandProperty "ConsentPromptBehaviorAdmin"
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography" `
-Name "ForceKeyProtection" `
| Select-Object -ExpandProperty "ForceKeyProtection"

if (($regValue -ne 2)) {
if (($regValue -ne 1) -and ($regValue -ne 2)) {
return @{
Message = "Registry value is '$regValue'. Expected: x == 2"
Message = "Registry value is '$regValue'. Expected: 1 or 2"
Status = "False"
}
}
Expand Down Expand Up @@ -7259,13 +7259,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" `
-Name "MaxDevicePasswordFailedAttempts" `
| Select-Object -ExpandProperty "MaxDevicePasswordFailedAttempts"

if (($regValue -gt 10 -or $regValue -le 0)) {
if (($regValue -gt 10 -or $regValue -le 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 0"
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 3"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@
}
$setPolicy = [long]$setPolicy

if (($setPolicy -lt 24)) {
if (($setPolicy -gt 24 -or $setPolicy -lt 0)) {
return @{
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x >= 24"
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x <= 24 and x >= 0"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
}
$setPolicy = [long]$setPolicy

if (($setPolicy -lt 24)) {
if (($setPolicy -gt 24 -or $setPolicy -lt 0)) {
return @{
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x >= 24"
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x <= 24 and x >= 0"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" `
-Name "MaxDevicePasswordFailedAttempts" `
| Select-Object -ExpandProperty "MaxDevicePasswordFailedAttempts"

if (($regValue -gt 10 -or $regValue -le 0)) {
if (($regValue -gt 10 -or $regValue -le 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 0"
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 3"
Status = "False"
}
}
Expand Down Expand Up @@ -1864,13 +1864,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Cryptography" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography" `
-Name "ForceKeyProtection" `
| Select-Object -ExpandProperty "ForceKeyProtection"

if (($regValue -lt 1)) {
if (($regValue -ne 1) -and ($regValue -ne 2)) {
return @{
Message = "Registry value is '$regValue'. Expected: x >= 1"
Message = "Registry value is '$regValue'. Expected: 1 or 2"
Status = "False"
}
}
Expand Down Expand Up @@ -6512,9 +6512,9 @@ $windefrunning = CheckWindefRunning
-Name "RequirePlatformSecurityFeatures" `
| Select-Object -ExpandProperty "RequirePlatformSecurityFeatures"

if ($regValue -ne 3) {
if (($regValue -ne 1) -and ($regValue -ne 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: 3"
Message = "Registry value is '$regValue'. Expected: 1 or 3"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1217,9 +1217,9 @@ $windefrunning = CheckWindefRunning
-Name "RequirePlatformSecurityFeatures" `
| Select-Object -ExpandProperty "RequirePlatformSecurityFeatures"

if ($regValue -ne 3) {
if (($regValue -ne 1) -and ($regValue -ne 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: 3"
Message = "Registry value is '$regValue'. Expected: 1 or 3"
Status = "False"
}
}
Expand Down Expand Up @@ -11505,13 +11505,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" `
-Name "MaxDevicePasswordFailedAttempts" `
| Select-Object -ExpandProperty "MaxDevicePasswordFailedAttempts"

if (($regValue -gt 10 -or $regValue -le 0)) {
if (($regValue -gt 10 -or $regValue -le 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 0"
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 3"
Status = "False"
}
}
Expand Down Expand Up @@ -12405,13 +12405,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Cryptography" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography" `
-Name "ForceKeyProtection" `
| Select-Object -ExpandProperty "ForceKeyProtection"

if (($regValue -lt 1)) {
if (($regValue -ne 1) -and ($regValue -ne 2)) {
return @{
Message = "Registry value is '$regValue'. Expected: x >= 1"
Message = "Registry value is '$regValue'. Expected: 1 or 2"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@
}
$setPolicy = [long]$setPolicy

if (($setPolicy -lt 24)) {
if (($setPolicy -gt 24 -or $setPolicy -lt 0)) {
return @{
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x >= 24"
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x <= 24 and x >= 0"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@
}
$setPolicy = [long]$setPolicy

if (($setPolicy -lt 24)) {
if (($setPolicy -gt 24 -or $setPolicy -lt 0)) {
return @{
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x >= 24"
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x <= 24 and x >= 0"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
}
$setPolicy = [long]$setPolicy

if (($setPolicy -lt 24)) {
if (($setPolicy -gt 24 -or $setPolicy -lt 0)) {
return @{
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x >= 24"
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x <= 24 and x >= 0"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" `
-Name "MaxDevicePasswordFailedAttempts" `
| Select-Object -ExpandProperty "MaxDevicePasswordFailedAttempts"

if (($regValue -gt 10 -or $regValue -le 0)) {
if (($regValue -gt 10 -or $regValue -le 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 0"
Message = "Registry value is '$regValue'. Expected: x <= 10 and x > 3"
Status = "False"
}
}
Expand Down Expand Up @@ -1576,13 +1576,13 @@ $windefrunning = CheckWindefRunning
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Cryptography" `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography" `
-Name "ForceKeyProtection" `
| Select-Object -ExpandProperty "ForceKeyProtection"

if (($regValue -lt 1)) {
if (($regValue -ne 1) -and ($regValue -ne 2)) {
return @{
Message = "Registry value is '$regValue'. Expected: x >= 1"
Message = "Registry value is '$regValue'. Expected: 1 or 2"
Status = "False"
}
}
Expand Down Expand Up @@ -1724,9 +1724,9 @@ $windefrunning = CheckWindefRunning
-Name "ConsentPromptBehaviorAdmin" `
| Select-Object -ExpandProperty "ConsentPromptBehaviorAdmin"

if (($regValue -ne 2)) {
if ($regValue -ne 2) {
return @{
Message = "Registry value is '$regValue'. Expected: x == 2"
Message = "Registry value is '$regValue'. Expected: 2"
Status = "False"
}
}
Expand Down Expand Up @@ -5832,9 +5832,9 @@ $windefrunning = CheckWindefRunning
-Name "RequirePlatformSecurityFeatures" `
| Select-Object -ExpandProperty "RequirePlatformSecurityFeatures"

if ($regValue -ne 3) {
if (($regValue -ne 1) -and ($regValue -ne 3)) {
return @{
Message = "Registry value is '$regValue'. Expected: 3"
Message = "Registry value is '$regValue'. Expected: 1 or 3"
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
}
$setPolicy = [long]$setPolicy

if (($setPolicy -lt 24)) {
if (($setPolicy -gt 24 -or $setPolicy -lt 0)) {
return @{
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x >= 24"
Message = "'PasswordHistorySize' currently set to: $setPolicy. Expected: x <= 24 and x >= 0"
Status = "False"
}
}
Expand Down
Loading

0 comments on commit eaa4d61

Please sign in to comment.