Install Microsoft Updates using PowerShell

Install software updates PowerShell script

The attached script installs or uninstalls Microsoft Updates in the last ‘N’ days. I’ve used PSAppDeployToolkit to accomplish the task. The script uses whatever update source is made available to the machine to download and install the updates.

This can be deployed using SCCM if Software Update Point is turned off or if you prefer a Package deployment method of distributing software updates.

Logging is done to: C:\Windows\Logs\Software

Install MS Updates:

The below command will SILENTLY install all the updates released (Approved: if using WSUS) in the last 10 days from WSUS (if configured, or uses Microsoft Windows Update site).

 

The below command will INTERACTIVELY install all the updates released (Approved: if using WSUS) in the last 10 days from WSUS (if configured, or uses Microsoft Windows Update site).

 

Uninstall MS Updates:

The below command will SILENTLY Uninstall all the updates installed in the last 10 days.

 

 The below command will INTERACTIVELY Uninstall all the updates installed in the last 10 days.

Full script :

See attachment at the top.

 

The PSAppDeployToolkit does extensive logging. Every single action is logged, which helps with the troubleshooting process.

Download Now

 

Related Articles

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x