Skip to content

Commit

Permalink
[MZ] [1/14/2019] Added filtering criteria to include only "Published"…
Browse files Browse the repository at this point in the history
… downloads as the CAB file included "Expired" references for a small number of models, thus returning n>1 $Targets.
  • Loading branch information
zaskem committed Jan 15, 2019
1 parent bc9c267 commit f71554a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ParseDellCab.ps1
Expand Up @@ -36,10 +36,10 @@ $Downloads = $xml.SystemsManagementCatalog.SoftwareDistributionPackage
$Model = (Get-WmiObject win32_computersystem).Model
If(!($Model.EndsWith("AIO")) -or !($Model.EndsWith("M"))){
$Target = $Downloads | Where-Object -FilterScript {
$PSitem.LocalizedProperties.Title -match $model -and $PSitem.LocalizedProperties.Title -notmatch $model + " AIO" -and $PSitem.LocalizedProperties.Title -notmatch $model + "M"
$PSitem.LocalizedProperties.Title -match $model -and $PSitem.LocalizedProperties.Title -notmatch $model + " AIO" -and $PSitem.LocalizedProperties.Title -notmatch $model + "M" -and $PSitem.Properties.PublicationState -match "Published"
}
}
Else{$Target = $Downloads | Where-Object -FilterScript {$PSitem.LocalizedProperties.Title -match $model}}
Else{$Target = $Downloads | Where-Object -FilterScript {$PSitem.LocalizedProperties.Title -match $model -and $PSitem.Properties.PublicationState -match "Published"}}
$TargetLink = $Target.InstallableItem.OriginFile.OriginUri
$TargetFileName = $Target.InstallableItem.OriginFile.FileName
Invoke-WebRequest -Uri $TargetLink -OutFile $PSScriptRoot\$TargetFileName -UseBasicParsing -Verbose
Expand Down

0 comments on commit f71554a

Please sign in to comment.