How to Backup and Restore WSUS Server
I have a WSUS server that keeps going offline and clients are not able to download updates. I am going to remove the WSUS role and reinstall it. I don’t want to lose my settings and content, so I am going to back it up before and restore it afterwards.
First, I need the SQL command line utilities:
- Microsoft® ODBC Driver 11 for SQL Server® – Windows https://www.microsoft.com/en-us/download/details.aspx?id=36434
- Microsoft® SQL Server® 2012 SP1 Feature Pack https://www.microsoft.com/en-us/download/details.aspx?id=35580
Now, I need to create a script called BackupWSUS.sql to perform the backup. It will look something like this (customized to required backup name and location):
BACKUP DATABASE [SUSDB] TO DISK = N'E:\WSUS_DB.BAK' WITH NOFORMAT, INIT, NAME = N'WSUSDB - Full Database Backup', SKIP, NOREWIND, NOUNLOAD,STATS = 10 GO
I also need to create script called RestoreWSUS.sql to use later.
RESTORE DATABASE [SUSDB] FROM DISK = N'E:\WSUS_DB.BAK' GO
Backup the Database:
To backup the database, open a command prompt window and run the following command (customized to where the sql script is saved):
sqlcmd.exe -S np:\\.\pipe\MICROSOFT##WID\tsql\query -i E:\BackupWSUS.sql
The script should give you a message telling you the backup was done successfully.
Backup the Content
Now, I want to backup my content so I don’t have to download it all again.
- Stop IIS
- Stop WSUS Service
- Copy the ..\WSUS\Updates folder to a temporary location
Now that everything is backed up, I can uninstall and reinstall the WSUS server. Once that’s complete, I’ll do the restore.
Beginning the Restore
Before starting the restore, stop IIS and WSUS Services
Restore the Content
To restore the content I simple copied and pasted the UpdateServicesPackages and WsusContent folders into the new WSUS content folder.
Restore the Database
To restore the database, open a command prompt window and run the following command (customized to where the sql script is saved):
sqlcmd.exe -S np:\\.\pipe\MICROSOFT##WID\tsql\query -i E:\RestoreWSUS.sql
The script should give you a message telling you the restore was done successfully.