From cde4f2b6899094bed8eeca431c9c7c2b13d8c01b Mon Sep 17 00:00:00 2001 From: qgarnier Date: Wed, 8 Sep 2021 11:20:17 +0200 Subject: [PATCH] fix(sccm): site-status - use default provider (#3084) --- centreon/common/powershell/sccm/sitestatus.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/centreon/common/powershell/sccm/sitestatus.pm b/centreon/common/powershell/sccm/sitestatus.pm index c4e6e98e1..a942188b1 100644 --- a/centreon/common/powershell/sccm/sitestatus.pm +++ b/centreon/common/powershell/sccm/sitestatus.pm @@ -49,6 +49,13 @@ Try { $returnArray = @() $providers = Get-PSProvider | Where {$_.Name -match "CMSite" } + if ($null -eq $providers -or $providers.Count -eq 0) { + $providers = New-Object System.Collections.Generic.List[Hashtable]; + $item = @{} + $item.Name = "AdminUI.PS.Provider\CMSite" + $items.Add($item) + } + foreach ($provider in $providers) { New-PSDrive -Name SCCMDrive -PSProvider $provider.Name -Root $env:COMPUTERNAME -Description "SCCM Site" | Out-Null CD "SCCMDrive:\" @@ -68,7 +75,7 @@ Try { $returnArray += $returnObject } } - + $returnArray | ConvertTo-JSON-20 -forceArray $true } Catch { Write-Host $Error[0].Exception