wsus-reset-server-node-error-connection-errorUpdated: January 2022

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

If this fails or times out, you can run each of the commands one by one:

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

Whichever command you finish on should include -CompressUpdates because that is the command which actually deletes the garbage from the database.

If you want to know what the switches are for INVOKE-WSUSSERVERCLEANUP, skim through THIS Microsoft article.

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.


11 Comments

Kevin · June 25, 2022 at 2:54 am

This got me out of the dreaded ‘Server node reset’ errors. Thank you!

    Wolf · August 24, 2023 at 2:34 am

    worked like a charm (Win2019). Thanks

Tiago Feigo · November 11, 2020 at 1:51 pm

Hello, does this solution apply to WinSer2019? because I tried 3 times and this error occurs in PowerShell.

Invoke-WsusServerCleanup: Execution Timeout Expired. The timeout period ended before completion
operation or the server is not responding.
The instruction has ended.
In line: 1 character: 18
+ … susServer | Invoke-WsusServerCleanup -DeclineSupersededUpdates -Decli …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
+ CategoryInfo: InvalidData: (Microsoft.Updat … rCleanupCommand: InvokeWsusServerCleanupCommand) [Invoke-
WsusServerCleanup], SqlException
+ FullyQualifiedErrorId: UnexpectedError, Microsoft.UpdateServices.Commands.InvokeWsusServerCleanupCommand

    Ian Matthews · November 14, 2020 at 3:56 pm

    Hi Tiago;

    I do not have a Server 2019 box but I doubt it is different as WSUS has not changed from version 3 in years. I no longer have access to a WSUS box as several of my customers just shut down due to COVID and world oil prices; the next time I expect to have my hands on one is in December and that is likely too late to assist.

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 · December 28, 2017 at 11:12 am

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

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

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 · 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 *

      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 · 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 Wirelessnutt Cancel reply

Avatar placeholder

Your email address will not be published. Required fields are marked *