Skip to content

Commit

Permalink
Fix #443: Add Erroraction -stop
Browse files Browse the repository at this point in the history
  • Loading branch information
qngngyn committed Nov 13, 2023
1 parent 10b4cdb commit 209d51d
Show file tree
Hide file tree
Showing 29 changed files with 50 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9178,7 +9178,7 @@ $windefrunning = CheckWindefRunning
Task = "(ND, NE) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -9227,7 +9227,7 @@ $windefrunning = CheckWindefRunning
Task = "(ND, NE) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'. "
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6217,7 +6217,7 @@ $windefrunning = CheckWindefRunning
Task = "(ND, NE) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -6266,7 +6266,7 @@ $windefrunning = CheckWindefRunning
Task = "(ND, NE) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'. "
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11587,7 +11587,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -11636,7 +11636,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -1020,7 +1020,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12367,7 +12367,7 @@ $windefrunning = CheckWindefRunning
Task = "Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,7 @@ $RootPath = Split-Path $RootPath -Parent
Task = "The Windows SMB server must be configured to always perform SMB packet signing."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2304,7 +2304,7 @@
Task = "The Windows SMB server must be configured to always perform SMB packet signing."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -2389,7 +2389,7 @@
Task = "The Windows SMB server must perform SMB packet signing when possible."
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5629,7 +5629,7 @@ $hyperVStatus = CheckHyperVStatus
Task = "Set registry value 'requiresecuritysignature' to 1."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -732,7 +732,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -1020,7 +1020,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5614,7 +5614,7 @@ $windefrunning = CheckWindefRunning
Task = "Set registry value 'requiresecuritysignature' to 'Enabled'."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -732,7 +732,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ $RootPath = Split-Path $RootPath -Parent
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -869,7 +869,7 @@ $RootPath = Split-Path $RootPath -Parent
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -1178,7 +1178,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
Task = "The Windows SMB server must perform SMB packet signing when possible."
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -6104,7 +6104,7 @@
Task = "The Windows SMB server must be configured to always perform SMB packet signing."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,7 @@
Task = "The setting Microsoft network server: Digitally sign communications (always) must be configured to Enabled."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -2730,7 +2730,7 @@
Task = "The setting Microsoft network server: Digitally sign communications (if client agrees) must be configured to Enabled."
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ $windefrunning = CheckWindefRunning
Task = "Set registry value 'enablesecuritysignature' to 1."
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -2610,7 +2610,7 @@ $windefrunning = CheckWindefRunning
Task = "Set registry value 'requiresecuritysignature' to 1."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -1197,7 +1197,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2376,7 +2376,7 @@
Task = "The setting Microsoft network server: Digitally sign communications (always) must be configured to Enabled."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -2425,7 +2425,7 @@
Task = "The setting Microsoft network server: Digitally sign communications (if client agrees) must be configured to Enabled."
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2427,7 +2427,7 @@ $windefrunning = CheckWindefRunning
Task = "Set registry value 'enablesecuritysignature' to 1."
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -2754,7 +2754,7 @@ $windefrunning = CheckWindefRunning
Task = "Set registry value 'requiresecuritysignature' to 1."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3898,7 +3898,7 @@ $windefrunning = CheckWindefRunning
Task = "Set registry value 'requiresecuritysignature' to 1."
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (always)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).RequireSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).RequireSecuritySignature -ne $True){
return @{
Message = "RequireSecuritySignature is not set to True"
Status = "False"
Expand Down Expand Up @@ -1196,7 +1196,7 @@ $windefrunning = CheckWindefRunning
Task = "(L1) Ensure 'Microsoft network server: Digitally sign communications (if client agrees)' is set to 'Enabled'"
Test = {
try {
if((Get-SmbServerConfiguration).EnableSecuritySignature -ne $True){
if((Get-SmbServerConfiguration -ErrorAction Stop).EnableSecuritySignature -ne $True){
return @{
Message = "EnableSecuritySignature is not set to True"
Status = "False"
Expand Down
Loading

0 comments on commit 209d51d

Please sign in to comment.