This PowerShell script automates the process of checking for and installing Windows updates on your machine.
Developed by Tycho Löke and distributed by PeopleRock B.V., this script ensures your system stays up to date while maintaining detailed logs for transparency.
✅ Automated Windows Updates – Checks for and installs updates seamlessly.
✅ Module Installation Handling – Ensures NuGet and PSWindowsUpdate are installed before execution.
✅ Detailed Logging – Creates a transcript at C:\temp\windowsupdate.log
for easy troubleshooting.
✅ User-Friendly Output – Provides clear status updates during execution.
✅ Non-Interruptive Execution – Updates are installed without forcing a reboot.
Before running the script, ensure you meet the following requirements:
- Operating System: Windows 7 or later
- PowerShell Version: 3.0 or higher
- Administrator Privileges: Run PowerShell as an administrator
Clone this repository or download the script file manually.
git clone https://github.com/your-repo/windows-update-script.git
cd windows-update-script
- Open PowerShell with elevated permissions (
Run as Administrator
).
Run the script using:
.\Windows-Update.ps1
✅ The script checks for required modules (NuGet
& PSWindowsUpdate
).
✅ If missing, it installs them automatically.
✅ The script imports the PSWindowsUpdate module.
✅ It then checks for available updates and installs them.
✅ Logs are stored at: C:\temp\windowsupdate.log
.
- The script uses
-IgnoreReboot
to prevent automatic restarts. - The script applies
-AcceptAll
to install updates without confirmation prompts. - If
C:\temp
does not exist, it creates the directory automatically. - The log file appends new logs instead of overwriting them.
- Ensure you have internet connectivity.
- Check your PowerShell execution policy (
Get-ExecutionPolicy
). - Run
Set-ExecutionPolicy RemoteSigned -Scope Process
if needed.
- Verify that the module is installed:
Get-Module -Name PSWindowsUpdate -ListAvailable
- If missing, manually install it:
Install-Module PSWindowsUpdate -Force
- Check the log file at
C:\temp\windowsupdate.log
. - Run the script with
-Verbose
for detailed output:.\Windows-Update.ps1 -Verbose
Want to improve this script? Contributions are welcome!
To contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature-name
). - Submit a Pull Request with your changes.
This project is licensed under the MIT License – feel free to use, modify, and distribute it.