Windows Server Update Services (WSUS) Reports Error: Connection Error when trying to Perform Cleanup

Problem

Example:

Products

Cause

Resolutions

Try each resolution in order to resolve the issue.

Initial Steps

Resolution 1

Remove the Wsus Application Pool memory limit

Resolution 2

Re-Index the Database

This fix uses a Microsoft SQL Server Instance to perform scripted maintenance operations on the SUSDB, as a Windows Internal Database (WID) MDF file.

Step 1 - Determine if you are using an SQL Server for your WSUS database, or Windows Internal Database (WID):

Windows Internal Database Re-Indexing

sqlcmd -S np:\\.\pipe\MICROSOFT##WID\tsql\query -i WsusDBMaintenance.sql

SQL Server WSUS Database Re-Indexing

sqlcmd -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i WsusDBMaintenance.sql

Resolution 3

Attempt to use Powershell to perform a WSUS Cleanup

Import-Module -Name UpdateServices 
[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")` | out-null
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
$cleanupScope = new-object Microsoft.UpdateServices.Administration.CleanupScope;
$cleanupScope.DeclineSupersededUpdates = $true      
$cleanupScope.DeclineExpiredUpdates = $true
$cleanupScope.CleanupObsoleteUpdates = $true
$cleanupScope.CompressUpdates = $true
$cleanupScope.CleanupObsoleteComputers = $true
$cleanupScope.CleanupUnneededContentFiles = $true
$cleanupManager = $wsus.GetCleanupManager();
$cleanupManager.PerformCleanup($cleanupScope);

Resolution 4

Manually cleanup the WSUS Database using a SQL Script

For a WID WSUS Database:

sqlcmd -S np:\\.\pipe\MICROSOFT##WID\tsql\query -i WsusDBCleanup.sql

For an SQL WSUS Database

sqlcmd -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i WsusDBCleanup.sql

Credits:

Applies to:



Article ID: 765
Last updated: 27 May, 2020
Revision: 11
Third Party Products -> Windows Server -> Troubleshooting -> Windows Server Update Services (WSUS) Reports Error: Connection Error when trying to Perform Cleanup
https://kb.stonegroup.co.uk/index.php?View=entry&EntryID=765