Today I wanted to share a tip to clean up your WSUS WID database.
The tip allow you to not remove and reinstall to achieve the same goal. You save 2 reboot in the least.
The first step is to close the services;
Stop-Service WSUSService, W3SVC
Make sure the service is stopped;
Get-Service WSUSService, W3SVC
Erase the database file;
After that we need to connect to the database service, as for it the data is still there yet;
We need to restart the service;
Start-Service WSUSService, W3SVC
Use HeidiSQL portable edition, (https://www.heidisql.com/download.php)
Use named pipe and that to connect;
The connection might give you such error; just click OK and ignore it
From there use that command to reset the database;
ALTER DATABASE SUSDB
SET OFFLINE WITH ROLLBACK IMMEDIATE;
DROP DATABASE SUSDB;
Click to Run
Now technically speaking the WSUS is empty, but the console will fail to open at that point. We need to redo the WSUS wizard, which can be run that way;
Program Files\Update Services\Tools\Wsusutil.exe postinstall CONTENT_DIR=”e:\WSUS”
Make sure the folder you write in CONTENT_DIR is empty.
After the command, the WSUS’s console should open correctly, and it should ask you about what product and language you want 🙂