From 7bd8dccff862d79cc8551ce347f0afaaf9bae695 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Tue, 4 May 2021 14:59:28 +0200 Subject: [PATCH] Fixes missing attributes for services --- doc/31-Changelog.md | 2 ++ lib/core/tools/Get-IcingaServices.psm1 | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index 2af753d..f842519 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -19,6 +19,8 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic ### Bugfixes +* [#240](https://github.com/Icinga/icinga-powershell-framework/pull/240) While filtering for certain services with `Get-IcingaServices`, there were some attributes missing from the collection. These are now added resulting in always correct output data. + ## 1.4.1 (2021-03-10) [Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/14?closed=1) diff --git a/lib/core/tools/Get-IcingaServices.psm1 b/lib/core/tools/Get-IcingaServices.psm1 index 266964b..710d4c4 100644 --- a/lib/core/tools/Get-IcingaServices.psm1 +++ b/lib/core/tools/Get-IcingaServices.psm1 @@ -11,14 +11,14 @@ function Get-IcingaServices() if ($Service.Count -eq 0) { $ServiceWmiInfo = Get-IcingaWindowsInformation Win32_Service; } else { - $ServiceWmiInfo = Get-IcingaWindowsInformation Win32_Service | Where-Object { $Service -Contains $_.Name } | Select-Object StartName, Name; + $ServiceWmiInfo = Get-IcingaWindowsInformation Win32_Service | Where-Object { $Service -Contains $_.Name } | Select-Object StartName, Name, ExitCode, StartMode; } if ($null -eq $ServiceInformation) { return $null; } - [hashtable]$ServiceData = @{}; + [hashtable]$ServiceData = @{ }; foreach ($service in $ServiceInformation) {