Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
PSWU, or PowerShell Windows Update, is a script for performing Windows Updates from within PowerShell. Its goal is to simplify and automate the job of getting your Windows installation patched. This can be especially handy when you've just installed the OS and have a gazillion patches and multiple reboots to complete. Or if you are automating Windows deployments.
Sales Pitch (don't worry, it's free)
Installing a new copy of Windows from scratch is a drag. The OS itself installs in less than a half hour. But then you start slogging through updates...
- Start Windows Update,
- check for updates, select everything, click the "Install Updates" button,
- Wait 1-100 minutes (depending on your internet connection and the size & number of updates),
- say "yes" to any dialogs that present themselves,
- reboot if asked,
- repeat this process until no more updates are available.
This update process can take hours to complete, and you're stuck babysitting the whole thing.
With PSWU, the update process can still take hours - I haven't found any way to substantially speed up the download and installation of updates. But you don't have to babysit; you just start the script and walk away. PSWU handles the drudgery.
There are a few other tools for this:
- The gold standard
- Requires a server infrastructure and regular administrative work.
- Boe Prox's POSHPAIG (discussed here, GitHub here) looks pretty good! I have not looked at code or usage yet. While coded differently (VBscript!) it accomplishes many of the goals I hope to achieve. However, Boe chose a GUI interface and I want to stay on the commandline.
- Requires setup and maintenance.
- It's just the ticket if you want to download updates once and apply them to multiple machines, without building a WSUS infrastructure.
- BatchPatch and/or WuInstall
- Commercial software, I have not tried these.
- win-updates.ps1 * Looks to do the same thing as PSWU's install-allupdates script * Simpler, less modular.
- Michal Gadja's PSWindowsUpdate module * The inspiration for PSWU. I tried it and thought I could do better, so set to work on PSWU. I ran into the same limitations Michal did (basically, WUA is an old COM interface with some painful limits). The Scripting Guy wrote about it.
- No longer maintained.
- No clear advantage over Windows Update anyway.
- Services like this maintain their own repository of updates. Some may consider this a security hazard; the classic "man in the middle" which may itself have maliscious intent, or may be vulnerable to others who do.
In contrast, PSWU is:
- Simple to use. Download PSWU, start an elevated Powershell console, and run the script.
- Auditable. You have the source code.
- Modifiable. You have the source code.
Functional Description of Current Version
- When invoked on local system, fully updates that system, rebooting as necessary.
- Software patches only. No driver updates at this time.
- Provides a summary log of all updates installed.
- Works well on PowerShell v2 and above, which includes:
- Windows Vista - all versions
- Windows 7 - all versions
- Windows Server 2012 - all versions
- Windows 8 - all versions
- Windows 8.1 - all versions
- Windows Server 2012r2 - all versions
- Windows 10 Previews - not tested, but should work.
- Update remote systems.
Your contributions are welcome. Please do not hesitate to submit issues and/or feature requests. Also feel free to write better documentation or improve the code!