Use PowerShell to install Windows Updates

PowerShell for Windows updates? Why would you want to do this other than the fact that it’s a cool thing to do? Well it’s fairly easy to do and can be easilly automated.

Firstly you will need version 5 of PowerShell which is apart of Windows 10. Since version 5 you can now download and install modules online from the PowerShell Gallery.

First thing you need to do is confirm the version of PowerShell you have:

$PSVersionTable.PSVersion

If version 5 or above, confirm you are running PowerShell as administrator and continue with:

Install-Module PSWindowsUpdate
Get-Command –module PSWindowsUpdate

Then you will need to register to use the Microsoft Update Service not just the default Windows Update Service.

Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d

Then run:

Get-WUInstall –MicrosoftUpdate –AcceptAll –AutoReboot

More info here: https://www.petri.com/manage-windows-updates-with-powershell-module

PowerShell

2 Comments Leave a comment

  1. I realize this was posted 10 months ago (and thank you for the article) but, has anyone managed to set this is as a scheduled task for automating windows updates? I can run it manually without issue but there seems to be some issue in calling on it to run without a logged on user through task scheduler. Any input would be greatly appreciated.

    Thanks!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: