SOLVED: How To Force a Clean Up of WSUS Data & Resolve SERVER NODE RESET Using PowerShell

wsus-reset-server-node-error-connection-error If you cannot complete a clean up of your WSUS server through the WSUS console because it keeps erroring out with SERVER NODE RESET, you can hopefully complete through the following PowerShell command line:

Invoke-WsusServerCleanup -DeclineSupersededUpdates -DeclineExpiredUpdates -CleanupObsoleteComputers -CleanupObsoleteUpdates -CleanupUnneededContentFiles -CompressUpdates

powershell-cleanup-wsus-server-node-reset-fixNote that if your WSUS database is corrupted or has other issues, you will want to run WSUS Database cleanup as we describe HERE.

There are a few notes to this script:

  1. You need to run POWERSHELL as an Admin
    .
  2. If you see the following error go to your SERVICES and start WSUS Certificate Server or just type NET START WSusCertServer
    Invoke-WsusServerCleanup : The service cannot be started, either because it is disabled or because it has no enabled devices associated with it
    .
  3. As you can see in the screen shot my first round at this failed.  I also had .NET error the appeared which I mistakenly cleared before reading carefully.  Then I shortened up the script to do less:

Invoke-WsusServerCleanup  -CleanupUnneededContentFiles -CompressUpdates

Then I ran the other half of the script:

Invoke-WsusServerCleanup -DeclineSupersededUpdates -DeclineExpiredUpdates -CleanupObsoleteComputers -CleanupObsoleteUpdates

Then I ran the entire script again, which apparently did nothing.  After that I was able to the WSUS SERVER CLEAN UP WIZARD from the WSUS console without problem.

.

I found some information on this command HERE and HERE.

Comments

  1. Avatar
    Wirelessnutt December 8, 2017 at 11:59 am

    Is there a version of this that works with Powershell Version 2? Installing any newer version of Powershell on SBS 2011 or earlier will break things – badly.

    • Ian Matthews
      Ian Matthews December 28, 2017 at 11:12 am

      I am sorry to say we are only aware of the PS code requiring the latest PowerShell 🙁

  2. Avatar
    Stephen Hogan July 6, 2017 at 1:54 am

    Hi,

    The screenshot shows the reverse of what you state in step 3, i.e.:

    First you ran:

    Invoke-WsusServerCleanup -DeclineSupersededUpdates -DeclineExpiredUpdates -CleanupObsoleteComputers -CleanupObsoleteUpdates

    Then you ran:

    Invoke-WsusServerCleanup -CleanupUnneededContentFiles -CompressUpdates

    And then you ran the whole script.

    Just clarifying….

    Thanks, in advance.
    Stephen

  3. Avatar
    srekcuS May 16, 2017 at 2:25 am

    Hey,

    I just stumbled across this post and it looks fantastic.
    I have a 2008R2 server with WSUS and powershell 4.0 on it. When I try to run the ‘Invoke-WsusServerCleanup’ command I get this error:
    The term ‘Invoke-WsusServerCleanup’ is not recongized as the name of a cmdlet, function, script file…

    Can you point me in the right direction?

    Thanks

    • Ian Matthews
      Ian Matthews May 24, 2017 at 5:12 pm

      Two things come to mind. 1: Are you running PowerShell as an Admin (not just logged into Windows as an Admin, but running the PowerShell app as an Admin) 2: See if you can access any WSUS PowerShell commands like: Get-WSUSServer | fl *

      • Avatar
        Kevin Lawrence September 26, 2017 at 5:09 am

        I am also running 08 r2, running as admin, and the commands don’t work for me either.

        • Ian Matthews
          Ian Matthews December 28, 2017 at 11:30 am

          Hi Kevin;

          Are you running the a current version of PowerShell? These commands require the updated PS builds.

Leave a Reply to Stephen Hogan Cancel reply