Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows Server 2019 / How to Approve and Deploy Updates in WSUS

June 8, 2023 PowerShellWindows Server 2016Windows Server 2019

How to Approve and Deploy Updates in WSUS

One of the main tasks of a WSUS administrator (Windows Server Update Services) is to manage the approval of updates to be installed on Windows computers and servers. In this article, we’ll show you how to manually approve updates, configure auto-approval rules, and decline assigned updates using the WSUS console and PowerShell.

Contents:
  • Configure Target Computer Groups in WSUS
  • How to Manually Approve and Deploy Updates in WSUS?
  • Configure Automatic Update Approval Rules in WSUS
  • How to Decline and Remove Updates on a WSUS Server?
  • Approving WSUS Updates with PowerShell
  • How to Copy Approved Updates Between WSUS Target Groups?

Configure Target Computer Groups in WSUS

 The WSUS service on Windows Server once installed and configured, begins regularly downloading updates for selected products from Microsoft Update servers. Before computers on your network can download and install new updates, they must be approved (or declined) by the WSUS administrator.

To organize testing and installation of updates on domain computers and servers, a WSUS administrator must create target computer groups. Depending on business tasks, types of user workstations and servers, you can create different groups of computers. In general, in the WSUS console in the Computers -> All computers section, it makes sense to create the following computer groups:

  • Test_Srv_WSUS — a group of test servers (non-business-critical servers or dedicated servers with the test environment identical to the production one);
  • Test_Wks_WSUS — test workstations;
  • Prod_Srv_WSUS — production Windows servers;
  • Prod_Wks_WSUS — all user workstations.

configuring wsus target computer groups

You can add computers or servers to WSUS groups manually, or you can assign computers and servers to WSUS groups using the Enable client-side targeting Group Policy option.

After you create WSUS groups, you can approve updates for them. There are two ways to approve updates for installation on computers: manually or automatically.

How to Manually Approve and Deploy Updates in WSUS?

Open the WSUS (Update Services) console and select the Updates section. It displays a summary report of all available updates. By default, there are 4 subsections: All Updates, Critical Updates, Security Updates, and WSUS Updates. You can approve the installation of the specific update by finding it in one of these sections (you can search it by KB name in the update search console or sort updates by the release date).

search for update in wsus console

You can apply various filters in the WSUS console. Display a list of updates not yet approved (use the filter: Approval=Unapproved, Status=Any). Find the update you need, right-click on it, and select Approve from the menu.

You can select multiple updates at once using the CTRL and SHIFT keys.

approve update in wsus manually

Select the WSUS computer group for which you want to approve update installation (for example, Test_Srv_WSUS). Select Approve for Install. You can approve an update for all computer groups at once by selecting All Computers, or for each group individually. For example, you can approve the update installation on a test group, and after 4-7 days, approve it on all computers if no problems occurred.

approve update for install

A window with the update approval results appears. If the update has been approved successfully, the message Result: Success will be displayed. Close this window.

sucessfull update approval

As you can see, this is how a specific update is manually approved. This takes quite a long time since you have to approve each update individually. If you don’t want to manually approve updates, you can create auto-approval for updates.

Configure Automatic Update Approval Rules in WSUS

Automatic approval allows you to approve new updates that appeared on your WSUS server and assign them for installation on the target computers automatically without administrator intervention. Automatic approval of WSUS updates is based on approval rules.

In the WSUS management console, go to Options and select Automatic Approvals.

In the next window, there is only one rule with the name Default Automatic Approval Rule (it is disabled by default) on the Update Rules tab.

To create a new rule, click New Rule.

Default Automatic Approval Rule

The approval rule consists of 3 steps. You must select the update properties, the target group of WSUS computers you want to install the update on, and the rule name.

configure wsus auto-approval rule

If you click a blue link, the corresponding property window will appear.

select update classificatiop

For example, you can enable automatic security update approval for your test servers. To do this, select Critical Updates, Security Updates, Definition Updates under Choose Update Classifications section (uncheck all other options). Then select the WSUS group named  Test_Srv_WSUS in the Approve the update for dialog

The Set a deadline for the approval option allows you to specify whether this update should be forcibly installed on target computers (regardless of Windows Update settings). In this case, computers can be automatically rebooted regardless of whether the GPO option ‘No auto-restart with logged-on users for scheduled automatic updates installations’ is enabled.

configure new automatic approval rule for test group

On the Advanced tab, you can choose whether to automatically approve updates for WSUS itself and whether to additionally approve updates that have been changed by Microsoft. It is recommended to enable all the checkboxes on this tab.

automatically approve updates to the wsus product itself

Now, when your WSUS server downloads new updates on the next second Tuesday of the month (or if you import them manually), they will be approved and automatically installed on the test computer group.

By default, Window clients scan your WSUS server for new updates every 22 hours. To ensure that critical devices receive new updates as quickly as possible, you can increase the frequency of synchronization using the Automatic Update Detection Frequency Group Policy parameter (see the case WSUS error: Exceeded max server round trips). You can also scan for updates manually using the PSWindowsUpdate PowerShell module.

With a large number of clients on a WSUS server ( over 2,000 computers), the performance of the update server with the default configuration may be insufficient, with a persistent error 0x80244022 in the windowsupdate.log. You can optimize the performance of the WSUS IIS pool.

After you’ve installed and tested the updates on your groups of test computers and verified that there are no issues (usually the testing takes 3-6 days), you can approve the new updates on production computers.

How to Decline and Remove Updates on a WSUS Server?

If one of the approved updates has caused any problems on computers or servers, a WSUS administrator can decline it. To do this, find the update in the WSUS console, right-click it, and select Decline.

decline update in wsus

Then select the WSUS group you want to cancel installation for and select Approved for Removal. After a while, the update will be removed on WSUS clients (the process is described in more detail in the article “How to Uninstall Windows Updates?”).

Approving WSUS Updates with PowerShell

You can use PowerShell to manage the approval of WSUS updates.  In order to connect to the WSUS host from the PowerShell console, you can use the following code:

$WsusServerFqdn='mont-wsus.woshub.com'
[void][reflection.assembly]::LoadWithPartialName( «Microsoft.UpdateServices.Administration)
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer( $WsusServerFqdn, $False, '8530')

You can now perform various operations on your WSUS server. For example, to run update synchronization:

$wsus.GetSubscription().StartSynchronization();

List of WSUS computer groups:

$wsus.GetComputerTargetGroups()

Select a specific group of computers:

$group = $wsus.GetComputerTargetGroups() | ? {$_.Name -eq "Test_WKS_WSUS"}

You can use the GetUpdates method to get a list of the latest updates. For example, you want to select the latest Windows and Office security updates in a specific time range:

$updates = $wsus.GetUpdates() | ? {($_.CreationDate -gt "6/1/2022" -and $_.CreationDate -lt "7/1/2022" -and $_.Title -notmatch ".net Framework" -and $_.PublicationState -ne "Expired" ) -and ($_.ProductFamilyTitles -eq "Windows" -or $_.ProductFamilyTitles -eq "Office") -and ($_.UpdateClassificationTitle -eq "Security Updates" -or $_.UpdateClassificationTitle -eq "Critical Updates")}
You can now approve the selected updates for installation on the specified WSUS group:

foreach ($update in $updates)
{
$update.Approve("Install",$group)
}

approve new wsus updates with powershell

You can also use the UpdateServices module to manage WSUS.

Updateservices built-in powershell module

For example, you can use the following PowerShell script to approve the latest security updates for a target group:

$data = (Get-Date).adddays(-30)
$wsus= Get-WSUSServer -Name wsusservername -Port 8530
Get-WsusUpdate -UpdateServer $wsus -Approval Unapproved -Status Needed
Get-WsusUpdate -Classification All -Approval Unapproved | Where-Object { ($_.Update.CreationDate -lt $data) -and ($_.update.isdeclined -ne $true) and {$_.update.title -ilike "*Windows*" -or $_.update.title -ilike "*Office*"} | | Approve-WsusUpdate -Action Install -TargetGroupName "Test_WKS_WSUS"

How to Copy Approved Updates Between WSUS Target Groups?

Unfortunately, you won’t be able to copy approved updates from one WSUS computer group to another using the WSUS console. You can search for new updates one by one and manually approve them for installation on production groups of servers and computers. It’s time-consuming.

I wrote a simple PowerShell script that collects a list of approved updates for the test group and automatically approves the same updates for the production computer group. I run the script 7 days after the updates have been installed on the test groups.

$WsusServerFqdn='mont-wsus.woshub.com'
$WsusSourceGroup = 'Workstation_Test'
$WsusTargetGroup = 'WorkstationProduction'
[void][reflection.assembly]::LoadWithPartialName( “Microsoft.UpdateServices.Administration”)
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer( $WsusServerFqdn, $False, ‘8530’)
$Groups = $wsus.GetComputerTargetGroups()
$WsusSourceGroupObj = $Groups | Where {$_.Name -eq $WsusSourceGroup}
$WsusTargetGroupObj = $Groups | Where {$_.Name -eq $WsusTargetGroup}
$Updates = $wsus.GetUpdates()
$i = 0
ForEach ($Update in $Updates)
{
if ($Update.GetUpdateApprovals($WsusSourceGroupObj).Count -ne 0 -and $Update.GetUpdateApprovals($WsusTargetGroupObj).Count -eq 0)
{
$i ++
Write-Host (“Approving ” + $Update.Title)
$Update.Approve(‘Install’,$WsusTargetGroupObj) | Out-Null
}
}
Write-Output (“Approved {0} updates for target group {1}” -f $i, $WsusTargetGroup)

copy approved updates between wsus computer group with powershell script

This PowerShell script loops through all approved updates in the source WSUS group and approves the installation if the update is not approved in the target group. This sample logs approved updates directly to the PowerShell console. You can output the PowerShell script log to a text file.

0 comment
2
Facebook Twitter Google + Pinterest
previous post
Tutorial: Install and Configure WSUS on Windows Server 2022/2019
next post
How to Repair EFI/GPT Bootloader on Windows 10 or 11

Related Reading

How to Connect VPN Before Windows Logon

November 14, 2023

Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

November 7, 2023

Send Emails with Microsoft Graph API and PowerShell

November 6, 2023

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Fix: Remote Desktop Licensing Mode is not Configured
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Configuring Port Forwarding in Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • How to Delete Old User Profiles in Windows
  • Get-ADUser: Find Active Directory User Info with PowerShell
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top