mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
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
This commit is contained in:
commit
f4e58c2005
2 changed files with 9 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
* [#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
|
||||
* [#439](https://github.com/Icinga/icinga-powershell-framework/pull/439) Moves PerformanceCounter to private space from previous public, which caused some problems
|
||||
* [#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
|
||||
* [#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 `*`
|
||||
* [#446](https://github.com/Icinga/icinga-powershell-framework/pull/446) Fixes Icinga for Windows progress preference, which sometimes caused UI glitches
|
||||
* [#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
|
||||
* [#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
|
||||
|
|
|
|||
|
|
@ -11,7 +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, ExitCode, StartMode, PathName;
|
||||
$ServiceWmiInfo = Get-IcingaWindowsInformation Win32_Service |
|
||||
ForEach-Object {
|
||||
foreach ($svc in $Service) {
|
||||
if ($_.Name -Like $svc) {
|
||||
return $_;
|
||||
}
|
||||
}
|
||||
} | Select-Object StartName, Name, ExitCode, StartMode, PathName;
|
||||
}
|
||||
|
||||
if ($null -eq $ServiceInformation) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue