diff --git a/lib/core/tools/Get-IcingaServices.psm1 b/lib/core/tools/Get-IcingaServices.psm1 index a6e5a0f..4523f9e 100644 --- a/lib/core/tools/Get-IcingaServices.psm1 +++ b/lib/core/tools/Get-IcingaServices.psm1 @@ -1,7 +1,8 @@ function Get-IcingaServices() { param ( - [array]$Service + [array]$Service, + [array]$Exclude = @() ); $ServiceInformation = Get-Service -Name $Service -ErrorAction SilentlyContinue; @@ -25,6 +26,10 @@ function Get-IcingaServices() [array]$DependingServices = $null; [string]$ServiceUser = ''; + if ($Exclude -contains $service.ServiceName) { + continue; + } + foreach ($wmiService in $ServiceWmiInfo) { if ($wmiService.Name -eq $service.ServiceName) { $ServiceUser = $wmiService.StartName; @@ -77,6 +82,7 @@ function Get-IcingaServices() 'value' = $service.StartType; }; 'ServiceUser' = $ServiceUser; + 'ExitCode' = [int]$service.ExitCode; } } );