Home > Server2008 > Using WinPE & Diskpart to Restore Files

Using WinPE & Diskpart to Restore Files

I was recently teaching a class on the Windows Server 2008 Backup & Restore features and options. Once everyone had performed a successful backup we examined the destination location and I pointed out that the backup data is stored in .VHD format with several corresponding .XML files.  Considering that most students taking the class are relatively new to both Windows Server Backup and Virtual PC I thought it would be important to see how  VHD files were used outside of Virtual PC. After doing a quick Google search on how to perform a repair using the WinPE boot disk and VHD files, I found a step by step run through on the Microsoft Newsgroups which describes how to access the .VHD backup file using the diskpart utility when booting from WinPE.   I thought this might also interest them as just days ago we had performed a fresh install of Server 2008 Enterprise and used diskpart to setup the hard drive to support Bit Locker encryption. Although we ultimately could utilize Bit Locker due to lack of a TPM chip and Virtual PC’s inability to access USB thumb drives, I did emphasize that when studying for the 646 Server Administrator exam it would be necessary to become familiar with diskpart and some of its parameters.

The step by step resolution below was provided in response to the following issue…

“Hello, I would like to restore a few files using Windows Server Backup coming with Windows Server 2008 R2. The OS is not booting so I started Windows PE. I use WBadmin with the option -itemtype:file to start the recovery but WBadmin claims that it is not supported to recover files or applications in Windows Preexecution Environment. Is there a trick to overcome this flaw? By the way, I installed Windows Server 2008 R2 in a VHD and now try to figure out how to backup and restore the OS. “WBadmin start backup -allCritical” is not possible. “WBadmin start backup -include:c:” works, but as I explained it is not possible to restore the VHD file in Win PE”

  1. Boot from Win7 R2/Client setup DVD (same architecture as installed OS)
  2. Goto Repair Windows -> Cmd prompt (WinRE)
  3. Run diskpart.exe -> list vol, you can identify the drive where backup is stored
  4. Go to the location where VHD’s are kept (WindowsImageBackup\<computername>\Backup…\*.vhd
  5. Mount the vhd’s through Diskpart -> select vdisk file=<vhd-file> attach vdisk.
  6. List volume to get the drive letter of mounted VHD partition
  7. Copy required files from mounted VHD volume to the recovery target. xcopy.exe /cherky <mountedvhd>:\… <recovery-target> .. E.g: Xcopy /cherky G:\*.ps1 C:\ . Then run detach vdisk
  8. Then run detach vdisk

This resolution is a perfect example of a viable workaround to an existing issue. Another would have been to mount the .VHD file in an existing Virtual Machine.


Using Wbadmin

Microsoft Technet Newsgroups

Categories: Server2008
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: