How to Backup WSUS Database?

The Windows Server Update Services (WSUS) role, which first appeared in Windows Server 2008 (previously WSUS was installed as a separate app, Software Update Services), allows system administrators to manage the installation of updates and security patches for Microsoft products on computers in the corporate network. The WSUS database can use the Windows Internal Database (WID) or a separate SQL Server instance. This selects the administrator when installing the WSUS role.

In this article we are going to show you how to backup this database in Windows Server 2012 R2/2016 environment.

WSUS does not have built-in utilities for backing up and restoring. You can use ntbackup (wbadmin) or third-party products to backup WSUS.

The WSUS role architecture consists of a database (it stores information about WSUS settings, update metadata, clients, approvals, and other data) and the directory WsusContent with the update files (it contains the cab update files themselves).


When using the built-in WID as a WSUS database (used in most WSUS installations), its files are stored in the C:WindowsWIDData directory. Database files are called SUSDB.mdf and SUSDB_log.ldf. You cannot remotely connect to the WSID WID db via SQL Server Management Studio. Therefore, to backup the WID database, you will have to use the sqlcmd.exe command-line utility, which must run a specific SQL script.

To backup WSUS database you just need to complete 4 easy steps:

  1. Download and install SQL Server 2012 SP1 Feature Pack. It will give you an opportunity to use SQL command line;
  2. Download and install ODBC driver for SQL Server 11;
  3. Create and run Backup WSUSdb script;
  4. Create a task in Windows Task Scheduler to run the SQL script.

We are going to miss the first 2 steps, because they really easy. So let’s start from the 3 step.

At first we need to create BackupWSUSdb.sql file that contains two lines:



F:wsus_db_backupWSUS_DB.BAK is the path to the backup file that you want to create (you can change the path and file name, it’s really up to you).

backup wsus database

Running SQL script

To run the script you should use sqlcmd.exe utility:

sqlcmd.exe -S np:.pipeMICROSOFT##WIDtsqlquery -if:WSUS_DB_BackupbackupWSUSdb.sql

Action to Launch the Script

It’s quite trivial, just do everything like on next screenshot. Start Task Scheduler and create a new job to run the above command according to schedule.

wsus backup


That’s all. The WSUS database backup is created.

If you want to create a backup copy of the update files, and not to download them again when reinstalling or moving WSUS to another server, you need to stop IIS and WSUS Service and copy the contents to the E:wsusWsusContent directory.

When using a full-fledged SQL Server instance, you can configure a backup of the WSUS database using the built-in SQL Server Scheduler tasks from the SQL Server Management Studio console GUI.

You can use the special PowerShell module for SQL (SqlServer) to create a backup copy of the database, you can manually download the module from the PowerShell Gallery ( or install it using the PoSh command:

Install-Module -Name SqlServer

To back up the SQL database from PowerShell, run the PoSh console as an admin and run the command:

Backup-SqlDatabase -ServerInstance ".pipeMICROSOFT##WIDtsqlquery" -Database "SUSDB" -BackupFile e:backupSUSDB.bak

If you want to reinstall WSUS using your WSUS database backup file, you can install SQL Server Express, restore the database from the backup with the same name SUSDB. And during the WSUS installation, it’s enough to specify that the existing database will be used.

how to backup wsus database


In this case, all WSUS settings will be saved.

I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.
Latest posts by Cyril Kardashevsky (see all)

One comment

  1. You forgot a BackSlash ‘\’ on PoSh command.
    This is correct: “\\.\pipe\MICROSOFT##WID\tsql\query”

    Thank you a lot for the guide. It was helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.