Connect with me!

Have a question? Want to hire me? Reach out and Connect!
I'm available for remote and onsite consulting!
To live chat with me, Click Here!
WSUS

Howto Reinstall WSUS from Scratch

There may be a situation where you wish to completely reinstall WSUS from scratch. This can occur for a number of reasons, but most commonly is due to database corruption, or performance issues due to a WSUS database that hasn’t been maintained properly with the normal maintenance.

Commonly, when regular maintenance hasn’t occurred on a WSUS database, when an admin finally performs it, it can take days and weeks to re-index the database, clean up the database, and run the cleanup wizards.

Also, due to timeouts on IIS, the cleanup wizard may fail which could ultimately cause database corruption.

Administrators often want or choose to blast away their WSUS install, and completely start from scratch. I’ve done this numerous times in my own environment as well as numerous customer environments.

In this guide, we are going to assume that you’re running WSUS on a Windows Server that is dedicated to WSUS and is using the WID (Windows Internal Database) which is essentially a built-in version of SQL Express.

PLEASE NOTE: If you are using Microsoft SQL, these instructions will not apply to you and will require modification. Only use these instructions if the above applies to you.

What’s involved

WSUS (Windows Server Update Services) relies on numerous Windows roles and features to function. As part of the instructions we’ll need to completely clear out:

  • WSUS Role, Configuration, and Folders/Files
  • IIS Role, Configuration, and Folders/Files
  • WID Feature, Configuration, and Database Files

Since we are completely removing IIS (Role, Configuration, and Folders/Files), only proceed if the server is dedicated to WSUS. If you are using IIS for anything else, this will completely clear the configuration and files. You also do not want to run this on a domain controller as Active Directory also uses WID.

Let’s get to it!

Instructions

  1. Open “Server Manager” either on the host, or remotely and connect to the host you’d like to reinstall on.
  2. Open “Remove Roles and Features” wizard.
  3. Click “Next”, and select the Server, and click “Next” again.
  4. On the “Remove server roles” screen, under “Roles”, we want to de-select the following: “Web Server (IIS)” and “Windows Server Update Services” as shown below.
  5. Click “Next”
  6. On the “Remove features” screen, under “Features”, we want to de-select the following: “Windows Internal Database” and “Windows Process Activation Service” as shown below.
  7. Click “Next” and follow the wizard to completion and remove the roles and features.
  8. Restart the Server.
  9. Open an administrative command prompt on the server, and run the command “powershell” or open powershell directly.
  10. Run the following command in powershell to remove any bits and pieces:
    Remove-WindowsFeature -Name UpdateServices,UpdateServices-DB,UpdateServices-RSAT,UpdateServices-API
  11. Restart the Server.
  12. We now must delete the WSUS folders and files. Delete the following folders:
    C:\WSUS
    C:\Program Files\Update Services

    Note: You may have stored the WSUS content directory somewhere else, please delete this as well.
  13. We now must delete the IIS folders and files (and configuration, including the WsusPool application pool, bindings, etc.). Delete the following folders:
    C:\inetpub
    C:\Windows\System32\inetsrv

    Note: You may have issues deleting the “inetsrv” directory. If this occurs, simply rename it to “inetsrv.bad”.
  14. We now must delete the WID (Windows Internal Database) folders and files (including the WSUS SQL Express database). Delete the following folder:
    C:\Windows\WID
  15. While we removed the IIS folders and files, we deleted a needed system file. Run the following command to restore the file:
    sfc /scannow
  16. Restart the Server.

WSUS, IIS, and WID have at this point been completely removed. We will now proceed to install, apply a memory fix, and configure WSUS.

For instructions on installing WSUS on Server Core, please click here: https://www.stephenwagner.com/2019/05/15/guide-using-installing-wsus-windows-server-core-2019/

  1. Open “powershell” (by typing powershell) and Install the WSUS Role with the following command:
    Install-WindowsFeature UpdateServices -Restart
  2. (Optional) If you want to install the WSUS MMC Snap-In/GUI, run the following command in the powershell window:
    Install-WindowsFeature UpdateServices-RSAT, UpdateServices-UI
  3. Run the post installation task command in command prompt to configure WSUS:
    "C:\Program Files\Update Services\Tools\wsusutil.exe" postinstall CONTENT_DIR=C:\WSUS
  4. AT THIS POINT DO NOT CONTINUE CONFIGURING WSUS AS YOU MUST APPLY A MEMORY FIX TO IIS.
  5. Apply the “Private Memory Limit (KB)” fix as provided here: https://www.stephenwagner.com/2019/05/14/wsus-iis-memory-issue-error-connection-error/
  6. Restart the Server.
  7. Open the WSUS MMC on the server or remotely from a workstation on the network and connect it to the WSUS instance on your Server Core install.
  8. Run through the wizard as you would normally and perform an synchronization.
  9. WSUS has been re-installed.

And that’s it. You’ve completely reinstalled WSUS from scratch on your Windows Server.

Stephen Wagner

Stephen Wagner is President of Digitally Accurate Inc., an IT Consulting, IT Services and IT Solutions company. Stephen Wagner is also a VMware vExpert, NVIDIA NGCA Advisor, and HPE Influencer, and also specializes in a number of technologies including Virtualization and VDI.

View Comments

  • GAHHH...I've tried reinstalling WSUS three or four times and keep getting the same error - "one or several parent features are disabled so current feature can not be enabled"

    I sought out someway to I've tried following these instructions twice and the powershell install command fails. DISMAPI_Error__Failed_To_Enable_Updates,Microsoft.Windows.ServerManager

    • Hi Jim,

      Sounds like you might be having some issues with the OS itself that might be stopping this from working.

      Are you running these commands as admin? Is the OS experiencing any other odd issues?

      Cheers

  • I am a domain admin. It doesn't appear the OS is experiencing any other issues. I'm not sure what 'parent features' could be derailing it.

    Also - side note - I removed IIS per your instructions but when I run the scm /scannow command it completes but didn't find any integrity violations so ....nothing was repaired?

    • Hi Jim,

      The scan command should replace files that were deleted in previous steps. I've noticed sometimes that it doesn't report anything is missing.

      That's odd about the parent features error. Are you copying and pasting the commands exactly as they are detailed in the post? Which command reports that issue?

      Stephen

  • I'm redoing it now but I believe it was the first install command

    Install-WindowsFeature UpdateServices -Restart

    that generates the DISMAPI_Error__Failed_To_Enable_Updates,Microsoft.Windows.ServerManager

    So if I use the regular server manager installer I get the parent message. When I use the Powershell command I get the DISMAPI error.

  • Here's the error I receive.

    PS C:\Windows\system32> Install-WindowsFeature UpdateServices -Restart

    Success Restart Needed Exit Code Feature Result
    ------- -------------- --------- --------------
    False Maybe Failed {}
    Install-WindowsFeature : Call was canceled by the message filter.
    At line:1 char:1
    + Install-WindowsFeature UpdateServices -Restart
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : DeviceError: (Microsoft.Manag...rDetailsHandle):CimException) [Install-WindowsFeature],
    Exception
    + FullyQualifiedErrorId : UnSupportedTargetDevice,Microsoft.Windows.ServerManager.Commands.AddWindowsFeatureComman
    d

    PS C:\Windows\system32>

    • Jim,

      I would recommend checking the event log and troubleshooting this. I have a feeling that your OS install has issues and it might be worth while correcting it before it turns in to something big in the future.

  • Thank you Mr.Stephen Wagner, I try and success. You saved my time to reinstall from begin.
    Thank you.

  • I have other web services running on the same server, so I don't want to completely remove IIS if possible, any advice?

  • Because of our server restrictions, I had to run the "postinstall CONTENT_DIR=C:\WSUS" command as follows:

    cd "C:\program files\update services\tools\"
    then
    .\wsusutil.exe postinstall content_dir=D:\wsus
    (we use D: instead of C:)

    For anyone who is getting the "Unexpected token 'postinstall' in expression or statement." error

  • This worked perfectly on windows 2019, had to run post installation task in Admin CMD.

  • Confused how this can work for anyone: the commands for reinstalling WSUS from PowerShell don't reinstall IIS after removing it on Server 2016. It's partly there (looks like 10 of 43 components installed according the info in the Add Server Roles window), but there is no IIS Management section to run the Memory Fix in step #5. In fact, there's no IIS anywhere in the Start menu.

    Is there a missing step where we're supposed to use the Add Roles and Features Wizard or another PowerShell command to restore the other removed pieces of IIS? Do we need to do the install from the "Add Roles and Features Wizard" to ensure IIS installs properly?

    • Hi GraniteStateColin,

      When you install WSUS, it will install the required IIS prerequisites.

      If you're going to locally manage IIS, you'll need to install the feature/role for the IIS Management MMC.

      To answer your other question, if you had any special IIS features installed that you need back, you'll need to manually install those using powershell or the "Add/Remove Features and Roles" as it won't reinstall any custom combinations of features or roles you may have had before.

      Hope this helps!

      Cheers,
      Stephen

  • Stephen, thanks for the quick response. I'm not sure why, but when I followed the steps above, I do not get all of the needed IIS components installed. In the Add Roles and Features set, it shows 10 of 43 installed, so some pieces of IIS installed, but not the IIS Manager. On the other hand, when I use Add Roles & Features, to add WSUS per the standard new-install instructions, I get 11 out of 43 IIS components and the IIS Manager is included. 11 vs. 10.

    If this doesn't sound right to you, maybe that's a sign that something is wrong with the server I'm trying to fix, but seems strange that 10 of the needed 11 IIS components did install, and that all install as expected if I use the GUI method.

    Is there any downside in your experience to installing from Add Roles & Features in place of re-install steps 1 - 3?

    • Hi GraniteStateColin,

      No worries. Sorry I'm a bit more delayed today.

      When you say that you didn't get all the needed IIS components, are you referring to what's needed for WSUS, or what's needed for something else?

      Using the commands in this post, will install what's needed for a basic install of WSUS using the command line to get up and running fast. When you re-install, you can also use the GUI as well if you'd like which may install more components. This is a bare install (which I do for security reasons).

      As mentioned, if you want to run the IIS Manager locally, you'll need to add it using the Add Server Roles/Features wizard. The command in this post skips this as most people use RSAT from another system or server.

      You can use the the command or the Add Roles and Features to install. The most important thing is uninstalling it properly to make sure no traces are left.

      Cheers,
      Stephen

  • Stephen, specifically, in your step #5 of the reinstall, where it refers to your other page to remove the memory limit for WSUS in IIS, at least for me, that's impossible following the PowerShell commands here. I was able to get that to work by instead using the Add Roles and Features Wizard and add WSUS that way instead. That added 1 more IIS module (11 out of 43 vs 10 out of 43 when using the PowerShell commands).

    Everything seems to be working again for me, with that change to the instructions (reinstall using the GUI instead of the commands on this page so that it's possible to remove the memory limit via IIS). Your steps to ensure a full uninstall were profoundly helpful.

    • The command to install the IIS Manager varies, version to version, on Windows, so I didn't include it since it can be easily installable via the Add Features and Roles wizard.

      I'm glad to hear you're up and running though! :)

Share
Published by

Recent Posts

How to properly decommission a VMware ESXi Host

While most of us frequently deploy new ESXi hosts, a question and task not oftenly discussed is how to properly decommission a VMware ESXi host. Some might be surprised to… Read More

3 months ago

Disable the VMware Horizon Session Bar

This guide will outline the instructions to Disable the VMware Horizon Session Bar. These instructions can be used to disable the Horizon Session Bar (also known as the Horizon Client… Read More

3 months ago

vGPU Enabled VM DRS Evacuation during Maintenance Mode

Normally, any VMs that are NVIDIA vGPU enabled have to be manually migrated with manual vMotion if a host is placed in to maintenance mode, to evacuate the host. While… Read More

4 months ago

GPU issues with the VMware Horizon Indirect Display Driver

You may experience GPU issues with the VMware Horizon Indirect Display Driver in your environment when using 3rd party applications which incorrectly utilize the incorrect display adapter. This results with… Read More

4 months ago

Synology DS923+ VMware vSphere Use case and Configuration

Today we're going to cover a powerful little NAS being used with VMware; the Synology DS923+ VMware vSphere Use case and Configuration. This little (but powerful) NAS is perfect for… Read More

4 months ago

How to Install the vSphere vCenter Root Certificate

Today we'll go over how to install the vSphere vCenter Root Certificate on your client system. Certificates are designed to verify the identity of the systems, software, and/or resources we… Read More

4 months ago
Powered and Hosted by Digitally Accurate Inc. - Calgary IT Services, Solutions, and Managed Services