The following article describes some maintenance operations that are needed to be performed from time to time.
In addition, the same action is needed if you are encountering issues and failures in the patching operations, like exit code 340. In most cases, the root cause is probably related to the WSUS.
Example of an error that was caused due to WSUS issues:
Exception calling "GetUpdates" with "1" argument(s): "The operation has timed
At C:\Program Files\Intigua\vAgentManager\temp\Runnables\Runnables\aded2ea7-fd1
+ $allUpdates = $wsus.GetUpdates($UpdateScope) | Sort-Object -Property
Check WSUS Server Requirements & Supported Configuration
First, make sure the WSUS Server is meeting the requirements and supported configuration needed by JetPatch:
- WSUS specification in Hardware and Software Specifications
- WSUS Supported Configuration in Windows Solution Overview WSUS
Note - in the case of exit code 340 for the "WSUS Get Updates" script it is highly recommended to decrease the number of patches in WSUS or limit the number of patches that JetPatch is pulling by configuring the relevant classifications to pull
Basic Maintenance Operations on WSUS
- Check if there is sufficient disk space, CPU consumption, Memory leak, connectivity checks and usual IT concerns.
- Reboot the WSUS Server
- Run the command wsusutil.exe checkhealth and check the output to see if there are any errors.
- Run the command wsusutil.exe rest and see if it fixes the issue.
If the above steps were not helpful and you are still getting exit code 340 from patch installation procedures please perform the following -
Advanced Maintenance and Optimization process for WSUS
Manually Identify and decline superseded updates in WSUS
It's recommended to clean manually all superseded updates in order to clean your WSUS infrastructure.
1. Open the Windows Update Services MMC then select the All Updates View as you can see below.
2. Set the display to show the Approval status of ‘Any except Declined’ with a Status of ‘Any’, then Click Refresh.
3. Right-click in the title bar and Enable the ‘Supersedence’ column to make it visible.
4. Select and Decline the Superseded Updates
The updates to be declined have one of two particular flowchart symbols for their updates pictured in the attached image. Select the correct updates and Decline them by either right-clicking the selected updates and clicking decline or by pressing the decline button in the action pane.
Now there are 4 options:
- No icon: update doesn’t supersede another one nor is it superseded by an update.
- Blue square on top: this update supersedes another update, Do not clean these updates !!!
- Blue square in the middle: this update has been superseded by another update and superseded another update as well, this is an example of an update you may want to clean (decline).
- Blue square in the right below corner: this update has been superseded by another update, this is an example of an update you may want to clean (decline).
Clean unused files
Cleaning unused files will remove the files physically present on the server.
We will find in these files the replaced updates that were refused.
From the Administration Console, click Options and then click Server Cleanup Wizard.
The first step in the wizard will be to select the updates you would like to clean. Check only the 'Uneeded update files' checkbox and click next.
Once the cleaning process is completed, click on the Finish button to close the wizard. In the summary, you will find the free space details.
Reindexing the database
The performance of large WSUS deployments will degrade over time if the WSUS database isn't maintained properly. The SQL script in this article can be run by SQL Server administrators to reindex and defragment WSUS databases. It shouldn't be used on WSUS 2.0 databases.
This script does basic maintenance tasks on SUSDB:
- Identifies indexes that are fragmented, and defragments them. For certain tables, a fill factor is set to improve insert performance.
- Updates potentially out-of-date table statistics.
Please download the following script to continue Maintenance Tasks on SUSDB.sql
1. Start Microsoft SQL Server Management Studio and connect to the base instance where the WSUS database is running.
Note: If you are using the Windows internal database, you must install Microsoft SQL Server Management Studio on the WSUS server and use as server name :
\\.\pipe\Microsoft##WID\tsql\query using Windows authentication.
2. Right-click on SUSDB and click on New Query.
3. Paste the script into the query box and click on Execute.
Wait while the request is being processed. Once the query is executed, the result is displayed under the messages tab
Reduce the size of the base
Always from SSMS, right-click on the database SUSDB then go to Tasks -> Shrink 3 and click on Database.
Click OK to start the database reduction.
Once optimization is complete, the window closes automatically.
Please sign in to leave a comment.