Skip to content
theDXT
  • Home
  • IT
  • Scripts
  • GitHub
  • LinkedIn
  • X (Twitter)
  • Search Icon
Windows Updates PowerShell Script

Windows Updates PowerShell Script

November 23, 2020

There have been a lot of critical exploits over the last few months. Really the best way to deal with that is Windows Updates. Now I can hear you complaining that Windows Updates left untamed will just reboot your servers randomly or I don’t want to build WSUS or my RMM doesn’t patch well and it sucks and <insert your excuse here>.

Well I’ve created a PowerShell script that I called DK Win Updates that will help solve the issue. It uses the Windows Update Agent API to search for updates and guess what you can run this as .ps1 file, you could build a scheduled task to run it, you can toss it in your RMM and run it as a script. (if your RMM can’t do that, you should find a new RMM).

The script will search for Windows Updates as if you were clicking on the Windows Check for updates UI button. It will not download driver updates because I’m not that crazy. Do that yourself or tweak the script to make it do it (but I wouldn’t).

Once the script finds updates it will list out all the updates it found and then it will start downloading them and then it will move onto installing them.

After the updates are installed if the updates need a reboot it will reboot the system and give a 5 min warning before rebooting.

A logged in user would see this if they ignored your emails about Windows Updates

I’ve only tested this on Windows 10, Windows Server 2016, and Windows Server 2019. It might work on older versions of Windows it might not. You should really upgrade.

A few things to be aware of

  • The script can’t detect / install Windows 10 Feature Updates / Upgrades
  • The Windows Updates history in Windows settings won’t show the fact that the script has installed the updates, but if you look in Programs and Features > Installed Updates they will show up. They also show in event viewer.
  • It may install a preview update but only if the preview update would normally be available if you clicked check for updates in the normal Windows UI.

I plan to add more features to it in the future like better verbose output about what its downloading and what its installing and also sending that to a log output file.

The script can be downloaded from my GitHub https://github.com/thedxt/win-updates

Related posts:

Default ThumbnailDisable Auto Windows Updates New Teams Mass Install Script Upgrading Duo Authentication for Windows Logon Default ThumbnailScript to make Scripts

IT, Scripts
PowerShell, Script, Update, Windows Updates

Post navigation

PREVIOUS
Aruba 2930F Switch Firmware Upgrade
NEXT
ESXi Setting a static IP

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About Me

Daniel Keer

Project Lead, Senior Consultant at Digitally Accurate Inc.

Awards and Certificates
VMware vExpert ⭐⭐⭐
Omnissa Tech Insider ⭐⭐

Consulting

Stuck on something? Reach out to Digitally Accurate Inc. and we can provide expert IT consulting to help you move forward.

  • Veeam Backup & Replication 13 Windows Install
  • Enable Windows 10 Extended Security Updates
  • slmgr.vbs
  • CyberChef
  • Install or Upgrade Duo Authentication for Windows Logon
© 2026   Copyright. All Rights Reserved.