mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
parent
5ba5261c8b
commit
b2ee1d9315
1 changed files with 3 additions and 2 deletions
|
|
@ -2,7 +2,8 @@ function Get-IcingaWindowsInformation()
|
||||||
{
|
{
|
||||||
param (
|
param (
|
||||||
[string]$ClassName,
|
[string]$ClassName,
|
||||||
$Filter
|
$Filter,
|
||||||
|
[switch]$ForceWMI = $FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
$Arguments = @{
|
$Arguments = @{
|
||||||
|
|
@ -15,7 +16,7 @@ function Get-IcingaWindowsInformation()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Get-Command 'Get-CimInstance' -ErrorAction SilentlyContinue)) {
|
if ($ForceWMI -eq $FALSE -And (Get-Command 'Get-CimInstance' -ErrorAction SilentlyContinue)) {
|
||||||
try {
|
try {
|
||||||
return (Get-CimInstance @Arguments -ErrorAction Stop)
|
return (Get-CimInstance @Arguments -ErrorAction Stop)
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue