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()
1818 }
1919 }
2020
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-
3321 if ($null -eq $IcingaData ) {
3422 return @ {
3523 ' Installed' = $FALSE ;
@@ -38,7 +26,7 @@ function Get-IcingaAgentInstallation()
3826 ' Architecture' = $architecture ;
3927 ' Uninstaller' = ' ' ;
4028 ' InstallDate' = ' ' ;
41- ' User' = $ServiceUser ;
29+ ' User' = ( Get-IcingaServiceUser ) ;
4230 };
4331 }
4432
@@ -49,6 +37,6 @@ function Get-IcingaAgentInstallation()
4937 ' Architecture' = $architecture ;
5038 ' Uninstaller' = $IcingaData.UninstallString.Replace (" MsiExec.exe " , " " );
5139 ' InstallDate' = $IcingaData.InstallDate ;
52- ' User' = $ServiceUser ;
40+ ' User' = ( Get-IcingaServiceUser ) ;
5341 };
5442}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ function Get-IcingaServiceUser()
88 if ($Services.Present -eq $FALSE ) {
99 $Services = Get-IcingaWindowsServiceStatus - Service ' icingapowershell' ;
1010 if ($Services.Present -eq $FALSE ) {
11- return $null ;
11+ return ' NT Authority\NetworkService ' ;
1212 }
1313 }
1414
You can’t perform that action at this time.
0 commit comments