Wednesday, November 25, 2015

Install or uninstall multiple Windows Updates by WUSA and PowerShell

WUSA is a command for Windows to install or uninstall Windows update. In this post, I'd like to use WUSA to work with PowerShell to install or uninstall Windows Update on a computer.

To silently install a Windows update and postpone restart a computer, we can perform (Get-ChildItem <Windows Update Package path>).FullName | %{Start-Process wusa "$_ /quiet /norestart" -wait} on PowerShell console

To silently uninstall a Windows update and postpone restart a computer, we can perform wusa /uninstall /kb:<the number of the KB> /quiet /norestart

Remark: Some Windows Updates are required to restart a computer to take action.

To combine with PowerShell to uninstall some Windows Updates, we can perform (Get-Hotfix).hotfixid.substring(2) | Select -last 3 | %{Start-Process wusa "/uninstall /kb:$_ /quiet /norestart" -wait} on PowerShell console to uninstall last 3 Windows Updates. 

There is an example. Based on the search criteria, we can change it like this Get-Content <File Name> | %{Start-Process wusa "/uninstall /kb:$_ /quiet /norestart" -wait}

This posting is provided “AS IS” with no warranties, and confers no rights!

No comments:

Post a Comment