Subscribe to Windows IT Pro
November 05, 2008 12:00 AM

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

Windows IT Pro
InstantDoc ID #100688
Rating: (0)
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.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.