Peter Hinchley

Learning in Public

✪ How to Totally Reset WSUS

I recently needed to reset the configuration, metadata, and content of a WSUS server. I wanted to wipe the entire slate clean, and start again. This is the process I followed:

Stopped the WSUS service using the following PowerShell command:

stop-service WsusService

Uninstalled WSUS:

Uninstall-WindowsFeature -Name UpdateServices-Services, UpdateServices-DB -IncludeManagementTools

Rebooted the server.

Deleted the WSUS content folder:

rmdir /s C:\WSUS\WSUSContent

Deleted the WSUS binaries:

mdir /s C:\Program Files\Update Services

Connected to the local SQL Express 2008 instance:

sqlcmd -E -S localhost\WSUS

Listed the databases:

exec sp_databases; go

Dropped the WSUS database:

drop database [SUSDB]; go

Listed the databases again to confirm SUSDB was removed, then switched back to PowerShell and reinstalled WSUS:

Add-WindowsFeature -Name UpdateServices-Services, UpdateServices-DB -IncludeManagementTools

At this point, the C:\Program Files\Update Services\Tools folder was missing. Strange. Ran the system file checker to scan the server for errors:

sfc /scannow

Following the completion of the scan, the Tools directory was present.

Ran the following PowerShell commands to complete the configuration of WSUS:

$WSUSContentFolder = "C:\WSUS"
$WSUSUtil = "$Env:ProgramFiles\Update Services\Tools\WsusUtil.exe"
$WSUSUtilArgs = "POSTINSTALL CONTENT_DIR=$WSUSContentFolder SQL_INSTANCE_NAME=`"$env:computername\WSUS`""
Start-Process -FilePath $WSUSUtil -ArgumentList $WSUSUtilArgs -NoNewWindow -Wait

At this point I was able to launch the WSUS Administration Console and commence the configuration of WSUS.