0utsidethebox

WUA

May 31st, 2021 (edited)
627
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  $Updates = @()
  2.    $Session = New-Object -ComObject Microsoft.Update.Session
  3.    $UpdateServiceManager = New-Object -ComObject Microsoft.Update.ServiceManager
  4.    $UpdateService = $UpdateServiceManager.AddScanPackageService("Offline Sync Service", "C:\Users\Vadim\Downloads\wsusscn2.cab", 1)
  5.    $Searcher = $Session.CreateUpdateSearcher()
  6.    $Searcher.ServerSelection = 3
  7.    $Searcher.ServiceID = [string]$UpdateService.ServiceID
  8.     $updates = $Searcher.Search("IsInstalled=0  and IsHidden=0")
  9.     foreach ($update in $updates.Updates) {
  10.     Write-Host $update.Title
  11.     }
Add Comment
Please, Sign In to add comment