Data Protection: Backup Basics in Windows Server 2008 R2

Jeffery Hicks

Data protection has always been a critical task for Windows professionals. Running a backup job to either tape or disk is the way many IT pros handle this task. Larger IT shops typically have the budget to afford more full-featured, third-party backup solutions. The rest of us rely on the free backup tools that Microsoft provides.

Back in the day, Microsoft’s free tool was the now venerable NTBackup. However, that utility has gone to the great recycle bin in the sky. Windows Server 2008 offers a new set of backup tools, and I want to show you how easy it is to use them with the new Windows Server 2008 R2. Even if you have third-party backup tools, you might find it helpful to know how to do a quick and dirty backup. Be aware that the new backup feature can’t manage backups created with NTBackup.

Installation Essentials

First off, we need to install the backup feature, because it’s not installed by default. Use the Add Features Wizard in Server Manager and add the Windows Server Backup Features (Figure 1). I’m going to use the command-line tools sub-feature so that I can use Windows PowerShell, which I will explain in more detail later in this article. You can also use command-line tools such as ServerManagerCMD.exe to install the feature: C:\ servermanagercmd –install backup-features.

Figure 1 Using the Add Features Wizard to install the Windows Server Backup Features and Command-Line Tools.

The next step is to identify locations for your backups. You can back up files to a network share, a local volume or a dedicated disk. You can’t back up data to tape, but given the growth and widespread availability of inexpensive USB-attached storage, this isn’t that much of a setback these days. There are, however, some factors you need to consider.

Windows Backup incurs some hefty overhead in terms of indices, catalogs and other support files. This is not like creating a .zip file. Don’t assume that 100KB of files will only need 100KB of backup space—they’ll need significantly more.

When backing up to a network share, you have to be careful with file-level access control to protect the integrity and security of your backups. Also be aware that if you back up files to the same network share, the previous backup will be overwritten. The easy solution is to create subfolders for each backup. This also applies if you select a local volume as your backup target.

One advantage to using a network share or volume is that Windows Backup will create a .vhd file containing all backed up files. When you specify the backup location, Windows Backup will create a top-level folder called WindowsImageBackup. Within this folder is a backup folder for each computer. The backup is versioned by date; you’ll see a folder with a name like Backup 2009-12-14 172606. Inside that folder are the backed up files and the .vhd. You can mount this .vhd in Windows 7 and Windows Server 2008 R2. Depending on your backup and archiving requirements, you may simply want to move this file to long-term disk storage or burn it to a DVD.

The easiest and fastest choice is to use a dedicated attached disk. It can be internally attached or attached externally via USB or FireWire. Microsoft recommends that it have enough free space for two-and-a-half times the amount of data you’ll be backing up. The drive will be formatted and hidden from normal management tools, although you can see it in Disk Management. You can use a disk up to 2TB in size.

Creating a Backup Job

Windows Backup is intended to provide a one-stop setup to protect a server. You can enable a scheduled task to backup files and the system state, or to provide for a bare-metal restore. Microsoft assumes you’ll have one scheduled task for this purpose. I’m assuming that you’re using the Windows Backup feature because of limited budget and are after maximum protection given the utility’s constraints.

After you install the Windows Backup feature, expand the Storage node in Server Manager and select Windows Server Backup. In the Actions pane, select “Backup Schedule,” which will start the Backup Schedule Wizard. Then, click Next on the Getting Started screen.

During step two, specify what type of backup you want. Try doing a complete server backup. You can also create a custom backup and pick items such as selected files and system state. I’ll show you how to do a quick file backup later, but for now I’m assuming you want complete server protection.

In the third step, specify when you want the backup task to run. Most of the time, a single backup should be sufficient, but you can run it more than once a day. If you’re backing up critical files, this might be a good choice.

In step four, determine where to store the backup. Microsoft recommends using a dedicated hard disk. Remember, this drive will be reformatted and unavailable for anything else. You can also use a volume or a network share. Pay close attention to the warnings and limitations. You might see a warning reminding you that the disk will be reformatted.

If you don’t see all the disks, click the Show All Available Disks button to refresh. When you select a new disk, you’ll be warned. Once selected, you’ll have a chance to confirm your backup settings. If anything is incorrect, use the Previous button to go back and correct the error. If all goes well, you should get a summary screen. The next day, you can check the Windows Server Backup node for results or errors.

You can also use Windows Backup to run a one-time backup. Select the Backup Once option in the Actions pane. You can use the same settings as your scheduled job or pick something completely different. If you select the latter, the wizard runs again and you can enter new parameters. For example, you might want to copy files to a network share. Remember, any existing backups to the same folder will be overwritten. The backup will execute immediately. If this is a separate backup task you’d like to do often, then you’ll want to take advantage of a scripted solution from the command line or Windows PowerShell. I’ll cover that procedure later.

Restoring Data

Windows Backup uses a time stamp as version information. Using the Recover task launches a wizard that’s easy to follow. Select the appropriate backup source. The Recovery Wizard will display a datetime control of all available backups (see Figure 2). Select the appropriate one. Depending on the type of backup, you may have only one choice.

Figure 2 Selecting the available backups from the Recovery Wizard.

Moving on, select what type of data you want to recover. If you select Files and Folders, you’ll be able to highlight the files you want to recover. Unfortunately, selecting files from multiple directories is next to impossible. You can easily recover everything or recover selected files from one directory. Keep that in mind when you set up the backup job.

When you recover files, you’ll need to specify the target folder, which can be the original folder or an alternate location. You can also control what happens when you restore a current file if a current version exists. You can create a copy so that you have both versions; you can overwrite the existing version; or you can skip restoring if an existing version is detected. The recovery process happens immediately.


If you installed the command backup tools, then you have a few more options. Open a command prompt and look at help for WBADMIN.EXE. You can use the tool to set up a scheduled backup, but I think the GUI is much easier. I find this tool more useful for creating one-time backup jobs. Run the following command to see syntax help:

C:\> wbadmin start backup /?

I don’t have space to cover all the options, but let me show you how you might use the command-line tool to periodically back up files to a network share:

@echo off
::demonstration script using WBADMIN.EXE on a Windows Server 2008 R2 Server

rem backup share UNC
set backupshare=\\mycompany-dc01\backup

rem files and folders to include
set include=c:\scripts,c:\files

rem define date time variables for building the folder name
set m=%date:~4,2%
set d=%date:~7,2%
set y=%date:~10,4%
set h=%time:~0,2%
set min=%time:~3,2%
set sec=%time:~6,2%

rem defining a new folder like \\mycompany-dc01\backup\RESEARCHDC\12152009_132532
set newfolder=%backupshare%\%computername%\%m%%d%%y%_%h%%min%%sec%
echo Creating %newfolder%

mkdir %newfolder%

rem run the backup
echo Backing up %include% to %newfolder%
wbadmin start backup -backuptarget:%newfolder% -include:%include% -quiet

rem Clear variables
set backupshare=
set include=
set m=
set d=
set y=
set h=
set min=
set sec=
set newfolder=

Because I don’t want to overwrite any existing backups, I’ll create a new folder that uses the computer name and a date/time stamp as part of the file name. The batch file has code to handle that task. The main function of the script is to call WBADMIN.EXE to create a backup on the specified share. Again, look at syntax help if you want to tweak this step. What I like about this script is that I can set up my own scheduled task using the Task Scheduler. So, even though the backup wizard only lets me create one scheduled task, I can create as many as I want using WBADMIN.EXE. I can also use this tool to create system state backups as well.

To see what backup jobs have executed, run this command: C:\> wbadmin get versions.

Pay close attention to the version identifier, as you’ll need this value to recover files using WBADMIN (though you can easily use the Recovery Wizard).

Backing up with Windows PowerShell

The other command-line approach is to use Windows Backup PowerShell cmdlets. To access them, you’ll first need to load the Windows backup snapin:

PS C:\> add-pssnapin Windows.ServerBackup

To see which cmdlets are included, use Get-Command:

PS C:\> get-command -pssnapin windows.serverbackup

Unfortunately, creating a backup job is a multistep process. While you can type the necessary commands at the prompt interactively, I think you’ll find it easier with a scripted approach. Here’s a Windows PowerShell version of my original batch file:

#requires -version 2.0
#requires -pssnapin Windows.ServerBackup


$policy = New-WBPolicy
$files=new-WBFileSpec c:\scripts,c:\files
Add-wbFileSpec -policy $policy -filespec $files
$backdir=("\\mycompany-dc01\backup\{0}\{1:MMddyyyy_hhmmss}" -f $env:computername,(get-date))

write-host "Creating $backdir" -foregroundcolor Green
mkdir $backdir | out-null

$backupLocation = New-WBBackupTarget -network $backdir 

Add-WBBackupTarget -Policy $policy -Target $backupLocation

write-host "Backing up $files to $backdir" -foregroundcolor Green
Start-WBBackup -Policy $policy

The Windows PowerShell cmdlets are based around creating and executing a policy. The policy includes the files or volumes to include or exclude, as well as where to back up the files and a few assorted options. You can also create system-state and bare-metal recovery jobs. In my demonstration, I’m simply backing up a few directories. The Start-WBBackup cmdlet carries out the backup task.

When you look at the list of Windows Backup cmdlets, you’ll notice one glaring omission. There are no cmdlets for restoring data. I imagine the assumption is that you wouldn’t want to automate this step, although you can with WBADMIN.EXE. Perhaps cmdlets will be added in the future. In the meantime, you can use the Recovery Wizard or WBADMIN.EXE to restore files.

Your Turn

As you try your hand at these tools, I’m sure you’ll realize there’s a great deal more that Windows Backup brings to the party. You’ll also need to assess how these features fit into your overall backup strategy, as well as into any business-continuity plans you might have. In some ways, the free Windows Backup solution is quite limited, but the scripting options and the use of .vhd files offer some tantalizing possibilities to overcome the limitations. It simply requires a little ingenuity on your part.

Finally, as with any backup software, please make sure you practice the restore process in a non-production setting. You don’t want to learn the process when you have to recover for real and your boss is breathing down your neck. Become familiar with the process so that when the time comes, you end up being the hero.

Jeffery Hicks, MCSE, MCSA, MCT, is a Microsoft MVP and author, trainer and consultant. A 17-year IT veteran specializing in admin scripting and automation, Hicks is an active blogger and conference presenter. His latest book is “Windows PowerShell 2.0: TFM” (Sapien Press, 2009). Reach him at his Web site,