fix(sccm): site-status - use default provider (#3084)

This commit is contained in:
qgarnier 2021-09-08 11:20:17 +02:00 committed by GitHub
parent 39690f35b3
commit cde4f2b689
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -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