Updating Windows Server Core instances can be incredibly tedious without a desktop interface. This guide breaks down how to leverage the native PSWindowsUpdate
Copy
Search Site
Search Google
module to script your entire patch management process.
By dropping these simple commands into your deployment pipelines, you can force immediate scans, bypass prompts, accept licenses, and handle reboots entirely from the command line.
When deploying Windows Server Core instances, the last thing you want to do is waste time navigating awkward text menus just to pull down security patches. If you are building multiple virtual machines at once, manually handling updates disrupts your deployment momentum.
Fortunately, you can completely automate this process using a robust, community-maintained PowerShell module called PSWindowsUpdate
Copy
Search Site
Search Google
. This tool allows you to query Microsoft Update servers, filter for specific patches, and install them silently without touching a GUI.
[How It Works]
The script uses a couple of straightforward steps to take control of the operating system's native update client:
Module Installation: It pulls down the PSWindowsUpdate module from the PowerShell Gallery and forces the installation so it runs unattended.
Execution: It runs a command that triggers a full check for missing cumulative updates, automatically accepts the licensing terms for all available packages, and manages the system restart if a patch requires it.
[How to Use It]
To run this on a fresh Server Core installation, open your elevated PowerShell console and execute the following block:
# Step 1: Install the Windows Update provider module
Install-Module-NamePSWindowsUpdate-Force
# Step 2: Fetch, install all applicable patches, and reboot automatically
Get-WindowsUpdate-Install-AcceptAll-AutoReboot
[Breaking Down the Switches]
-Install
Copy
Search Site
Search Google
: Tells the module to immediately download and apply any missing updates found during the scan.
-AcceptAll
Copy
Search Site
Search Google
: Bypasses individual EULA prompts for cumulative packages, ensuring the script doesn't freeze waiting for user input.
-AutoReboot
Copy
Search Site
Search Google
: Allows the server to safely restart itself if a critical kernel or security patch requires a reboot to finalize.
This snippet is a perfect baseline to inject into your post-installation setup scripts or VM templates to ensure every new server drops onto your network fully patched from day one.