mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
Update GetWindowsService.ps1 (#751)
* Update GetWindowsService.ps1 Instead of repeatedly accessing $SvcData."$ServiceName", store the object in a local variable for better readability. * Update GetWindowsService.ps1 Fixes code styling --------- Co-authored-by: Lord Hepipud <contact@lordhepipud.de>
This commit is contained in:
parent
af1e5b7293
commit
9907cc8e8e
1 changed files with 7 additions and 5 deletions
|
|
@ -19,11 +19,13 @@ try {
|
|||
$SvcData = Get-IcingaServices "$ServiceName" -ErrorAction Stop;
|
||||
|
||||
if ($null -ne $SvcData) {
|
||||
$ServiceData.Status = [string]$SvcData."$ServiceName".configuration.Status.value;
|
||||
$ServiceData.User = [string]$SvcData."$ServiceName".configuration.ServiceUser;
|
||||
$ServiceData.ServicePath = [string]$SvcData."$ServiceName".configuration.ServicePath;
|
||||
$ServiceData.Name = $SvcData."$ServiceName".metadata.ServiceName;
|
||||
$ServiceData.DisplayName = $SvcData."$ServiceName".metadata.DisplayName;
|
||||
$ServiceConfig = $SvcData."$ServiceName".configuration;
|
||||
$ServiceMeta = $SvcData."$ServiceName".metadata;
|
||||
$ServiceInfo.Status = [string]$ServiceConfig.Status.value;
|
||||
$ServiceInfo.User = [string]$ServiceConfig.ServiceUser;
|
||||
$ServiceInfo.ServicePath = [string]$ServiceConfig.ServicePath;
|
||||
$ServiceInfo.Name = $ServiceMeta.ServiceName;
|
||||
$ServiceInfo.DisplayName = $ServiceMeta.DisplayName;
|
||||
$ServiceData.Present = $TRUE;
|
||||
}
|
||||
} catch {
|
||||
|
|
|
|||
Loading…
Reference in a new issue