Did you know about DiskShadow? Creating Shadow Copy from the command line

This can be an alternative for taking a Snapshot in Hyper-V..
According to TechNet @Microsoft they state: DiskShadow.exe is a tool that exposes the functionality offered by the Volume Shadow Copy Service (VSS). By default, DiskShadow uses an interactive command interpreter similar to that of DiskRAID or DiskPart. DiskShadow also includes a scriptable mode.

Note: DiskShadow.exe is not supported on Windows Server 2003 / Windows Vista!

Here are the commands for diskshadow to back up the VHD using VSS (its kicks off vss inside the VM so the data is consistent)

Go to cmd prompt:

set context persistent
add volume d: alias ddrive
set verbose on
expose %ddrive% y:

This will take a VSS snapshop of my D drive (where my vhd lives) and then mounts it as drive letter Y: Now copy the contents of Y: to a safe place. When your done you can delete the snapshop and unmount Y:
Delete Shadows Volume D:

unexpose y:


The following sequence generates a shadow copy on volume D: that remains even after the end of the program but not on the file system as "previous version" is available. Theoretically, you could run this script periodically.

set context persistent
begin backup
add volume e:
end backup


The Fact that shadow copies for this volume are in use can also be seen in explorer. Right-click the drive D: and go to Shadow Copies



To list the shadow just use

List Shadows

and to expose a specific shadow

expose {ShadowCopyId} V:

don’t forget to discard / unexpose the drive when done!

unexpose V:


DiskShadow Documentation @Microsoft Technet