Latest posts by Tim Buntrock (see all)
- Create a self-signed certificate with PowerShell - Thu, Aug 9 2018
- Prevent copying of an Active Directory attribute when duplicating a user account - Thu, Mar 29 2018
- Find and delete unlinked (orphaned) GPOs with PowerShell - Thu, Mar 15 2018
After you start the WSUS Cleanup Wizard, the following error message displays:
WSUS Connection Error
The error occurs because the partition doesn´t have enough disk space to write the log file that the Cleanup Wizard generates. If you can extend the disk space, you can run the wizard without this error.
Extend the disk space using Disk Management ^
- Open the Computer Management console by opening Run and typing msc.
- Click Disk Manager and right-click the volume that hosts the WSUS partition.
- Click Extend Volume.
- Follow the instructions on the server.
Move the WSUS partition to another partition ^
Open the command prompt and type the following commands:
Cd C:\Program Files\Update Services\Tools
wsusutil.exe movecontent W:\WSUS\ W:\WSUSMove.log
The last command will move the WSUS files to W: and create a log file with the name WSUSMove.log.
After a while, the content should be moved and your log file should look like this:
WSUS Move Log
If you can´t extend the disk space or move the content, you can remove WSUSContent files, run the Cleanup Wizard, and then fetch the WSUSContent with the database.
- Stop the Update service by running the following command:
1net stop wuauserv
- Browse to the path WSUSDrive:\WSUS\WsusContent and remove enough updates for the wizard to be able to create a log file on the WSUS partition. In my case, the log file was about 2 GB.
- Start the Update service by running the following command:
1net start wuauserv
- Open the WSUS administration console, select Options, and then select Server Cleanup Wizard. Select all check boxes and then click Next.
- When the cleanup has finished, run the following commands:
12Cd C:\Program Files\Update Services\Toolsexe reset
The command wsusutil.exe reset tells WSUS to check each update in the database and verify that the content is present in the WSUSContent folder. If some updates aren´t located in the WSUSContent folder, WSUS will execute a BITS job to download the missing updates.
How do you know when the job is finished? You can verify this by checking the log file named SoftwareDistribution.log. It is located in C:\Program Files\Update Services\LogFiles.
If you open the log file using Notepad, you can search for Reset Agent Finished. You should find something like the following to indicate that the task has finished:
WsusService.14 ExecutionContext.runTryCode State Machine Reset Agent Finished
Software Distribution Log
How can you prevent the connection error? ^
You should extend the disk space of the WSUS partition as soon as possible. You should also create a scheduled task that cleans up your WSUSDrive. Here is how to do this:
- Save the following script to C:\admin\Scripts\WSUS\WSUSCleanup.ps1 on your server:
1234567891011121314# WSUSCleanup.ps1[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);# Script END
- Open the Task Scheduler on your server.
- Right-click Task Scheduler Library and select Create Basic Task.
- Define a Name and Description and click Next.
- Set the Trigger
- In the Action section, select Start a Program and enter the following options:
Add arguments (optional): -file "C:\admin\Scripts\WSUS\WSUSCleanup.ps1"
- In the Finish section, select Open the Properties dialog for this task when I click Finish and then click Finish.
- To run whether user is logged on or not, select that option on the General Then, click OK and supply your credentials.