#Get WindowsUpdate List for offline patch function Get-WindowsUpdateFileList { param( [Parameter(Mandatory=$True)] [string] $Filter ) <# #Need CreateInstance to kick WindowsUpdate from Remote Computer? $objSession = [Activator]::CreateInstance([Type]::GetTypeFromProgID("Microsoft.Update.Session",$env:ComputerName)) #> $objSession = New-Object -ComObject "Microsoft.Update.Session" $objSearcher = $objSession.CreateUpdateSearcher() $results = $objSearcher.Search($Filter) #Write-Debug $results.Updates.Count $downloadList =@() foreach($update in $results.Updates) { $title = $update.Title $date = $update.LastDeploymentChangeTime $isInstalled = $update.IsInstalled $rebootRequired = $update.RebootRequired foreach($bundledUpdate in $update.BundledUpdates) { foreach($content in $bundledUpdate.DownloadContents) { #if($url.Contains("-express_") -or $url.Contains("-delta_") -or $url.EndsWith(".psf")) if($content.IsDeltaCompressedContent) { #Skip express package(Delta Compressed Package) and .psf file continue } #Append to download list $url = $content.DownloadURL $downloadList += [pscustomobject]@{Title=$title;LastDeploymentChangeTime=$date ;DownloadURL=$url;IsInstalled=$isInstalled;RebootRequired=$rebootRequired} } } } return $downloadList }