So you want to run Windows Update with PowerShell? Heck yes you do! And once you do, it’s only one more step to make it a Run Script!
Script on GitHub: Run-WindowsUpdates.ps1
Related: How To Create List of Variables in Run Scripts
So here is just running the PowerShell. Default provides list of available updates:
![](https://garytown.com/wp-content/uploads/2022/08/image-9.png)
Adding some Parameters allows you to Install & Reboot if you want
![](https://garytown.com/wp-content/uploads/2022/08/image-10.png)
Adding to a Run Script might not be the best idea in the world, but sometimes you make due with the tools you have [Access to].
![](https://garytown.com/wp-content/uploads/2022/08/image-11.png)
Running the Defaults (as shown above), you can see several updates that are available, the return is pretty quick. Now when I re-run with Updates Enabled, it will take quite a bit longer to download and install. I’ll also trigger the CM Restart
![](https://garytown.com/wp-content/uploads/2022/08/image-13.png)
So after I triggered the Script, it took a VERY long time. 20+ minutes. You can see from the results below that it downloaded the 4 updates and then applied them. They required a reboot, so it ran the CM Restart Function since I set that to True. If I had left it false, it would have just installed the updates without triggering any reboot.
![](https://garytown.com/wp-content/uploads/2022/08/image-14.png)
On my endpoint, It did get the Reboot Notification, and it is in the Tray
![](https://garytown.com/wp-content/uploads/2022/08/image-15.png)
Posted on GARYTOWN.COM