From 00be1105547816852ddaf434c3b7d32a4b02641f Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Wed, 5 Aug 2020 19:48:18 +0200 Subject: [PATCH] Adds `Namespace` argument for Get-IcingaWindowsInformation for additional filtering Fixes #94 --- doc/31-Changelog.md | 1 + lib/core/framework/Get-IcingaWindowsInformation.psm1 | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index 3f26dc8..bb71316 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -21,6 +21,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic * [#76](https://github.com/Icinga/icinga-powershell-framework/issues/76) Adds support to test for required .NET Framework Version 4.6.0 or above before trying to install the Icinga Agent * [#87](https://github.com/Icinga/icinga-powershell-framework/issues/87) Adds wrapper command to test new code or functionality of Framework and/or plugins * [#88](https://github.com/Icinga/icinga-powershell-framework/issues/88) Adds Start/Stop timer functionality for performance analysis +* [#94](https://github.com/Icinga/icinga-powershell-framework/issues/94) Adds `Namespace` argument for Get-IcingaWindowsInformation for additional filtering ### Bugfixes diff --git a/lib/core/framework/Get-IcingaWindowsInformation.psm1 b/lib/core/framework/Get-IcingaWindowsInformation.psm1 index 97c10e8..e223cbb 100644 --- a/lib/core/framework/Get-IcingaWindowsInformation.psm1 +++ b/lib/core/framework/Get-IcingaWindowsInformation.psm1 @@ -3,6 +3,7 @@ function Get-IcingaWindowsInformation() param ( [string]$ClassName, $Filter, + $Namespace, [switch]$ForceWMI = $FALSE ); @@ -15,6 +16,11 @@ function Get-IcingaWindowsInformation() 'Filter', $Filter ); } + if ([string]::IsNullOrEmpty($Namespace) -eq $FALSE) { + $Arguments.Add( + 'Namespace', $Namespace + ); + } if ($ForceWMI -eq $FALSE -And (Get-Command 'Get-CimInstance' -ErrorAction SilentlyContinue)) { try {