Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # what: lists missing windows updates, compares to offline repo
- # when: manual/scheduled, especially after patch tuesdays
- # who: ibi c/o doctordeploy.com
- # whose: CC BY-SA 4.0 - provided as-is, use at your own risk. tested only with win 8.1
- # based on https://msdn.microsoft.com/en-us/library/windows/desktop/aa387290(v=vs.85).aspx
- # where: needs wsusscn2.cab in c:\temp as you've already figured out
- # - located at [wsusofflinedir]\client\wsus
- # - downloadable at http://go.microsoft.com/fwlink/?LinkId=76054
- $UpdateSession = New-Object -ComObject "Microsoft.Update.Session"
- $UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
- $UpdateServiceManager = New-Object -ComObject "Microsoft.Update.ServiceManager"
- $UpdateService = $UpdateServiceManager.AddScanPackageService("Offline Sync Service", "c:\temp\wsusscn2.cab")
- write "Searching for Updates. Please wait..."
- $UpdateSearcher.ServerSelection = 3
- $UpdateSearcher.ServiceID = $UpdateService.ServiceID
- $SearchResult = $UpdateSearcher.Search("IsInstalled=0")
- $Updates = $SearchResult.Updates
- write "List of applicable items on the machine when using wsusscn2.cab:"
- $Updates | select title, type, ismandatory, maxdownloadsize, lastdeploymentchangetime | fl
- # use e.g. "$Updates | tee \\server1\logs\mua_$env:computername.log" to redirect output to file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement