In this tutorial, I will walk you through how to reset the WSUS service by recreating the SUSDB database on WID (Windows Internal Database) and the updates storage folder (WsusContent / UpdateServicesPackages).
This type of operation can normally be done “without too much risk”, resetting WSUS will see us lose the history of updates on the computers, that is why before performing this operation, it is necessary to recommended to back up the server.
There are several reasons for resetting the WSUS database:
- Data cleaning
- Service optimization
To proceed with resetting WSUS services, there are two solutions that I will explain to you in this article:
- Manually reset the database
- Uninstall and reinstall the WSUS role
Solution 1: reset SUSDB database
This solution consists of deleting the WSUS files and the database and then relaunching the WSUS configuration wizard.
To perform the operation, you have to download HeidiSQL on the WSUS server (you can use the portable version).
1. On the WSUS server, open a PowerShell command prompt as administrator.
2. The first step will be to check the services used by the WSUS role, enter the command below to display the status of the services.
If the WSUS service is functioning correctly, the 3 services are normally functioning.
3. Now, you have to stop the services in order to be able to delete the files, enter one of the commands below depending on your environment.
4. Check that the services are stopped.
5. We will start by deleting the files from the database located in the folder C:\Windows\WID\Data.
Still in PowerShell, enter the command below :
Once the order is placed, the files are no longer present.
6. Now we are going to delete the files the WSUS update files, on my server, it is in the C: \ WSUS folder. Enter the command below, adapting to your installation.
7. Recreate the folder where the update files will be stored, in my case C:\WSUS.
8. Restart the services required for WSUS to function.
9. It is now necessary to delete the database of the instance, because for the moment only the files have been deleted. Open HeidiSQL as administrator, configure a new connection comment on the capture below, indicating as Name or IP :
10. Run the following query to delete the SUSDB database from the WID instance.
11. Start the post-install configuration, using the cmdlets below, adapting the CONTENT_DIR parameter to your WSUS environment.
If you have an error, restart the server.
12. Launch the WSUS console to open the Windows Update Services setup wizard.
The procedure is the same as for a new installation : WSUS – Installation and configuration – Windows Server Update Service – Page 3 of 7 – RDR-IT (rdr-it.com)
Solution 2 : Uninstall and install the WSUS role
The second solution is to uninstall and (re) install WSUS on the same server.
In order to save time, for this operation, I will explain how to do it in PowerShell.
1. Open a PowerShell window as administrator.
2. Run the following cmdlet to uninstall WSUS.
3. Restart the server
It is possible to add the -Restart parameter to do it during the uninstallation
4. After restarting the server, delete the folder containing the Windows Update files
5. Delete files from the WID database
6. Install WSUS
All that remains is to configure WSUS again after restarting the server if it is necessary.
7. Launch the WSUS administration console to open the configuration wizard.