File tree Expand file tree Collapse file tree 2 files changed +3
-15
lines changed
lib/core/icingaagent/getters Expand file tree Collapse file tree 2 files changed +3
-15
lines changed Original file line number Diff line number Diff line change @@ -18,18 +18,6 @@ function Get-IcingaAgentInstallation()
18
18
}
19
19
}
20
20
21
- $IcingaService = Get-IcingaWindowsServiceStatus - Service ' icinga2' ;
22
- $ServiceUser = ' NT AUTHORITY\NetworkService' ;
23
-
24
- if ($IcingaService.Present ) {
25
- $ServiceUser = (Get-IcingaWindowsInformation Win32_Service |
26
- ForEach-Object {
27
- if ($_.Name -Like ' icinga2' ) {
28
- return $_ ;
29
- }
30
- } | Select-Object StartName).StartName;
31
- }
32
-
33
21
if ($null -eq $IcingaData ) {
34
22
return @ {
35
23
' Installed' = $FALSE ;
@@ -38,7 +26,7 @@ function Get-IcingaAgentInstallation()
38
26
' Architecture' = $architecture ;
39
27
' Uninstaller' = ' ' ;
40
28
' InstallDate' = ' ' ;
41
- ' User' = $ServiceUser ;
29
+ ' User' = ( Get-IcingaServiceUser ) ;
42
30
};
43
31
}
44
32
@@ -49,6 +37,6 @@ function Get-IcingaAgentInstallation()
49
37
' Architecture' = $architecture ;
50
38
' Uninstaller' = $IcingaData.UninstallString.Replace (" MsiExec.exe " , " " );
51
39
' InstallDate' = $IcingaData.InstallDate ;
52
- ' User' = $ServiceUser ;
40
+ ' User' = ( Get-IcingaServiceUser ) ;
53
41
};
54
42
}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ function Get-IcingaServiceUser()
8
8
if ($Services.Present -eq $FALSE ) {
9
9
$Services = Get-IcingaWindowsServiceStatus - Service ' icingapowershell' ;
10
10
if ($Services.Present -eq $FALSE ) {
11
- return $null ;
11
+ return ' NT Authority\NetworkService ' ;
12
12
}
13
13
}
14
14
You can’t perform that action at this time.
0 commit comments