Skip navigation

Q. How can I take a Volume Shadow Copy Service (VSS) backup of a volume and copy content from the shadow?

A. You can use diskshadow.exe, a new utility in Windows Server 2008, to create shadow copies and restore content from a shadow copy. Diskshadow.exe can create VSS snapshots, mount snapshots with a volume letter, and delete snapshots. The following script, written in the Diskshadow utility’s scripting syntax, creates a snapshot of the D drive, mounts the snapshot as drive X, calls a command file to copy files from X to a backup location, then unmounts the snapshot and deletes it.

#vmbackups.dsh

#Make shadows persistent
SET CONTEXT PERSISTENT
SET VERBOSE ON

#Cab location for process
SET METADATA d:\temp\Backup.cab


BEGIN BACKUP

#Alias volume with alias
ADD VOLUME D: ALIAS DVOL

#Create Snapshot
CREATE

#Expose the volume and run command file then unexpose
EXPOSE %DVOL% X:
EXEC D:\Scripts\copycommands.cmd
UNEXPOSE X:

END BACKUP

#Delete the shadow copy
DELETE SHADOWS SET %VSS_SHADOW_SET%


The command file copycommands.cmd can contain any commands you need for copying your desired files from the shadow copy.

Save the script as vmbackups.dsh and run it using the command

diskshadow -s vmbackups.dsh


For more about Diskshadow scripts, see Microsoft’s page on the Diskshadow utility.
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish