Wednesday, September 20, 2006

Announcing HoboCopy

For a while now, I've been unhappy with the state of my backup strategy. I have a simple script that runs ntbackup every night on a rotating, 14-day schedule: one full backup followed by six incremental backups, then repeat with a different target. In this way, I can always recover to any day in (at least) the last week.


So why am I unhappy? Two reasons:


  1. ntbackup isn't exactly robust - I've seen all sorts of failures, and restoring files is sort of flaky.

  2. ntbackup locks its information up in a proprietary format. I just want my files, dammit, not some .bks file.


Being a cheap bastard with decent programming skills, I started looking at what it would take to wire up my own solution. I thought about using robocopy, the king of copy tools. But it has one major drawback: it can't copy any files that are locked by another program. Some of my friends solve this problem by shutting down all their programs every night, but I knew that there was no way I (or my wife) was going to remember to do that, and of course the one time I'd forget was the day my hard drive would tank. Plus, what about programs like SQL Server that I don't want to ever shut down?


Obviously, it's possible to copy files that are in use. After all, ntbackup does it. So I started poking around, and came across VSS. The good VSS (Volume Shadow Service), not the unbelievably crappy one (Visual Source Safe). The Volume Shadow Service is a very cool piece of Windows XP/2003 that lets you "snapshot" a hard drive, creating what's essentially a point-in-time image of what's on the disk. You can then copy files from that image at your leisure. Better, it's done in an efficient manner, so that it doesn't actually copy anything unless someone does a write, and even then it only copies at a block level. Which is good, because otherwise you'd need 50GB free to snapshot 50GB of data.


But it's even better than that. VSS includes an API that programs like SQL Server 2005 can use to find out when a snapshot is about to occur. When so notified, VSS-aware programs can flush their state to disk, so you get a consistent backup. Of course, not every program is aware of VSS. For those, you get what the docs call a "crash consistent" snapshot. Translation: whatever the hell was on the disk. In my book, that's still better than not backing up at all. After all, my computer seems to do just fine after a BSOD, which is no different.


Armed with the Platform SDK docs, I set out to achieve my goal of a VSS-based backup utility. I would have liked to have used robocopy to do the copy, but I couldn't get it to copy using source paths like \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\data\backup\SmtpSend\Properties\Resources.resx,

which how you get to the files in the snapshot.


Next, I tried to write a managed tool that would do the copy. That wouldn't have been too bad - recursive file copy is pretty simple to implement. Unfortunately, the VSS API is completely broken for CLR interop - the main object you need to access implements one COM interface,  IVssBackupComponents. But if you try to query that object for that interface, it returns E_NOINTERFACE. Which is wrong, wrong, wrong. And also means that there's no way to use the object from straight managed code.


So I decided to write the tool in unmanaged C++. Maybe I could have done it in managed C++, or a combination of C++ and C#, but in the end I decided to make this a project that would help me get a little rust off my C++ skills. Plus, the documentation suggests that paths starting with \\?\GLOBALROOT aren't safe to use from managed code, although it worked fine when I tested it. The end result is HoboCopy. You pass it a source directory and a destination directory, and it makes a recursive copy using VSS. I've run it against my entire hard drive, and it's able to copy everything except files I didn't have permission to copy (e.g. some stuff under Documents and Settings), and for those situations I've got the /skipdenied switch. Some day I'll add a switch that enables the SE_BACKUP privilege to make that behavior even better. Unless one of you wants to submit a patch. :)


Speaking of patches. As of now, the project is hosted at SourceForge under the MIT license, so have at it! (Make sure you download the right one - there are separate binaries for XP and W2K3.) Just go easy on me if you look at the source - it's been years since I wrote much C++. :)


  1. Hmmnn, I got the interop to work, you use the VSSCoordinatorClass class:

    VSS.VSSCoordinator vss = new VSS.VSSCoordinatorClass();

    vss.StartSnapshotSet(out snapshotSetID);

    vss.AddToSnapshotSet(this.VolumeName, Guid.Empty, out _snapshotID);

    VSS.IVssAsync vssAync;

    object callback = null;

    vss.DoSnapshotSet(callback, out vssAync);

    vss.DoSnapshotSet(callback, out vssAync);



    int hr, x=0;

    vssAync.QueryStatus(out hr, ref x);


    if((AsyncStatus)hr == AsyncStatus.Finished)




    VSS._VSS_SNAPSHOT_PROP snapshotProps;

    vss.GetSnapshotProperties(_snapshotID, out snapshotProps);

    _snapshotDeviceName = snapshotProps.m_pwszSnapshotDeviceObject;


  2. Dang you're cheap. You couldn't just by Achronos?

    Cool stuff though!

  3. does zip backup.

  4. Ah! Didn't know about the coordinator class...where were you two months ago!? :) Thanks for the heads-up, though. Maybe I'll switch it to work managed some day.

    And yes, I am cheap. :)

  5. Wait - where did you find VSSCoordinator? I only see one pretty worthless hit on it on Google...

  6. OK, found it. It's right there in the registry. :)

    I'm still not 100% sure this would work - as I said I found some sort of warning about using interop to copy files out of the \\?\GLOBALROOT namespace. But if it does work, it sure as hell would be easier than what I'm doing now.

  7. You can mount a VSS Shadow Copy as a drive letter, and then you CAN use RoboCopy (I'll try to cook up a demo on my blog).

  8. Except you can't create persistent shadow copies on XP. Otherwise that would be a great solution.

  9. FileKeeper ( has nailed the continuous backup problem to the wall. Really slick instantaneous backup with right-click recovery for all versions.

    I hit ^S (Save) in Word and it grabs the difference and backs it up that instant. Really cool.

    Volume Shadow Service is limited to so many copies.

  10. Cool stuff man, I also LIKE very much the fact that you code the starting { and ending } on seperate lines, this is the same tech. that I use and it makes C, C++, C# C whatever code so much more readable...


  11. Steve: FileKeeper sounds cool, but at "not free" it doesn't meet my cheapness requirements. :) As for VSS being limited, the only limitation I know of is for persistent copies, which HoboCopy doesn't use.

    John: glad you liked the style - writing C++ after years and years of C# was a major challenge. As it is, I find the HoboCopy code to be a real mishmash of traditional C++ and C# styles. But given that there's a COM component that gives access to the VSS API, I'll probably rewrite HoboCopy as managed code the next time I need to make significant changes - it's just soooo much easier to get work done in C#.

  12. LOVE Hobocopy, this is ~exactly~ what I've been looking for. I have been using some other solutions, but never been able to backup locked/in-use files.

    Awesome job Craig, you da man!! =D

  13. Glad you like it. Be warned, I've found one major bug that I've got a pending fix for. Basically, the part where it tells SQL Server (or whatever other writers) that a snapshot is about to occur is wrong in the publicly released version. Straight file copying still works, but you're going to get a "crash consistent" view of files, not a "backup consistent" one. I'll be releasing a new version sometime in the next few weeks to correct this.

  14. TYVM... tis almost a perfect fix for my desire for a background backup of my notebook.

    I've been getting an error message when I've tried to specify a remote unc (\\server\share) as the destination. Am I doing something wrong or is this a restriction in the current version?

    Thanks again!

  15. No, that's a scenario I've explicitly supported. In fact, I had to do a little extra work to make sure it works.

    What error are you getting? Can you run with /loglevel=4 and send me the log?

  16. The problem was a lack of patience on my part. I had aborted a local backup copy process, and then tried to start a new one to the UNC. I've a feeling (could be wrong!) that the VSS was still processing the first request, and so hobocopy gave me an error. After playing with it some more I managed to get it working.

    On another 2 notebooks however, the story is different. When I try to run the program for them I get the following error:

    "The system cannot execute the specified program."

    It's running from the same network share for both machines, and I get the same error when I copy the hobofiles local to the c drive. Any ideas?

    <bow> thanks!



    at gmail dot com.

  17. ah, yes, Hobocopy is not particularly good yet at recovering from aborted errors. I believe if you wait a while, VSS will clean up after itself. A reboot will probably also do it, as will obtaining a copy of vshadow.exe and running it with -da (delete all shadow copies).

    As for the "system cannot execute the specified program" error, that's a bit weird. It sounds like something important is missing. Can you point a copy of depends.exe at the EXE and see if it shows any missing dependencies? Perhaps the C runtime?

    The other thing I can think of is that it might be an OS/platform thing. Are you trying to run it on a 64 bit box, or using the XP version on W2K3/Vista or vice-versa?

  18. It has worked fine on two WinXP sp2 notebooks (HP Tablet and Dell D820). It has also failed on two WinXP sp2 notebooks (a Fujitsu tablet and Toshiba portege). Very strange.

    I will try the "depends.exe" and see if there is any difference between the machines on Monday.

  19. Dependency failures:



  20. MSJAVA? WTF? I'm definitely not using Java. I think you can ignore that one.

    MSVCR80.dll, however, is the C Runtime. I don't know what you installed on one machine versus the other that you got the CRT one place but not the other, but that's likely it.

    A little googling shows that MSVCR80.dll can be downloaded. Give it a try and see if that helps. You should just be able to drop it in the same dir as Hobocopy.exe.

  21. Hi Craig,

    Thanks for writing this and making it available under the MIT license! I'm working on a backup program (Box Backup) that I want to add VSS support to, and this should help if I need sample code that's compatible with the license (unlike the VSS SDK).

    I'm trying to access the methods of IVssBackupComponents by IDispatch, rather than vtable, to help users who don't have the header files and want to compile the code. However, I think that maybe VSS doesn't support IDispatch properly.

    I can get an IDispatch interface from IVssBackupComponents, but when I try to get the DISPID of the AbortBackup method using GetIDsOfNames, I get the error (HRESULT) 0x8002801D, which seems to be TYPE_E_LIBNOTREGISTERED.

    This is not a documented return code from GetIDsOfNames. Any ideas what I can do, if anything?

    Cheers, Chris.

  22. Hi Craig,

    Also, if I try to get an IDispatch interface from VSS.VSSCoordinator, CoCreateInstance returns E_NOINTERFACE. Do you know how a scripting language such as C# manages to call methods on this interface? Is there a header provided, or some other way to call methods such as StartSnapshotSet, as DuncanS seems to have managed to do from C#? (I have never programmed in C#, I'm using C++ to try to get this interface).

    Cheers, Chris.

  23. First, I looked into using VssCoordinator, but it doesn't support anything like the full VSS API, so I can't use it for Hobocopy. You may or may not encounter the same limitations.

    Second, there's no reason at all that VSSCoordinator has to implement IDispatch - it's completely optional. In fact, it comes with a set of restrictions that may well have been too severe for them.

    Third, C# isn't a scripting language - it doesn't have to use IDispatch at all (and in fact doesn't) when calling VSSCoordinator methods.


  24. Hi Craig,

    Thanks for your answers. If C# doesn't use IDispatch, do you know how it does call methods of e.g. VSSCoordinator? Presumably it doesn't understand C++ headers? Does it use the type library and LoadRegTypeLib, ITypeInfo and Invoke? Some other mechanism?

    Cheers, Chris.

  25. It simply builds vtables, which after all are pretty simple structures. It can do this by importing type library information, but that's not necessary - as long as it knows the type and order of methods and parameters, it can do the right thing, just like any other COM client.

  26. I am having the same error as Ken. I have two windows 2003 servers. One of them hobocopy works and on the other it dosen't. In a batch file it says "The system can not execute the specified program." I downloaded the MSVCR80.dll but that didn't help. I downloaded the The depends had two errors, msjava.dll and msvcr80.dll. the errors in depends are gone now after downloading those two files but the program still has the same error.

  27. OK, instead of going at the DLLs piecemeal, I should have suggested installing the Visual C++ 2005 redistributable package, available here:

    Give that a shot and see if it fixes the problem. If it does, I'll start shipping it with HoboCopy. I have a new version packaged up and ready to go that I'll push out the door before too long.

  28. Wow that did fix it, thanks for all your work and a great program!

  29. Hi,

    HoboCopy seems to be exactly the tool I've been looking for. I intend to use it to backup VMware virtual machine files. In order to get the VM in a consistent state, I need to suspend (pause) it and make a copy of that paused state.

    I would like to use HoboCopy with its VSS capabilities to minimize downtime, i.e.

    1. Suspend VM

    2. Take Snapshot

    3. Resume VM as soon as snapshot has been taken

    4. Do the actual backup

    Is there any way to know when VSS is done with taking the snapshot?

    Thanks for the great app,


  30. I don't know of any way to do manually what you're asking. I suppose the easiest thing would be to modify Hobocopy so that you can give it a script that it runs before/after the snapshot. I'm not planning to spend any time on Hobocopy to do that right now, but you have the source and it shouldn't be a difficult modification.

    Ideally, the way this would work is that VMWare would provide hooks into the VSS APIs that would take care of this automatically. VSS is designed specifically to allow for the exact case you describe (this is similar, for example, to what SQL Server does when you take a shadow copy) but apparently VMWare doesn't support it right now. Too bad. But when it does, hobocopy should "just work" the way you want it to.

  31. Hi Craig,

    thanks for your hints on implementing it. My C++ skills are barely existent, but maybe I'll ask a friend to do it.

    For why VMware Server (which I use) doesn't natively support VSS: I guess it's marketing strategy. "Server" is their free product, designed to get people hooked on virtualization. Their enterprise product, ESX, which costs quite a few Dollars, has, afair, advanced snapshot capablities (in combination with their own prorietary file system, VMFS) and there are a number of products availabled specifically designed to do live backups of VMs.

    Cheers, Jan

  32. Hi,

    i'm very interesting by your works, but i can't find VSSCoordinatorClass,

    can you help me ?


  33. I'm not sure where it comes from. Probably when you install the VSS SDK.

  34. I have already installed VSS SDK, but i don't know how add a reference to VSS in a .net project (i have no VSS class available in .net or com reference list).

    Can u tell me where are u referenced the class in your .net project ?

    sorry for my poor english language ...

  35. Actually, I'm not sure...just went looking for it, and couldn't track it down. I think it's probably a managed DLL that ships with the SDK, but I can't find it now. Sorry: been quite a while since I worked on this stuff.

  36. Hi Craig,

    First - great tool! I'm trying to use this for a backup solution, and I can almost use this to reconstruct a bootable windoze HD. What I do is run Hobocopy on the entire HD (C:) to a network share. Then, I plug a new (empty) hd back in, boot off of a CD, format and copy the boot sector, mount the network share, and proceed to copy over everything to the "new" HD. When I boot, I get a number of "strange" errors. It does boot into windows, but the system is unstable and doesn't seem to work correctly. I checked the backup log, and it seems to have aborted and skipped all files in C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys, with Message "Error accessing File...Skipping". I'm also not entirely certain that the registry is copied over 100% intact. You mentioned that you use this yourself for your backups. Have you solved these problems? If so, can you share that? Thanks!

  37. I do use the tool myself, every night, on three different machines. But I don't try to back up the entire HD. It certainly seems like you're running into a simple security issue: just run Hobocopy as a user with sufficient privilege to copy all those files. Perhaps Local System?

    As for the registry issue, I don't have any information on that - all Hobocopy does is create a shadow copy and then call CopyFile, so I'm not sure what it could do differently to correct any issues there...

  38. Hi Craig,

    Can u tell me why Hobocopy can't make a shadow copy on one file. When i give just one file as a source parameter, hobocopy create a shadow copy because my disk is in activity. But i don't see the file in destination directory.


  39. The usage is:

    hobocopy sourcedir destdir filename

    So you always have to specify two directories: the directory to copy from and the directory to copy to. You can restrict it to just one file by specifying the filename.

  40. Thanks a lot Craig, i have missing a line in your documentation ...

  41. I noticed if you try and copy a file to a unc path it the tool creates the directory structure where ever your cmd prompt location is set to. i.e. by default in xp the cmd prompt is c:\documents and settings\%username%, if you look in that directory you'll see the unc directory structure. if the dest is a drive letter it's all good.

  42. hobocopy is great though, nice job

  43. Sounds like a bug. I'll file it and if I ever get back to making improvements...

  44. I am unable to find atlstr.h which is used in Hobocopy . Can anyone help me i will be very thankfull

  45. On my machine, it's in my VS2005 directory (for me, that's C:\program files\vs2005 - yours will be different), under the subdirectory VC\atlmfc\include.

  46. Hi, Craig ,

    Your software is one of the best choices to my need.

    but unfortunately, i met a problem.

    I am trying to backup all the data in my c: partition to my e: partition. i login as an administrator and run "HoboCopy.exe /r c:\ e:\" in the console, but the result is always:

    "Creation of directory failed with error Access is denied. (Error number 5) on directory \\?\e:\"

    but if i run "HoboCopy.exe /r c:\ e:\1\" , everything is ok?

    any solution?

  47. but if i run "HoboCopy.exe /r c:\ e:\1\" , everything is ok...

  48. Error 5 is a permission problem. It sounds like Hobocopy is unable to create the directories it needs to on the E: drive. That may well be a bug in Hobocopy - possibly it's barfing when trying to create the root directory, although IIRC it shouldn't try to create the directory if it already exists.

    I think you've hit on the workaround for now - don't use a root directory as the destination. One thing you could try would be to use linkd to "mount" your E: drive at some other location and then use that as the destination. E.g.:

    linkd D:\mount\e E:\

    hobocopy /r C:\ D:\mount\e

    I'll investigate the bug, but it'll probably be a while before I actually get around to fixing it. Sounds like you have a workaround in the meantime.

  49. thx, Craig. I hope that hobocopy will become better and better.

  50. Hello. I am desperately looking for the same sollution as you describe in your blog:

    Robocopy with the shadow copy ability.

    I only have one difference. I only run Vista x64 computers.

    This is the result of:

    hobocopy c:\mail c:\backup outlook.pst

    Starting a full copy from c:\mail to c:\backup

    There was a COM failure 0x8000ffff - .\HoboCopy.cpp (172)

    Is there an easy solution available, other than rewriting the code in managed .net, as I know that is a quite big challange?


  51. I just need to recompile it for x64. As I've recently upgraded to a 64-bit machine myself, this is something I plan to do before too long.

  52. Hello.

    Thanks. This sounds great. I would be happy to be a beta tester :-) Please send me an email when you got the 64 bit version to work.


  53. The x64 version is now available on the SourceForge download page.

  54. YOU ROCK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    i needed shadow copy and hate ntbackup....
    perfect solution for me.

  55. Yes, you do indeed rock for creating this. They removed support for file copy in Windows Server 2008 in an attempt to monopolize the backup market with Microsoft Data Protection manager. Thank you so much for saving me.

  56. I'm glad you find it helpful. But what do you mean by "The removed support for file copy"?

  57. hi,
    i am getting this error

    Starting a full copy from X:\ to d:\

    There was a COM failure 0x80042308 - .\HoboCopy.cpp (349)

    can u pls give me asolution

  58. What sort of drive is X: ? You can't use hobocopy to copy from a networked/mapped drive, because you can't get the remote machine to make a shadow copy.

  59. Thank you, for your quick response. can you please advise me how to take backup of open files in the network?

  60. Run hobocopy on the machine where the files live. Other than that, I'm not sure how you'd do it. Maybe some commerical backup utilities have the ability - no idea.

  61. Thanx for creating such a great app.

    Just one question though.

    Does Hobocopy support long directory paths or directory paths with spaces in their names?

    I'm getting the error below trying to back up my Outlook 2003 PST file from the default installation directory..

    I'm using the standard windows quotes ("") to enclose the full directory path to solve this as without them Hobocopy interprets directory paths to the first space as a command argument

    Hobocopy works like a dream in all my other test cases.

    See sample input-output below:

    C:\Temp\software\Hobocopy\HoboCopy->hobocopy /full /skipdenied /y /r "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Outlook\" C:\Temp\testbak2\
    HoboCopy (c) 2006 Wangdera Corporation.

    Error calling GetFullPathName: The parameter is incorrect.
    (Error number 87)


    I have XP 32 bit and have backed up other data with Hobocopy to the same destination folder.

    Any ideas?


  62. Huh - I can totally repro that. I'll take a look. Probably I'm not handling long pathnames correctly somehow.

    Workaround: create a link to that directory with linkd and back that up.

    linkd C:\temp\hobocopy-test "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Outlook\"

    hobocopy /full /skipdenied /y /r C:\temp\hobocopy-test C:\Temp\testbak2\

  63. Pingback from Creating Snapshot Style Incremental Rotating Backups in Windows | Alpha Leonis

  64. Pingback from AlphaVSS - Bringing Windows Shadow Copy Service (VSS) to .NET | Alpha Leonis

  65. Hi Craig,

    Is it possible to create a persistent shadow copy in XP (or Win2008)? I tried to run betest.exe supplied with VSS SDK on XP and Win2008. On XP it could not run it, while on Win2008 it runs fine, but where can I find the created shadow copy?

    Any help would be appreciated.


  66. No, it's not possible. Otherwise I would have used something like vshadow to create and mount the shadow copy and then used robocopy to copy the files. As soon as the process creating the shadow copy ends, the shadow copy goes away.

    Vshadow does have an option for running a program before terminating, so you might be able to use that, but I'm not sure whether you're allowed to mount the shadow copy on a drive letter, so actually accessing it might be hard.

  67. Hi Craig,

    Thanks for the reply.

    I tried to modify your code by adding a call to SetContext(VSS_CTX_NAS_ROLLBACK) and commenting out writers involvement + code for backup. After I run your modified code, I could see vshadow returning shadow copy (created by your code) with -q option.

    Thus it seems VSS does support persistent shadow copies. Actually what I am trying to achieve is that I want to use a NDMP compliant backup software & NDMP server for backup and recovery. So actual backup will be taken care by NDMP server and I just want to use VSS for creating snapshots.

    Your comments on this will be helpful.

  68. Interesting! One question I would have is whether the shadow copy sticks around for long - I've seen cases where a shadow copy will survive after the program crashes, but it eventually gets cleaned up. I'm not sure how often that happens - certainly a reboot will do it.

    Other than that, I'm not sure what advice to offer. At this point you've done more research on it than I have. :)

    I agree that a tool that just creates the persistent snapshot would be more useful than hobocopy, as robocopy already provides far better copying utility than hobocopy. So if you can figure out how to get a drive mapped to a persistent shadow copy under all operating systems, that would be great!

    Of course, I'm left to wonder: if it's possible, why can't vshadow do it? Have you looked at the vshadow source to see what it does?

  69. Craig, the shadow copies created by modified hobocopy does not get cleaned up after a reboot. It is there at least from the last couple of days.

    after your advice, I tried to look into vshadow and I found out that there is a -el option to expose a shadow copy as drive or mount point. I tried to run vshadow with this option, but it crashed. I will look into vshadow code and try to find out what is making ti crash.

  70. Hi Craig, I could now mount snapshot to a (unused) drive letter or as a mount point using vshadow. This was exactly what I was trying to achieve.

    But now, I have another doubt. Do you have any idea what role does SetBackupState play in creation of snapshot. I mean, if I call SetBackupState with (VSS_BT_FULL or VSS_BT_INCREMENTAL or VSS_BT_DIFFERENTIAL) does snapshot that will be created differ?

    I have to support full, incremental and differential backups in my application. calling SetBackupState with appropriate backup type is all that I need to do? Or do I have to take care of these while actually backing up data?

    Any comment on this?

  71. I have no idea what that flag actually does. It's possible that it's just passed through to the writers as an optimization, so they can determine what sort of data they need to flush to disk. For the file provider, it may make no difference at all.

    But honestly, I'm surprised what you've done works at all. :)

  72. To be honest I haven't done anything. You can yourself confirm whatever I have done.

    There's a flag -p in vshadow copy which can be used to create persistent shadow copies. Using this flag you can create a persistent shadow copy. (e.g. C:\vshadow -p D:). This will not cleaned up unless you call DeleteSnapshots

    After creating a persistent shadow copy this may, you can get the snapshotID of this shadow copy using vshadow -q.

    Now using vshadow -el={SnapID}, G: you can mount that shadow copy to G: drive of your system. You can get exactly same data in G: drive which was there on D: drive.

    But you need windows server to run this. since winXP does not support persistent shadow copies.

  73. Well that explains my confusion: I thought you were doing all of this on Windows XP/Vista.

    So it sounds like hobocopy is still needed, as not many people run a server OS. I have machines with both, and I wanted one tool that I could set up a uniform backup with.

    Looking back over your comments, I see now that you were asking about persistent backups on XP *or* 2008. Sorry I didn't read more carefully, or I could have saved you a lot of time!

  74. Hobocopy is an excellent work Craig. And after talking to you only I looked at vshadow more carefully and found out this. So your help is really appreciated ... :)

  75. doest hobocopy not work with server 2k3. i try to use hobocopy on server 2003, this is the command i use " hobocopy /full . but it said " starting a full copy from to but nothing happen.

  76. Some people have reported trouble getting hobocopy working on 2003. I do have a 2003 machine that I run it on every night, though.

    You can try running

    hobocopy /verbosity=4 /full

    instead, and it should tell you a bit more about what's happening.

  77. i got this with that command.

    Calling CoInitialize
    Starting a full copy from h:\quickbook\ to h:\quickbookbackup\
    Calling CreateVssBackupComponents
    Calling InitializeForBackup
    Calling GatherWriterMetadata


  78. I assume H: is a network drive? Hobocopy doesn't work if the source is a network drive.

  79. no h: is not a network drive

  80. OK, well truthfully I'm not really sure what to tell you, then. I did hear from someone else who was unable to make it work on 2003, but I can't reproduce that here.

    Do you have a VM setup where you could try on a fresh install of 2003?

  81. After reading this article I started some digging and found out that you can use VSS snapshots with robocopy not only using Windows 2003 but also Windows XP:

  82. Yeah, I actually considered doing something like that, but it seems a bit fragile to me somehow. That's probably just paranoia.

    But should I ever have the time, it would probably make sense to rewrite hobocopy to mount the shadow copy on an unused drive letter and hand off the hard work to robocopy. That should make it much more robust and full-featured.

  83. Thanks for the great tool, it was exactly what I was looking for.

    I am using HoboCopy to copy the "Users" directory on Vista64. The full copy works, but an incremental copy fails on some files in the "All Users/Microsoft" folder. I get the following message:

    "Error was The process cannot access the file because it is being used by another process.
    (Error number 32)."

    As a workaround, I just ignore this folder for incremental copies. Any ideas?

    Thanks again,

  84. Huh. That's kind of weird - error 32 is exactly what hobocopy is supposed to prevent. I've never seen this myself, and can't imagine what would be causing it. And I use incremental copies all the time (six nights a week on four different computers, in fact).

    There is a bug in hobocopy having to do with spaces in filenames, but it doesn't look like you're hitting it given that you can do a full copy - it should be the same code path.

    So sorry, I don't really have any idea.

  85. Thanks Craig for the quick reply. It looks like it has something to do with the Windows Search service that isn't playing nice with VSS. Shouldn't MS play nice with itself? If I stop the service, run HoboCopy, and then start the service again everything works fine. Maybe someone else will have the same problem...

    With verbosity=4 I get the following output.

    Skipping file All Users\Microsoft\Search\Data\Applications\Windows\GatherLogs\SystemIndex\SystemIndex.99.Crwl because it doesn't meet filter criteria.
    Copied directory All Users\Microsoft\Search\Data\Applications\Windows\GatherLogs\SystemIndex
    Copied directory All Users\Microsoft\Search\Data\Applications\Windows\GatherLogs
    Copied file \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy73\Users\All Users\Microsoft\Search\Data\Applications\Windows\MSS.chk to \\?\Y:\Backup\McVista64\files\Users\All Users\Microsoft\Search\Data\Applications\Windows\MSS.chk
    Unable to open file \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy73\Users\All Users\Microsoft\Search\Data\Applications\Windows\MSS.log exists. Error The process cannot access the file because it is being used by another process.
    (Error number 32).

  86. Really weird. It almost looks like the search service is mounting the shadow copy and trying to index it. But that's just a guess.

  87. Great tool Craig! I detected this a couple of days ago and now I am adapting your nicely written VSS code to my open source program. It would have taken me weeks to come to this level! I am working on a disk imaging program which is a nice counterpart to your work. Please note that the VSS integration is not available for download now, it is just work in progress. It will hopefully be soon. I am currently struggling with providing support for all paltforms in one binary. If you are interested in this please let me know. Your code is a much simpler and better sample than those in VSS SDK.

  88. Glad you like it. Shoot me a copy or a link of your thing when you get it done.

  89. @Kevin: I had this exact same problem the other day. I shut down Windows Defender and Windows Search and the problem went away. Not sure if either of those services was causing a problem or what.

  90. I have the same problem Felix had back in Sept. Namely, when I run hobocopy on Server 2003 (sp2) I get:

    C:\Documents and Settings\Administrator>\hobocopy /full /verbosity=4 d:\intuit\q
    uickbooks c:\\quickbooks *.qbw
    HoboCopy (c) 2006 Wangdera Corporation.

    Calling CoInitialize
    Starting a full copy from d:\intuit\quickbooks to c:\\quickbooks
    Calling CreateVssBackupComponents
    Calling InitializeForBackup
    Calling GatherWriterMetadata

    C:\Documents and Settings\Administrator>

    Did you ever find any clues as to why it just stops at this point?

  91. Sorry, no. Haven't had time to work on Hobocopy in a long time. I will say that I run hobocopy on my W2K3 box all the time without trouble.

  92. >>"The system can not execute the specified program."

    I've seen this error as well on Windows 2003 Server x64 and it actually led me to this page. The problem is revealed by Dependency Walker as missing MSVCP90.dll and MSVCR90.dll.

    Those files are not included in the redistributable for VC ++ 2005. The simpliest solution seems to be using the 2008 redistributable instead.

    Hope this helps someone else.

  93. Craig, a couple of weeks ago I mentioned here that I adapted my code of the open source disk imager ODIN to use your (adapted) VSS code. I mentioned that I found a way to release only one binary that both supports XP and 2003, Vista. It took me a while I got so far to release a beta. If you are interested in the source code you can download it from here: It's embarassing how MS hast botched this API and made it incompatibel. So the solution is not nice and requires duplication of header information and structures. Anyway (for me) more convenient than to build and release two different binaries. In case of questions you can contact me through the sourceforge project page.

  94. Craig and to all. This is a very interesting piece of code! I am a programmer myself and had a problem to solve at work involving using Microsoft's ImageX tool to make a backup of a live Windows workstation (XP) or Windows 2003 servers and write this to a working .WIM file for system recovery purposes. I originally started toying with the idea of writing my own VSS "wrapper" program that would allow ImageX, actually, may be my own implementation using the Wimgapi library, to backup locked/in-use files. I then stumbled upon this site, looked over the code and decided that before I tackle a write of my own, did Microsoft provide some form of utility already that meets my goals? There is no need to re-invent a wheel, unless I can make a better wheel:) At any rate, here is what I have found:

    Use Microsoft's own vshadow.exe located here:

    Use dosdev.exe to map a drive letter to a mounted snapshot

    Look at this site:

    In my testing on a Dell Latitude D510 laptop running Windows XP SP2, I was able to backup the entire C: drive into a Windows .WIM file using Microsft's ImageX tool. I then rebooted into Windows PE 2.0 on a USB pen drive, formatted the entire C: drive, then re-applied the Windows .WIM file back onto the empty C: drive, after which I restarted the machine. Voila! It works! I was able to backup a live running instance of Windows XP SP2 into an ImageX .WIM file and then use this to completely recover the system. I will run some tests on our Windows 2003 servers.

    Note: Windows 2008 server comes with a program called: diskshadow.exe that is basically vshadow.exe and diskpart.exe rolled-up into one. I am going to try that utility on Windows 2003 server and Windows XP to see if it works.

  95. Hi Craig and others,

    I was looking for a way to make a duplicate boot drive copy in order to do some experiments with beta drivers and BIOS changes that (I discovered the hard way) tend to corrupt the boot drive.

    After trying many different things (including Hobocopy) I stumbled upon some things that might be of interest to you and others that are now running Vista Ultimate.

    I discovered that Vista creates a persistent shadow copy whenever you create a restore point (right click on "computer", select "properties", "advanced system settings", "system protection", and click "create").

    Now if you open "computer" and right click on the drive you want to work with you can select "restore previous versions". This doesn't actually restore anything yet and in here you can "open" the persistent shadow copy of the drive. You can now do anything you like with this shadow copy, but more interesting is the path used to access the persistent shadow copy (it will be something like "\\localhost\C$\@GMT-2009.02.11-08.00.18") works with any application or utility (including robocopy, xcopy, dir, etc.).

    For example you could type "robocopy \\localhost\C$\@GMT-2009.02.11-08.00.18 x:\ /e /b /copyall /purge /sl /r:5 /V /np /xj /tee /log:robocopy-c2x.txt" and this will make a complete, bootable copy of the entire C-drive on the X-drive. By editing the registry (load hive) found on the X-drive to swap the C: and X: letters around and using "easyBCD" to add booting to X:, you end up with a fully bootable copy of the C-drive on the X-drive. When you boot the X-drive, it now comes up as C and the original C remains safely unaltered (you can even unmount it so it is better protected).

    So - in summary to access a shadow copy in Vista Ultimate (possibly other versions also):

    1. Create a "system restore point" which actually creates a persistent shadow copy.
    2. Open the latest "previous version" of the drive you want to work with and note the path (eg. \\localhost\C$\@GMT-2009.02.11-08.00.18). This actually opens the shadow copy in explorer.
    3. Note the path and use it with any application or utility, including robocopy, etc. The path is persistent (you don't need to keep explorer open).

    Note you can also create a shadow copy in Vista using the vssadmin command (instead of creating a restore point). Then using "vssadmin list shadows" you can get the \\?\... path, but not all applications/utilities can access the shadow copy this way. You can still use the "previous versions" trick to find the \\local\... path after using vssadmin to create a shadow copy.

    Another trick I stumbled upon that also works well, but requires downloading the utility "dosdev.exe" from (download MPSRPT_CLUSTER.EXE and use winRAR to extract just dosdev.exe) is to do the following:

    1. Create a persistent shadow copy using "vssadmin create shadow /for=c:".
    2. Use "vssadmin list shadows" to find the \\?\... name of the shadow copy you want to work with.
    3. Use "dosdev T: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy4" (substitute the correct name) to mount the shadow copy temporarily to T:
    4. Now use any utility, including robocopy to work with the T-drive (such as robocopy T: X:...). The only downside is T: can only be accessed from the command shell where you ran dosdev.exe, but this method works well for a batch script.

    Note you can download MPSRPT_CLUSTER.EXE from (scroll down and download just MPSRPT_CLUSTER.EXE). Dosdev.exe can be extracted using winRAR as I mentioned above and placed in any directory you wish (ideally in your PATH somewhere).

    I hope this information helps some of you. Hopefully these same commands will work with Windows 7 too.


  96. I'm having a problem with the tool crashing: I'm running on Vista and downloaded the version. Can anyone help out with this? Thanks!

    Problem Event Name: APPCRASH
    Application Name: HoboCopy.exe
    Application Version:
    Application Timestamp: 459ea97d
    Fault Module Name: VSSAPI.DLL
    Fault Module Version: 6.0.6001.18000
    Fault Module Timestamp: 4791a76b
    Exception Code: c0000005
    Exception Offset: 0002bdcb
    OS Version: 6.0.6001.
    Locale ID: 1033
    Additional Information 1: 78fe
    Additional Information 2: aa045f7c1ce52cf9005c58223248d7ac
    Additional Information 3: 9010
    Additional Information 4: 3b5117e91a8b8f54ca688ec720404d98

  97. I'm wondering if someone can help me. I am trying to backup a outlook pst file and hobocopy backs it up when outlook isn't open but as soon as I open it up I get the following error

    Starting a full copy from c:\Backup\Backup-Source to c:\Backup\Outlook
    Copy of file failed with error The process cannot access the file because anothe
    r process has locked a portion of the file.
    (Error number 33) on file \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Backu


  98. I was wondering if someone can help me with this issue I'm having.

    When I run hobocopy to copy a user's outlook PST file while outlook is closed it works just fine but when I run it wile outlook is open it crashes with this error. (I have included my linkd command as well)

    C:\Backup>linkd C:\Backup\Backup-Source "C:\Documents and Settings\Laura\Local S
    ettings\Application Data\Microsoft\Outlook\
    Link created at: C:\Backup\Backup-Source

    C:\Backup>HoboCopy /full /skipdenied /y /r c:\Backup\Backup-Source c:\Backup\Out
    HoboCopy (c) 2006 Wangdera Corporation.

    Starting a full copy from c:\Backup\Backup-Source to c:\Backup\Outlook
    Copy of file failed with error The process cannot access the file because anothe
    r process has locked a portion of the file.
    (Error number 33) on file \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Backu


  99. Sorry for off-topic, but I'm running out of ideas -

    Does anyone know if I can redistribute VShadow.exe as part of a commercial solution? SDK licence seems to say I can, as it is a sample project, but I'm not sure and so far couldn't find a definite yes/no answer?

  100. Pingback from 1961 Mercury Colony Park Buick Roadmaster, Colony Endeavor 2010

  101. Pingback from Clk430 Radiator High Quality 4.3 L C36 Amg, Used Mercedes Benz Clk430 Parts Cl65 Cl55 Amg

  102. Pingback from B1500 Accessories Used Dodge, B1500 Big

  103. Pingback from 400e Headlight Assembly, 400e Sold

  104. Pingback from Cadillac Cimarron Cars Sale Torsion Beam Macpherson Strut, Cimarron Animal Clinic Stillwater

  105. Pingback from Arthur Price Ltd, Daimler Trucks Canada Ltd

  106. Pingback from Headlight 1999 Mercedes Benz Ml430 Cl65 Clk55 Amg, 380sl Headlight Cl600 Clk55 Amg

  107. Pingback from Buy R1500 Suburban Exhaust Gasket, Gmc R1500 Bulb Replacement

  108. Pingback from W350a 1.3 Megapixel Camera Unlocked Gsm Phone, W350 Full Sew

  109. Pingback from Q45 Wholesale Infiniti Qx56, Headlight Accessories 1994 Infiniti Q45

  110. Pingback from Chevette Body Kit Door Sills Hood Scoops, Part Chevette Mount

  111. Pingback from Used 350z Denver, 350z Windscreen Replacement

  112. Thanks for the great tool, it was exactly what I was looking for.
    I am a chinese.
    Hobocopy goes wrong when file or directory has a chinese name.
    I think the reason is that locale is not set.
    eg: locale loc=locale::global(locale(".936"));
    So,can you solve this problem and publish it?
    or just mail me one release.
    Thanks a lot!

  113. HI !
    do yuo have any idea why i recevid this error:
    "COM failure 0x8004230f " ???
    I've run Hobocopy on a Win7 machine and it works well until i repair the SO.


  114. Have you tried running hobocopy with /verbosity=4? If you do that, what do you get?

  115. It returns me many things....
    these are the last rows of the log
    Component 0 is named WMI, has a path of (null), and is not selectable for backup. 1 files, 0 databases, 0 log files.
    File 0 has path C:\Windows\system32\wbem\repository\*.*
    Component 0 has name WMI, path , is not selectable for backup, and has parent (no parent)
    Calling GetWriterMetadata
    Writer 8 named MSSearch Service Writer
    Writer has 0 components
    Calling GetWriterMetadata
    Writer 9 named Registry Writer
    Writer has 1 components
    Component 0 is named Registry, has a path of (null), and is selectable for backup. 7 files, 0 databases, 0 log files.
    File 0 has path C:\Windows\system32\config\default
    File 1 has path C:\Windows\system32\config\SAM
    File 2 has path C:\Windows\system32\config\SECURITY
    File 3 has path C:\Windows\system32\config\software
    File 4 has path C:\Windows\system32\config\system
    File 5 has path C:\Windows\System32\SMI\Store\Machine\schema.dat
    File 6 has path C:\Windows\system32\config\COMPONENTS
    Component 0 has name Registry, path , is selectable for backup, and has parent (no parent)
    Calling GetWriterMetadata
    Writer 10 named COM+ REGDB Writer
    Writer has 1 components
    Component 0 is named COM+ REGDB, has a path of (null), and is selectable for backup. 1 files, 0 databases, 0 log files.
    File 0 has path %SystemRoot%\Registration\*
    Component 0 has name COM+ REGDB, path , is selectable for backup, and has parent (no parent)
    Calling StartSnapshotSet
    Calling GetVolumePathName
    Calling AddToSnapshotSet
    There was a COM failure 0x8004230f - .\HoboCopy.cpp (349)

  116. OK, I'm not totally sure what the problem is, but a little Googling suggests the following approaches:

    1. Reboot. Try this first.
    2. Perform the steps listed in

    Also, are you using TrueCrypt? There have been reports of issues with TrueCrypt drives and VSS.

  117. i don't use trueCrypt
    trying the list, the "regsvr32 /i swprv.dll" make the error dllregisterserver 80070715

    I tried "vssadmin list shadowstorage" with ""ERROR OF COPY SHADOW PROVIDER DURING EXECUTION OF SPECIFIED COMAND"

    thanks a lot for your help and happy new year!!!

  118. I don't use TrueCrypt....
    trying "regsvr32 /i swprv.dll", it returns "dllregisterserver 80070715"
    but, the page yuo sent is refered not to win 7, isn't it?

    thanks for your help and happy new year!

  119. Yeah, you're right: it doesn't look like that post applies to Windows 7. swprv.dll is related to VSS, however, but it looks as if they may have turned it into a COM+ component instead of a regular COM component. Just a guess there, though.

    At any rate, I'm not really sure what to tell you. It could be that your VSS installation is hosed - can you take snapshots using vssadmin?

    vssadmin Create Shadow /For=C:

    It would also be interesting to see the output of

    vssadmin list providers

  120. C:\Windows\system32>vssadmin list providers
    Nome provider: 'Microsoft Software Shadow Copy provider 1.0'
    Tipo provider: Sistema
    ID provider: {b5946137-7b9f-4925-af80-51abd60b20d5}

    C:\Windows\system32>vssadmin Create Shadow /For=C:
    vssadmin 1.1 - Utilità da riga di comando di amministrazione
    Servizio copia shadow del volume
    (C) Copyright 2001-2005 Microsoft Corp.

    Errore: Comando non valido

    this is not good.. :S

  121. I was having that 349 error as well but I used that microsoft link a few posts above and it fixed it. I haven't installed TrueCrypt.

    To make it easier, I copied the lines needed to run to a new text file, and then saved it as "fix.bat". Doubleclicking the bat file runs them one after another. Note: for me, there were a few errors after some of thoe lines but it did fix it anyway.

    Here they are in case MS takes the page down:
    cd /d %windir%\system32
    Net stop vss
    Net stop swprv
    regsvr32 ole32.dll
    regsvr32 oleaut32.dll
    regsvr32 vss_ps.dll
    vssvc /register
    regsvr32 /i swprv.dll
    regsvr32 /i eventcls.dll
    regsvr32 es.dll
    regsvr32 stdprov.dll
    regsvr32 vssui.dll
    regsvr32 msxml.dll
    regsvr32 msxml3.dll
    regsvr32 msxml4.dll

  122. I tried vshadow -p on a Windows 7 (pro) workstation and it appears to create persistent shadow copies; and yet eveywhere I see this utility mentioned, an admonition is given that it can only create persistent shadow copies on Windows Server 2003. What gives?

    If I do a vshadow -p on a specific drive/volume, will it generate more "Previous Versions" of files on just that drive? How does vshadow -p {protected drives} differ (if at all) from creating a Systemwide (application?) restore point from Control Panel??

  123. Maybe they changed something in Windows 7. How did you verify that the snapshot is persistent? Can you map a drive to it?

  124. I _believe_ I saw it listed in vssadmin, LIST SHADOWS

    Can you confirm that behavior on your end too?
    If it is working, is it virtually the same as creating a Restore Point from Control Panel? (just drive specific...)

  125. I don't really have a convenient way to test it under Windows 7, unfortunately. But given that HoboCopy isn't under active development and needs to support OSes back to XP anyway, I'm not sure how much difference it would make for my code.

  126. sorry, but i'm not near the PC with the problem, but i'll read every suggestion

  127. It doesn't pertain _directly_ to Hobocopy;
    but this blog appeared to have the best understanding of shadow copies and vshadow going, so it made sense to ask here...

  128. Gotcha. I don't have a system handy to check out your assertion (my main system runs Server 2008). I'll try to remember to check it out later.

  129. Thanks; I'll test more on my end.

  130. Well, my tests indicate that while it does appear that persistent shadow copies of some sort are being made with the -p option (as attested to by vssadmin LIST SHADOWS...), there are no Previous Versions showing up in Windows Explorer for files that I know were edited (although multivolume CreateRestorePoints will generate Previous Versions when I edit files in between Restore Points...)

  131. Interesting. I'm actually thinking I might restart development on hobocopy, since my new employer has a very progressive attitude towards open source. Thanks for the info!

  132. Glad to hear that; you obviously do good work.

    Could you corroborate this behavior that I witnessed?
    And feel free to venture a guess as to what you think is going on...

  133. I'll have a look at some point. It's going to take me a while to get to it, though: I have a rather large backlog of hobocopy-related tasks.

  134. OK, as part of my effort to actually put some (not much, but some) time into Hobocopy, I'm moving it to GitHub, and I've started a mailing list at I'll direct future conversations there, since the comment thread on a blog post is a pretty bad medium for a support forum.

  135. You might eventually end up getting buried in spam.
    Google does a Captcha check on addresses it thinks are spammers,
    but there _should_ be an option in your Google Groups Profile to allow you to enforce it for ALL posters.
    Some of the projects are now spending all their time weeding out garbage posts.

    I think you might be better going with Sourceforge;
    they have good developer street cred
    and they can host your moderated posts
    with BBoard/Captcha software of your choosing
    (a possible case of "get what you pay for"?)

    I see something about them hosting forums on their "Create Project" section, but I don't see any specifics as to what they offer to furnish
    (besides hosting...);
    I'll be talking with them about that...

  136. Good to know. I'll keep my eye out for spam problems!

  137. First I had to install "ShadowCopy" and "vcredist", and ran "net start vss", then "cmd" to get the command-line editor.

    There I entered the directory containing Hobocopy:

    C:> cd C:\Program Files\hobocopy

    ... then entered "hobocopy" with the source directory and the target directory in quotes:

    C:\Program Files\hobocopy> hobocopy "C:\Documents and Settings\User\Local Settings\Temp" "C:\Documents and Settings\User\My Documents\duplicate"

    ... then enter, and wait for confirmation. It copied everything in "Temp" to "duplicate".

  138. @Moe. Sounds like it's working for you - great! If you have questions, please send them to

  139. Many years ago you acknowledged a bug with spaces in filenames/pathnames but still nowhere can I find the workaround. How does one use a pathname containing spaces? Hobocopy has never worked for me because of this, I'm surprised no one else has seen this as a stumbling block.

  140. @Franck: Yes, that was a bug for a long time. I don't remember fixing it, but I can no longer reproduce it. If you're still having the problem, post over at the group at and we'll get you sorted out. If that bug still exists, it would be something I'd want to fix immediately.