Skip to content

Commit 96314bf

Browse files
committed
Fixes service exit code fetching
1 parent 9e52d16 commit 96314bf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/core/tools/Get-IcingaServices.psm1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function Get-IcingaServices()
2424

2525
[array]$DependentServices = $null;
2626
[array]$DependingServices = $null;
27+
$ServiceExitCode = 0;
2728
[string]$ServiceUser = '';
2829

2930
if ($Exclude -contains $service.ServiceName) {
@@ -32,7 +33,8 @@ function Get-IcingaServices()
3233

3334
foreach ($wmiService in $ServiceWmiInfo) {
3435
if ($wmiService.Name -eq $service.ServiceName) {
35-
$ServiceUser = $wmiService.StartName;
36+
$ServiceUser = $wmiService.StartName;
37+
$ServiceExitCode = $wmiService.ExitCode;
3638
break;
3739
}
3840
}
@@ -82,7 +84,7 @@ function Get-IcingaServices()
8284
'value' = $service.StartType;
8385
};
8486
'ServiceUser' = $ServiceUser;
85-
'ExitCode' = [int]$service.ExitCode;
87+
'ExitCode' = $ServiceExitCode;
8688
}
8789
}
8890
);

0 commit comments

Comments
 (0)