From 8bb65c9c2f627b766078e4465adb97c2002d5aae Mon Sep 17 00:00:00 2001 From: Mark Unwin Date: Mon, 13 May 2024 08:10:35 +1000 Subject: [PATCH] Silence null error in audit_windows.ps1. --- other/audit_windows.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/other/audit_windows.ps1 b/other/audit_windows.ps1 index 4b5fac015..29d5433cd 100755 --- a/other/audit_windows.ps1 +++ b/other/audit_windows.ps1 @@ -1800,7 +1800,7 @@ $result.server = @() $result.server_item = @() $item = @{} $test = Get-Service -name "W3SVC" -ErrorAction Ignore -if ($test.Status.ToString() -eq "Running") { +if ($test.Status -ne $null -and $test.Status.ToString() -eq "Running") { $itimer = [Diagnostics.Stopwatch]::StartNew() # Get IIS details Clear-Variable -name item @@ -1852,7 +1852,7 @@ if ($test.Status.ToString() -eq "Running") { } $test = Get-Service -name "MSSQLSERVER" -ErrorAction Ignore -if ($test.Status.ToString() -eq "Running") { +if ($test.Status -ne $null -and $test.Status.ToString() -eq "Running") { $itimer = [Diagnostics.Stopwatch]::StartNew() # Get MSSQL details Clear-Variable -name item