Skip to content

Commit f4e58c2

Browse files
authored
Merge pull request #444 from Icinga:fix/get-icingaservices_returns_unknown_on_wildcard
Fix: Get-IcingaServices returns unknown for StartType on wildcards Fixes `Get\-IcingaServices` which returned `Unknown` for service `StartType`, in case the `-Service` argument contained values with wildcard `*`. Example: ```powershell $result = (Get-IcingaServices -Service 'icinga*'); $result.values.configuration.starttype; $result.values.metadata.DisplayName Name Value ---- ----- value Unknown raw 5 value Unknown raw 5 Icinga PowerShell Service Icinga 2 ``` Fixes #443
2 parents c8e8683 + c96d495 commit f4e58c2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/100-General/10-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
3030
* [#436](https://github.com/Icinga/icinga-powershell-framework/pull/436) Fixes a lookup error for existing plugin documentation files, which caused files not being generated properly in case a similar name was already present on the system
3131
* [#439](https://github.com/Icinga/icinga-powershell-framework/pull/439) Moves PerformanceCounter to private space from previous public, which caused some problems
3232
* [#441](https://github.com/Icinga/icinga-powershell-framework/pull/441) Fixes an exception while loading the Framework, caused by a race condition for missing environment variables which are accessed by some plugins before the Framework is loaded properly
33+
* [#443](https://github.com/Icinga/icinga-powershell-framework/issues/443) Fixes `Get-IcingaServices` which returned `Unknown` for service `StartType`, in case the `-Service` argument contained values with wildcard `*`
3334
* [#446](https://github.com/Icinga/icinga-powershell-framework/pull/446) Fixes Icinga for Windows progress preference, which sometimes caused UI glitches
3435
* [#449](https://github.com/Icinga/icinga-powershell-framework/pull/449) Fixes unhandled exception while importing modules during `Install-IcingaComponent` process, because of possible missing dependencies
3536
* [#451](https://github.com/Icinga/icinga-powershell-framework/pull/451) Fixes PowerShell being unable to enter JEA context if only the Framework is installed and removes the `|` from plugin output, in case a JEA error is thrown that check commands are not present

lib/core/tools/Get-IcingaServices.psm1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ function Get-IcingaServices()
1111
if ($Service.Count -eq 0) {
1212
$ServiceWmiInfo = Get-IcingaWindowsInformation Win32_Service;
1313
} else {
14-
$ServiceWmiInfo = Get-IcingaWindowsInformation Win32_Service | Where-Object { $Service -Contains $_.Name } | Select-Object StartName, Name, ExitCode, StartMode, PathName;
14+
$ServiceWmiInfo = Get-IcingaWindowsInformation Win32_Service |
15+
ForEach-Object {
16+
foreach ($svc in $Service) {
17+
if ($_.Name -Like $svc) {
18+
return $_;
19+
}
20+
}
21+
} | Select-Object StartName, Name, ExitCode, StartMode, PathName;
1522
}
1623

1724
if ($null -eq $ServiceInformation) {

0 commit comments

Comments
 (0)