Scripts for WSUS Import/Export

The WSUS Deployment Guide has good general guidance on how to export/import content and metadata to a disconnected network.  Here are some quick scripts that I whipped up to ease the process, as it's something that you'll probably want to do regularly.


WsusContent.bks is required.  As is right now it will backup C:\WSUS\WsusContent to C:\WsusExport\WsusContent[date]_[time].bkf.  It will create a summary log at %userprofile%\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data.  If the initial backup creates a BKF that is too large to fit on a DVD, then you'll need to use another method to transfer the data (xcopy, robocopy, oscdimg, etc.).  However I'd recommend still running the backup the first time as it will clear the archive bit on the files so that the subsequent time this script is run, only the new content will be captured, thus the BKF will be significantly smaller.

@echo off
set datecode=%date:~-4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%
set outdir=c:\WsusExport
set bksfile=%outdir%\wsuscontent.bks
set bkffile=%outdir%\WsusContent%datecode%.bkf

ntbackup backup @%bksfile% /j WsusContent /f %bkffile% /v:yes /l:s /m incremental




Just an automated way to run the export with a unique CAB and LOG file each time.  Both files, along with the above BKF need to be transfered.

@echo off

set datecode=%date:~-4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%
set outdir=c:\WsusExport
set cabfile=%outdir%\
set logfile=%outdir%\WsusMetadata%datecode%.log

"C:\Program Files\Update Services\Tools\wsusutil.exe" export %cabfile% %logfile%


Import the content before running this script.  NTBackup cannot be automated to restore data so it must be done manually.  Make sure to select the Alternate Location option and point to the correct WsusContent folder (to ensure the subfolder structure is maintained).  This script requires you to give it the [date]_[time] code for the metadata you want to import. 

@echo off
set indir=C:\WSUSImport
set cabfile=%indir%\
set logfile=%indir%\WsusMetadata%1.log

if exist %cabfile% (
        if exist %logfile% (
                "C:\Program Files\Update Services\Tools\wsusutil.exe" import "%cabfile%" "%logfile%"
        ) ELSE echo. && echo    ERROR: %logfile% does not exist
) ELSE echo. && echo    ERROR: %cabfile% does not exist

A few other notes:

  • Make sure the update files and language options are identical on both the export and import servers.

  • wsusutil shuts down the Update Service when it runs.

  • After the import completes wait several hours for the content and metadata to fully validate.

  • Close the Update Services console before running the export or import.

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use.

Comments (3)
  1. William says:

    Nice information, but unfortunately Windows Server 2008 does not have ntbackup installed, just wbadmin, which from most of my trolling through Technet and these blogs seems to imply that due to the new nature vhd backup, there is no way to carry out an incremental backup of the WSUSData folder. This would mean that the regular update of the Disconnected network, would require updating of the whole disk from the original 'Connected' machine and then selective recovery from the Backup each time.

    Not very practical, does anyone know if there another way around this that could reduce the regular amount of data required to be transferred each time to the Disconnected Network?

    Thanks in advance…

  2. Jeff25 says:

    Have you updated this script to take into consideration the 2GB limit on the .cab file?

Comments are closed.

Skip to main content