SOP ยท Enterprise Patching

Windows Security Updates
via PSWindowsUpdate

A complete step-by-step standard operating procedure for installing and scheduling Windows security updates using the PSWindowsUpdate PowerShell module, designed for sysadmins managing enterprise endpoints.

๐Ÿ“… 26 March 2026 By Richard Gamarra โฑ ~10 min read ๐Ÿ–ฅ PowerShell ยท Windows
5
Core Steps
PS 5+
Required Version
Admin
Privilege Level
Auto
Schedule Option
01
Step 1

Install the PSWindowsUpdate Module

Open PowerShell as an Administrator (right-click the Start menu โ†’ Windows PowerShell (Admin)). Then run the following command to install the PSWindowsUpdate module from the PowerShell Gallery:

โš ๏ธ
Administrator Privileges Required This command must be executed in an elevated PowerShell session. Running as a standard user will result in an access denied error.
PowerShell
Install-Module -Name PSWindowsUpdate -Force -AllowClobber

If prompted to install the NuGet provider, type Y and press Enter. The -Force flag bypasses confirmation prompts, and -AllowClobber allows overwriting existing commands from other modules if any conflict arises.

02
Step 2

Import the PSWindowsUpdate Module

After installation, import the module into your current PowerShell session so its cmdlets become available. This step is required every time you start a new session unless you have auto-import enabled via your profile.

PowerShell
Import-Module PSWindowsUpdate
๐Ÿ’ก
Tip: Verify Import Run Get-Command -Module PSWindowsUpdate to confirm the module loaded correctly and to see all available cmdlets.
03
Step 3

Search for Available Security Updates

Use Get-WindowsUpdate to query Windows Update for available patches. You can retrieve all pending updates or filter specifically for security-classified updates.

List all available updates:

PowerShell
Get-WindowsUpdate

Filter for Security Updates only:

PowerShell
Get-WindowsUpdate -Classification SecurityUpdates

The output will list all updates along with their KB article numbers, titles, sizes, and classification. Review the list before proceeding to installation to understand what changes will be applied.

04
Step 4

Install the Security Updates

Once you have reviewed the available security updates, use Install-WindowsUpdate to apply them. The command below filters for security updates, auto-accepts all prompts, and reboots the system if required.

โš ๏ธ
Auto-Reboot Warning The -AutoReboot flag will restart the machine without additional prompts if any update requires it. Ensure all critical work is saved and users are notified before running this in a production environment.
PowerShell
Install-WindowsUpdate -Classification SecurityUpdates -AcceptAll -AutoReboot
Parameter Description
-Classification SecurityUpdates Targets only updates classified as security patches, excluding optional/driver updates.
-AcceptAll Automatically accepts all update license agreements and installation prompts without manual input.
-AutoReboot Triggers an automatic system reboot after installation if any update requires it.
05
Step 5

Verify Installed Updates

After the installation completes (and the system reboots if applicable), run the following command to confirm the security updates were successfully installed:

PowerShell
Get-WindowsUpdate -Install

This command displays a history of all installed updates. Review the list to confirm the expected KB articles are present. You can cross-reference with Microsoft's Security Update Guide using the KB numbers shown.

โœ…
Verification Complete If all targeted security updates appear in the installed list, the patching process was successful. Document the KB numbers and installation date in your change management system.
โš™
Optional

Schedule Automatic Updates via PowerShell

For endpoints that require recurring automated patching, you can register a Windows Scheduled Task that runs the update installer on a defined schedule. The example below configures a daily run at 3:00 AM.

๐Ÿ’ก
Best Practice Schedule automatic updates during off-peak hours. Ensure the endpoint has a stable power and network connection at the scheduled time. For enterprise environments, consider using WSUS or SCCM for centralized patch orchestration.
PowerShell
Register-ScheduledTask \
  -Action (New-ScheduledTaskAction \
    -Execute 'powershell.exe' \
    -Argument 'Install-WindowsUpdate -AcceptAll -AutoReboot') \
  -Trigger (New-ScheduledTaskTrigger -Daily -At 3am) \
  -TaskName "AutoWindowsUpdate" \
  -Description "Automatically installs Windows security updates."
Component Purpose
Register-ScheduledTask Registers a new task in Windows Task Scheduler under the current user or SYSTEM context.
New-ScheduledTaskAction Defines the executable and arguments to run. In this case, PowerShell with the update command.
New-ScheduledTaskTrigger -Daily -At 3am Sets the task to fire every day at 3:00 AM local time.
-TaskName A human-readable label visible in Task Scheduler for easy identification and auditing.
๐Ÿ“š
Reference

References & External Resources

Official documentation and community resources for deeper exploration of PowerShell-based patch management.