Wednesday, 14 April 2010

Shadows in the dark

(or the elusive vshadow.exe)

vshadow is a very cool command line tool from Microsoft for working with the Volume ShadowCopy Service (VSS). If you don't know what VSS is then I'm not about to go in to the details now but it's what Windows uses for System Restore Points, retrieving Previous Versions of documents and allows you to make copies of files that are in use.

vshadow is much better and easier to use than vssadmin, especially on non-server operating systems on which vssadmin won't let you create a snapshot (or shadow volume). The trouble is that it's not the easiest tool to get hold of - it is actually a demo tool that is supplied with various Microsoft SDKs as an example of how to use the VSS API. As such, the tool is limited and there is plenty that it does not do, however if you are looking for a solution to backing up files that are in use then combined with dosdev.exe (another elusive Microsoft tool found in some SDKs) and robocopy it provides a very robust and scriptable solution.

The annoying part is that the VSS API appears to be different on all versions of Windows and so you need a copy of vshadow that was compiled for the version of Windows you want to use it on (i.e. XP, Vista, Win7, Server 2003 or Server 2008). No one seems willing to host the compiled copies of vshadow as there is some debate as to whether this tool is redistributable under the terms of the SDK - personally I think this tool deserves a place on sysinternals.

Ok, so how do you get hold of vshadow.exe?

XP and Server 2003
Download and install the Volume Shadow Copy Service SDK 7.2. Once installed, browse here: C:\Program Files\Microsoft\VSSSDK72\TestApps\vshadow\bin and you will find the release folders for both XP and Server (2003).

Vista, Server 2008 and Win7
Download and install the relevant Microsoft Windows Software Development Kit:

Server 2008: Windows SDK v6.1
Windows 7: Windows SDK v7.0

You can either install these by using the Web Installer or you can download the ISOs. If you just want the compiled versions of vshadow and don't care about the source code or anything else in the SDK then when installing just choose to only install the Win32 Development Tools.

All 3 SDKs install to C:\Program Files\Microsoft SDKs\Windows plus a folder for each SDK (v6.0, v6.1 and v7.0 respectively). Within each version folder head in to Bin\vsstools and you will find the prize.

In order to script a backup of in use files using vshadow, dosdev and robocopy, take a look at this blog entry which contains a section with a script example.

If this all seems a little too complicated and you just want to backup some in use files and you don't need all the cool options that robocopy has then take a look at Hobocopy. This is a tool inspired by robocopy but uses the VSS API to create a shadow volume from which the files are actually copied. Because it uses the VSS API you must make sure you use the correct build of Hobocopy for the OS you are running it on.

No comments:

Post a Comment