Anyone who uses a computer screams the loudest when something is lost. Or perhaps you want to make sure a user's critical files are backed up before repairing a computer problem. Windows 7 offers a number of techniques and tools that you might want to use to backup files. Some tools are relatively easy to implement via a graphic interface. Others might require a bit of command line coding. In this article we'll explore your options. The right solution will depend on your situation and need.

Windows 7 System Backup

Back in the day, NTBackup was a pretty simple utility to backup files or an entire hard drive. Windows 7, alas, doesn't offer an updated equivalent. The backup solution for Windows 7 is essentially an all or none proposition. To access, go to Start ' Control Panel and click on 'Back up your computer' under System Security. You should get something like Figure 1.


Figure 1 Windows 7 Backup

If you 've never used it before you can setup a new backup It may take a few minutes for the Backup tool to load. You will be presented with a choice of backup targets like Figure 2.


Figure 2 Select Backup Target

Ideally you are going to need an external hard drive, although it is also possible to use a network share. Naturally you will want to make sure the location is secure. You will need to pick a location that is not on the same physical disk that you plan on backing up. Once you select the destination you will be prompted for what to backup.


Figure 3 Set Up Backup

If you let Windows choose, it will create a comprehensive system image. This option will require the most disk space, almost equal to the size of your C: drive. On the other hand if you want to be prepared in the event of a catastrophic failure and recover with the least amount of effort, this is the best choice to make. Or you can elect to be more selective as in Figure 4.


Figure 4 Select Backup Items

After you select your items, or if you opted for a system image backup, you can run it immediately, or setup a schedule. Click on the Change Schedule button to modify.


Figure 5 Modify Backup Schedule

Once you save the settings, the backup will run.


Figure 6 Backup in Progress

After the backup completes you'll end up with a special backup folder that you can't do much with. You can't open the folder to view the files but you can copy it to another drive.

When the time comes to restore files, use the same backup program and select Restore. Pick your backup and follow the prompts to restore. The Windows 7 backup utility is a bit cumbersome to use, in my opinion. I've also found the potential disk space requirements to be steep. But if you are looking for the most foolproof backup and restore without resorting to third party backup tools, this is your best bet.

Easy Transfer

Another option is the Easy Transfer utility. I've covered this tool in another article (The Guide to Migrating Windows User Files & Settings) so I won't spend much time. Easy Transfer is intended for computer migrations and makes it pretty easy, hence the name, to save a user's documents which you can then restore after an operating system upgrade or install. Because you can save files to a network share, this is an attractive option if you want a little extra protection before you begin working on a desktop problem. I've also found that backup performance is better, especially if you don't need system image backups.

Create a Compressed Folder

Perhaps the simplest approach to backup a collection of files and folders is to create a compressed folder. Then drag and drop files and folders into it. The beauty is that you can create this folder anywhere and typical user files like Microsoft Office documents compress quite nicely.

To create a compressed folder, open your destination folder and right click on any white space. From the context menu select New ' Compressed Folder. Name the folder with a .ZIP extension and you'll notice the icon will change. Double click the icon to open the folder. In another Explorer window find the select the user's files and folders and drag and drop them to the compressed folder.

An alternative is to select the folder, say My Documents, right-click and use the SendTo 'Compressed Folder menu choice. You might be prompted to save the zip file to the desktop, which might be sufficient. Otherwise move the zip file to a more secure location.

Create a VHD

An option that I'm fond of is to create a small virtual hard disk (VHD) for the user's documents. Once created, you can mount it and simply copy the files and folders you wish to backup. One way to create the VHD is to open the disk manager management console. A fast way is to click on Start-Run and enter 'diskmgmt.msc'. Under the Action menu select 'Create VHD'


Figure 7 Create VHD

You should end up with a dialog window like Figure 8.


Figure 8 Create and Attach a VHD

Enter the file name and target size. I would go ahead and create the VHD with a fixed disk size. This takes a little longer but allocates all the space at once. After the disk is created you will need to initialize and format it. Follow the formatting wizard instructions to create a simple volume and assign it a drive letter. Since I'm assuming this will be used only for a backup archive of user documents, I would go ahead an enable compression, like I did in Figure 9.


Figure 9

This should allow me to fit in a bit more data into a smaller file. I can now easily copy or move files just as I would to any other physical drive. Even better, I can move the VHD, after dismounting, and access the files from anywhere by simply remounting the VHD file.

WBADMIN

The last option is the command line backup tool WBADMIN.EXE. Unfortunately, there isn't a client version of the Windows Backup cmdlets for PowerShell like there is in Window Server 2008 R2. To run, you'll need to be a member of the Backup Operators group or have administrative privileges.

Open a command prompt and type WBADMIN to see help. This utility is for backup only. There is not command line restore option. The assumption is that you will use the graphical Backup and Restore tool.

The basic syntax for creating a backup is:

WBADMIN START BACKUP
[-backupTarget:{ | }]
[-include:]
[-allCritical]
[-user:]
[-password:]
[-noInheritAcl]
[-noVerify]
[-vssFull | -vssCopy]
[-quiet]

I'm not going to explain every single option. At the command prompt type 'wbadmin start backup -?' to see detailed help. The most important items to specify are where to backup and what to backup.

The BackupTarget parameter can be a drive letter, a volume GUID or a UNC. If specify a UNC the default path is:

\\&\\WindowsImageBackup\\.

You may need to create subfolders to organize backups for different computers or dates. The folder must exist before you start the backup. For example, you might first run this command:

C:\> mkdir \\File01\backup\Win7-23

Now you can run the backup.

C:\> wbadmin start backup 'backuptarget:\\file01\backup\win7-23

But now for the bad news. Despite what the command help tells you, you cannot do a partial backup by using the 'Include parameter. The WBADMIN.EXE tool can only peform system image backups, which while valuable, aren't practical when you are hoping for a quick file backup. The graphical backup tools does allow selective backups. It is unfortunate that the command line tool for Windows 7 isn't more complete

Robocopy

The last backup option you might consider is the terrific command line utility, Robocopy. This is one of those commands that every IT Pro should be familiar with so I won't spend a lot of time on the details. Open a command prompt and type 'Robocopy /?' to see command help. Let's say you want to quickly backup a user's work files before attempting a repair.

C:\> robocopy c:\work \\file01\backup\%computername%\work /s

Robocopy will create the destination folder using the computername environmental variable. Don't forget when copying to a network share you may need to take extra steps to provide adequate access control. Otherwise, use Robocopy to backup to a USB drive or stick.

Lastly, you might consider a few Robocopy tweaks so you aren't spending a lot of time creating backup 'jobs' or waiting for them to run. Robocopy under Windows 7 is multithreaded. You can run a copy command and increase the number of threads up to 128. The default is 8.

C:\> robocopy c:\work d:\backup\%computername%\work /s /mt:16

However, don't assume that a large number of threads necessarily speeds up the operation. You may need to experiment with different values depending on your backup target.

If you find yourself needing to backup the same set of files, you also might consider creating a backup job file. Run your backup once and use the /SAVE parameter to create the text file. The format is pretty straightforward but unfortunately doesn't support the use of environmental variables like %userprofile%\documents\. However, you can create a job file with all the other parameters.

C:\> robocopy /nosd d:\backup /mt:16 /s /save:d\mybackup /quit

This will create the backup job file. In my example I'm assuming D:\ will be an external USB stick. On the user's desktop I can run this command:

C:\> robocopy %userprofile%\documents\ /job:d:\myjob

Despite everything you've just read, I think you can get by with an old-fashioned batch file. The major advantage I see is the ability to use environmental variables. Your basic batch file could be as simple as this:

@echo off
robocopy %userprofile%\documents d:\backup\%username% /xjd /mt:16 /s

This would copy the Documents folder for the current user to a folder under D:\Backup that uses the username as a subfolder. Robocopy will skip junction points like My Music and use 16 threads. Of everything we've covered in the article this is probably the fastest ad-hoc backup approach. But if you have more specific requirements I think one of the other solutions I discussed should work, or I'm sure you can find a 3rd party client backup solution to meet your business needs and budgetary requirements.