Support This Project

Volume Shadow Copy Simple Client

The Volume Shadow Copy Service is a service introduced in Windows NT and developed in every following Microsoft Operating System up to Windows 7 and beyond. It is based on snapshot capabilities provided by the NTFS file system, which allows copying files while they are in use (even locked by an application writing them). In short, if a file is being modified, a consistent copy of the old version (actually a copy of the blocks of that file which are being modified) is kept and new data are written to an alternate location, therefore preserving the former state of the volume as long as the snapshot exists. Support for this feature varies a lot depending on which Windows is in use: e.g. Windows 2003 supports persistent snapshots while Windows XP only supports temporary snapshots.

Unfortunately there in no application that can give you the advantage of shadow copies if you are using a script for backing up your data, or if you are a system administrator who likes handy tools such as rdiff-backup or robocopy. In fact, Windows' NTBackup is known to universally s**k and VSHADOW.EXE (a tool bundled with the Microsoft SDK) is quite painful. I believe it was created as such on purpose.

Here's where VSCSC can help you, since it's nothing but a modified version of VSHADOW.EXE that features a -exec option which is much nicer than the original. This is what you need to know in order to use VSCSC:

Using VSCSC together with a batch script

This is the primary usage I had in mind.

vscsc -exec=script.bat C:

If everything works as expected, this is what should happen:

  1. A new snapshot is created for volume C:, which corresponds to a volume such as
    "\\?\Volume{e64b105d-6e2a-11dd-b24a-00505695292c}"
  2. The script named script.bat is invoked with parameter "\\?\Volume{e64b105d-6e2a-11dd-b24a-00505695292c}" or whatever was the weird name before. At this point script.bat can access the snapshot which is immutable and can be read with no problem at all.
  3. When script.bat terminates, the snapshot gets deleted and so is the volume with the weird name.
So what? You cannot access devices beginning with "\\?\" from script files. However, you can use a tool such as DOSDEV.exe to map that name to a letter. Personally I like using B:, since it's not used anymore on modern PCs. So, a typical script would look something like this:

@echo off
DOSDEV B: %1
rem At this point B: is an immutable snapshot of C:, and you can copy from it.
rem You just need to write some stuff that actually copies data from B:
rem My favourite is rdiff-backup, but only robocopy can operate in backup mode
rem as a member of the Backup Operators group (/B switch), therefore bypassing
rem file permissions and security. This might be required sometimes.
DOSDEV /D B:

Using VSCSC manually

VSCSC retains most capabilities of VSHADOW.EXE. You can:

Invoke VSCSC with no parameters to see all the available options.

Links


Support 
This Project