When you need to restore from a previous backup, you’ll have to choose a specific backup you want restored, and you must also have a valid backup file. There are various reasons why you would restore from a backup, and that will affect your choice of backup you use. Don’t worry, we’ll help you learn everything you need to know about restoring Windows Server Update Services (WSUS) from backups.
How to Restore the WSUS Database
1. Open SSMS and connect to the database instance being used for WSUS. If connecting to the WID, open SSMS using “Run as administrator” or the connection will not work.
2. Expand Databases and right click on SUSDB (the default name for the WSUS Database) and choose Tasks > Restore > Database…
a. If you are using WID, you likely will encounter an error “Property BackupDirectory is not available for Settings ‘Microsoft.SqlServer.Management.Smo.Settings’. This property may not exist for this object, or may not be retrievable due to insufficient access rights.” This can also happen on other installations of SQL Server like SQL Express, SQL Standard, or SQL Enterprise.
*If this occurs, you will need to create a registry string entry named BackupDirectory and point it to: C:\Temp (or any folder that exists where you store your backups). For the WID:
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSWIN8.SQLWID\MSSQLSERVER" -Name "BackupDirectory" -Value "C:\Temp" -PropertyType String
3. Select Device as the Source and choose the backup file.
4. Under the Backup Options page, put a checkmark in “Close existing connections to destination database” or the restore will likely fail due to the database still being in use.
5. Press OK and your database will restore successfully.
1. Open PowerShell. If connecting to the WID, open PowerShell using “Run as administrator” or the connection won’t work. SQLCmd.exe should already be available to use as it should be in the global
2. Run SQLCmd with the appropriate connection to your database:
SQLCMD -E -S np:\\.\pipe\MICROSOFT##WID\tsql\query -Q "ALTER DATABASE [SUSDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; RESTORE DATABASE [SUSDB] FROM DISK = N'C:\Temp\SUSDB.bak'"
b. SQL Instance:
SQLCmd.exe -S .\SQLServerInstance -E -Q "ALTER DATABASE [SUSDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; RESTORE DATABASE [SUSDB] FROM DISK = N'C:\Temp\SUSDB.bak'"
Restore Your Files
Once you restore your files with permissions (or restore permissions manually), you should make sure you run:
& "$env:ProgramFiles\Update Services\Tools\WsusUtil.exe" Reset
Then wait 24 hours because there are no notifications when this process is running or when it has finished. This will re-visit every update file within the WSUS database and ensure the files on disk are complete and not corrupted. If any files are missing or corrupted, it will attempt to re-download them from the Upstream (usually Microsoft Update).
Restoring Windows Server Update Services from Backups with WAM Saves You Time
WSUS does not have a built-in utility for backing up and restoring. Backups are done using Windows Server Backup or third party file-level solution in combination with SQL Backups or a third-party solution, like WAM. WAM uses SQLCMD.exe which is SQL’s own tool for backups. We test if compression is supported and compress the backup by default. Be advised, compression is NOT supported on SQL Express installations, but is supported on WID/SQL Standard/SQL Enterprise. WAM does NOT back up remote databases as if it is on a remote server (Express/Standard/Enterprise), there should be an SQL Aware Enterprise level backup solution being used to backup the database.
WAM can take care of your WSUS backups and restores so you can work on other things.
At AJ Tek, our vision is to make IT simple and automated for other IT professionals. Our flagship product is WAM, WSUS Automated Maintenance. This system performs all of the tasks that a WSUS Administrator needs to do to maintain WSUS properly only leaving the approving of updates and reporting to the WSUS Administrator.