Windows: Reset WSUS and recreate SUSDB

Hi,

here are the steps if you have installed WSUS on Server 2012R2 on the Windows Internal Database to reset the Database and WSUS itself.


Install the Microsoft SQL 2012 Management Studio.

Install SQL-Management Studio
Install SQL-Management Studio

Determine the SQL Server String, Database name and the WSUS Content Directory

c:\> reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Update Services\Server\Setup" /v SqlServerName
    SqlServerName    REG_EXPAND_SZ    MICROSOFT##WID
c:\> reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Update Services\Server\Setup" /v SqlDatabaseName
    SqlDatabaseName    REG_SZ    SUSDB
c:\> reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Update Services\Server\Setup" /v ContentDir
    ContentDir    REG_EXPAND_SZ    D:\WSUS

Stop all WSUS related services (World Wide Web Publishing Service, WSUS Certificate Server and WSUS Service)

c:\> net stop W3SVC
c:\> net stop WsusService
c:\> net stop WSusCertServer

Start SQL Management Studio as Administrator (right click) and
Connect to the Windows internal Database through the named pipe \\.\pipe\Microsoft##WID\tsql\query

Connect to Windows internal Database  by SQL-Management Studio
Connect to Windows internal Database by SQL-Management Studio

And delete the SUSDB

ALTER DATABASE SUSDB
SET OFFLINE WITH ROLLBACK IMMEDIATE;
DROP DATABASE SUSDB;

Delete the Database files

c:\> del /Q C:\Windows\WID\Data\SUSDB.*
c:\> del /Q C:\Windows\WID\Data\SUSDB_*.*

Remove the existing Content Dirctory

c:\> rmdir /Q /S D:\WSUS

Reconfigure WSUS, Create SUSDB and a new content Directory

c:\> "C:\Program Files\Update Services\Tools\wsusutil.exe" postinstall CONTENT_DIR="D:\WSUS"

If the error “Fatal Error: Failed to start and configure the WSUS service” occured try to start the WSUS Service manually

c:\> net start WsusService
c:\> net start WSusCertServer

Michael

7 thoughts on “Windows: Reset WSUS and recreate SUSDB”

  1. Is not necessary install sql management studio, you can create a simple sql file with this commands:

    ALTER DATABASE SUSDB
    SET OFFLINE WITH ROLLBACK IMMEDIATE;
    DROP DATABASE SUSDB;

    And use sqlcmd utlity to start the DROP
    sqlcmd -I -S \\.\pipe\MICROSOFT##WID\tsql\query -i C:\software\WsusDBDrop.sql

  2. Dear all,

    Does anyone know if this method also applies to SBS2011 / 2008 r2? (Obviously changing the directory for the SUSDB, that in 2008r2 is at [DRIVE]:\WSUS\SUSDB\UpdateServicesDbFiles\)

    Thanks.

  3. You don’t need to install SQL Management Studio.

    Windows Internal Database has a built-in SQL command-line client.

    Just do this:

    osql -s \\.\pipe\Microsoft##WID\tsql\query

    Enter your query as usual.

Leave a Reply