mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Adds service exclude and service exit code data fetching
This commit is contained in:
parent
90a8fab9cb
commit
9e52d16a3d
1 changed files with 7 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue