Thursday, October 20, 2011

Move WSUS Database and Content Directory to another Drive

WSUS is great, but when it starts filling up your server's already full hard drive it turns into a problem.

Here are the steps to move your WSUS Database and Content Directory from C:\WSUS to D:\WSUS on the same server (D: being the new hard drive you just installed)

Moving the Content Directory

From a Command Prompt, locate WSUSUTIL.exe (C:\Program Files\Update Services\Tools) and run the following:

wsusutil.exe movecontent D:\WSUS\ D:\WSUS\move.log

(where D:\WSUS is the destination)

Moving the WSUS Database

1. Stop Update Services and IIS Admin Service

2. Open MS SQL Server Management Studio Express

3. Connect to Database Engine - \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query

4. Detach SUSDB (Tasks->Detach); Tick the Drop Connections box

5. Move the SUSDB Folder from C:\WSUS to the new location

6. Attach SUSDB (Right Click Databases -> Attach)

This can also be done via CMD Prompt without SQL Studio – Something I have not tested yet:

To detach:
SQLCMD.EXE -E -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -Q "sp_detach_db 'SUSDB'"

To attach:
SQLCMD.EXE -E -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -Q "sp_attach_db @dbname=N'SUSDB',@filename1=N'D:\WSUSDB\SUSDB.mdf', @filename2=N'D:\WSUSDB\SUSDB_log.ldf'"

And that's it. Now you have more space on C: for that cat-lady to store more photo's of Mittens :-/