none
WSUS Server Cleanup Wizard RRS feed

  • Question

  • I have recently inherited my agency's WSUS server, and I am not sure if or when the Server Cleanup Wizard has ever been run. The Updates folder is taking up huge amounts of disk space, and is growing. I tried to run the Cleanup Wizard with all options selected, and after running for a while, I get the following error:

    The WSUS administration console was unable to connect to the WSUS Server Database.

       

    Verify that SQL server is running on the WSUS Server. If the problem persists, try restarting SQL.

       

     

    System.Data.SqlClient.SqlException -- Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

     

    Source

    .Net SqlClient Data Provider

     

    Stack Trace:

       at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)

       at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)

       at Microsoft.UpdateServices.UI.SnapIn.Wizards.ServerCleanup.ServerCleanupWizard.OnCleanupComplete(Object sender, PerformCleanupCompletedEventArgs e)

    I then tried to run each option individually, and each one would run successfully except 'Unused Updates and Update Revisions', which would run for a while then give the same error above. I need to get this cleaned up and free some disk space and keep a better grip on this. What can I do to resolve this issue?

    Thursday, May 18, 2017 12:21 PM

All replies

  • Have a peek at my Adamj Clean-WSUS script. It is the last WSUS Script you will ever need.

    http://community.spiceworks.com/scripts/show/2998-adamj-clean-wsus

    What it does:

    1. Remove all Drivers from the WSUS Database.
    2. Shrink your WSUSContent folder's size by declining superseded updates.
    3. Remove declined updates from the WSUS Database.
    4. Clean out all the synchronization logs that have built up over time (configurable, with the default keeping the last 14 days of logs).
    5. Compress Update Revisions.
    6. Remove Obsolete Updates.
    7. Computer Object Cleanup (configurable, with the default of deleting computer objects that have not synced within 30 days).
    8. Application Pool Memory Configuration to display the current private memory limit and easily increase it by any configurable amount.
    9. Run the Recommended SQL database Maintenance script on the actual SQL database.
    10. Run the Server Cleanup Wizard.

    It will email the report out to you or save it to a file, or both.

    Although the script is lengthy, it has been made to be super easy to setup and use. There are some prerequisites and instructions at the top of the script. After installing the prerequisites and configuring the variables for your environment, simply run:

    .\Clean-WSUS.ps1 -FirstRun

    and then

    .\Clean-WSUS.ps1 -InstallTask

    If you wish to view or increase the Application Pool Memory Configuration, you must run it with the required switch. See Get-Help .\Clean-WSUS.ps1 -Examples

    If you're having trouble, there's also a -HelpMe option that will create a log so you can send it to me for support.


    Adam Marshall, MCSE: Security
    http://www.adamj.org

    Thursday, May 18, 2017 7:14 PM
  • Hi,
    This issue manifests as a result of the “Delete Unneeded Updates” task, and typically is seen on servers that have been operational for a long period of time where the Server Cleanup Wizard has never been used.  It can also manifest on WSUS servers that just have too much data. Deleting data from a table in SQL Server is a fairly ‘expensive’ operation all to itself, and because there are constraints on whether updates can be deleted by this task, those constraints must be validated for each update identified as a candidate for deletion. 
    You could have a try to run the Server Cleanup Wizard in phases and see if it helps:
    1. Delete unused computers only
    2. Decline expired updates and Decline superseded updates
    3. Delete unused updates (this is the step that usually takes the most time, and is almost always the culprit for timeouts)
    4. Delete unneeded files
    Best regards, 
    Wendy

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, May 22, 2017 8:52 AM
    Moderator
  • Hi,

    I am checking how the issue is going, if you still have any questions, please feel free to contact us.

    And if the replies as above are helpful, we would appreciate you to mark them as answers, and if you resolve it using your own solution, please share your experience and solution here. It will be greatly helpful to others who have the same question.

    Appreciate for your feedback.
    Best regards,

    Wendy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, May 26, 2017 12:25 PM
    Moderator
  • Hello Wendy,

    I am able to run following without any issue

    1. Delete unused computers only
    2. Decline expired updates 

    3. Decline superseded updates
    4. Delete unneeded files

    but i am not able to run the following

    Delete unused updates, this always crash and when I running the script to clean up or invoke cleanup command i am getting following error. Please help me on this.

    Invoke-WsusServerCleanup : Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation
    or the server is not responding.
    The statement has been terminated.
    At line:1 char:1
    + Invoke-WsusServerCleanup -CleanupObsoleteUpdates
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidData: (Microsoft.Updat...rCleanupCommand:InvokeWsusServerCleanupCommand) [Invoke-
       WsusServerCleanup], SqlException
        + FullyQualifiedErrorId : UnexpectedError,Microsoft.UpdateServices.Commands.InvokeWsusServerCleanupCommand

    Friday, June 14, 2019 1:54 AM