Public/Dell.DCU/Public/Get-DellSupportedModels.ps1
|
function Get-DellSupportedModels { [CmdletBinding()] $CabPathIndex = "$env:ProgramData\OEMWrapPS\DellCabDownloads\CatalogIndexPC.cab" $DellCabExtractPath = "$env:ProgramData\OEMWrapPS\DellCabDownloads\DellCabExtract" # Pull down Dell XML CAB used in Dell Command Update ,extract and Load if (!(Test-Path $DellCabExtractPath)){$null = New-Item -Path $DellCabExtractPath -ItemType Directory -Force} Write-Verbose "Downloading Dell Cab" Invoke-WebRequest -Uri "https://downloads.dell.com/catalog/CatalogIndexPC.cab" -OutFile $CabPathIndex -UseBasicParsing -Proxy $ProxyServer If(Test-Path "$DellCabExtractPath\DellSDPCatalogPC.xml"){Remove-Item -Path "$DellCabExtractPath\DellSDPCatalogPC.xml" -Force} Start-Sleep -Seconds 1 if (test-path $DellCabExtractPath){Remove-Item -Path $DellCabExtractPath -Force -Recurse} $null = New-Item -Path $DellCabExtractPath -ItemType Directory Write-Verbose "Expanding the Cab File..." $null = expand $CabPathIndex $DellCabExtractPath\CatalogIndexPC.xml Write-Verbose "Loading Dell Catalog XML.... can take awhile" [xml]$XMLIndex = Get-Content "$DellCabExtractPath\CatalogIndexPC.xml" $SupportedModels = $XMLIndex.ManifestIndex.GroupManifest $SupportedModelsObject = @() foreach ($SupportedModel in $SupportedModels){ $SPInventory = New-Object -TypeName PSObject $SPInventory | Add-Member -MemberType NoteProperty -Name "SystemID" -Value "$($SupportedModel.SupportedSystems.Brand.Model.systemID)" -Force $SPInventory | Add-Member -MemberType NoteProperty -Name "Model" -Value "$($SupportedModel.SupportedSystems.Brand.Model.Display.'#cdata-section')" -Force $SPInventory | Add-Member -MemberType NoteProperty -Name "URL" -Value "$($SupportedModel.ManifestInformation.path)" -Force $SPInventory | Add-Member -MemberType NoteProperty -Name "Date" -Value "$($SupportedModel.ManifestInformation.version)" -Force $SupportedModelsObject += $SPInventory } return $SupportedModelsObject } |