A modern C++ command-line tool for automating Windows Update operations. This tool is designed for system administrators and automation scenarios where you need to programmatically search, download, and install Windows updates.
- π Search for updates using customizable criteria
- β¬οΈ Download updates automatically or interactively
- π¦ Install updates with progress reporting
- π€ Quiet mode for automation scenarios
- π» Modern C++17 codebase with smart pointers and proper memory management
- π οΈ CMake build system for flexible compilation
- Windows OS: Windows 10, Windows 11, Windows Server 2016+
- Compiler:
- Visual Studio 2019 or newer (recommended)
- MinGW-w64 with GCC 7.0+ (experimental)
- CMake: Version 3.15 or higher
- Administrator privileges: Required for installing updates
Simply run the provided batch file:
# Release build (default)
build.bat
# Debug build
build.bat Debug# Create build directory
mkdir build
cd build
# Configure CMake
cmake .. -DCMAKE_BUILD_TYPE=Release
# Build
cmake --build . --config Release# Generate Visual Studio solution
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019"
# Open the generated .sln file or build from command line
cmake --build . --config ReleaseWUpdaterCMD.exe -c <criteria_file> [options]| Option | Description |
|---|---|
-h, --help |
Show help message |
-c, --criteria PATH |
Specify the path to file with search criteria (required) |
-q, --quiet |
Run without asking for confirmation (for automation) |
Interactive mode with criteria file:
WUpdaterCMD.exe -c criteria.txtAutomated mode (no prompts):
WUpdaterCMD.exe -c criteria.txt --quietCreate a text file with Windows Update search criteria. The criteria uses the Windows Update Agent API query syntax.
IsInstalled=0 and Type='Software' and IsHidden=0
All uninstalled software updates:
IsInstalled=0 and Type='Software'
Security updates only:
IsInstalled=0 and Type='Software' and CategoryIDs contains '0FA1201D-4330-4FA8-8AE9-B877473B6441'
Critical and security updates:
IsInstalled=0 and Type='Software' and (CategoryIDs contains '0FA1201D-4330-4FA8-8AE9-B877473B6441' or CategoryIDs contains 'E6CF1350-C01B-414D-A61F-263D14D133B4')
Updates not hidden:
IsInstalled=0 and IsHidden=0
For more information on search criteria, see the Microsoft documentation.
This project has been modernized from the original 2019 version with the following improvements:
- β Updated to C++17 standard
- β
Replaced raw pointers with COM smart pointers (
_com_ptr_t) - β Proper exception handling with try-catch blocks
- β RAII principles for resource management
- β Better error messages and logging
- β
Organized code with namespaces (
WUpdater) - β Strong typing with enums instead of magic numbers
- β Added CMake support for flexible building
- β Cross-compiler support (MSVC, MinGW)
- β Automated build scripts
- β Proper dependency management
- β
Added
.gitignorefor clean repository - β MIT License included
- β Improved documentation
- β Example configuration files
- β No memory leaks with smart pointers
- β Automatic cleanup with RAII
- β Proper COM reference counting
WUpdaterCMD/
βββ main.cpp # Main implementation
βββ main.h # Header file with declarations
βββ CMakeLists.txt # CMake build configuration
βββ build.bat # Windows build script
βββ criteria.txt # Example search criteria
βββ README.md # This file
βββ LICENSE # MIT License
βββ .gitignore # Git ignore rules
- Initialization: The tool initializes COM and creates a Windows Update session
- Search: Searches for updates matching the criteria from your criteria file
- Display: Lists all found updates with release dates and download status
- Download: Downloads updates that aren't already cached (with optional confirmation)
- Install: Installs the downloaded updates (with optional confirmation)
- Report: Provides detailed results for each operation
Error: CMake not found
- Install CMake from https://cmake.org/download/
- Add CMake to your PATH environment variable
Error: Cannot find wuapi.h
- Ensure you have Windows SDK installed
- Install Visual Studio with "Desktop development with C++" workload
Error: Access Denied
- Run the program as Administrator
- Windows Update operations require elevated privileges
Error: No updates found
- Check your search criteria syntax
- Ensure Windows Update service is running:
net start wuauserv - Verify network connectivity
Error: COM initialization failed
- Ensure no other update operations are running
- Restart Windows Update service
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
This project is licensed under the MIT License - see the LICENSE file for details.
- 2024: Modernized with C++17, CMake, smart pointers, and improved error handling
- 2019: Original weekend project, built with Visual Studio 2019
- Uses Windows Update Agent (WUA) API
- Built with modern C++ practices and COM smart pointers
Note: This tool is intended for system administrators and advanced users. Always test in a non-production environment first and ensure you have proper backups before installing updates.