Using Vista Previous Versions to Restore Files You Thought You'd Lost

I'm a big fan of being productive by not losing work. I don't care how optimized your system and development tools are; if you have to do work to get back to where you were at a half hour ago, you're going backwards. I've previously written about using TimeSnapper as screen recorder so I can retrace my steps to anything that's happened on my screen in the past month. TimeSnapper continues to be one of the first tools I install on a new system.

But there are some things that slip through the cracks. For instance, what happens if a file gets corrupted, or if I accidentally save some new modifications over an old file which was previously working? We've got the recycle bin for accidentally deleted files, but until now if a file was overwritten the original version was just gone.

That's when I turn to a sadly ignored but very cool feature in Windows Vista: Previous Versions (a.k.a. Shadow Copy). If you're running Vista Ultimate or Business editions, you've got Shadow Copy and can right click any file or folder to look for a previous version, as pictured below. Previous Versions is like an informal source control system for files you hadn't thought to back up.

Note: If you're running another version of Windows Vista that doesn't have Shadow Copy, don't lose heart - there are still ways to take advantage of this feature. We'll get to those in a bit.Vista Previous Versions

So if an important file like applicationHost.config is corrupted, the first thing I do is check for a previous version. In the above case, I had 11 backup copies of the folder in three months, so it's likely that I could find a good copy. I could either just restore (the file or the entire folder) or I wanted to be a little more sure of things I could open or copy the files in question and compare them with the current version. It's easy to just make a copy of the folder at a point in time and merge it with the current version using a merge tool (e.g WinMerge).

Not Just For Klutzes

I'm often using Previous Versions to recover files I didn't personally overwrite. For example:

  • My team was installing software on demo machines late at night before a conference when some application specific files got overwritten. We were looking at having to reinstall a lot of software, which would have taken an hour or more. I recommended that we check for a previous version of the folder. Sure enough, it was there, and we were back in business within two minutes.
  • I rely on Firefox's session restore pretty heavily. I've had my session store get corrupted a few times over the past year. Each time, I've been able to recover it by restoring the following file: "C:\Users\[Username]\AppData\Roaming\Mozilla\Firefox\Profiles\[random].default\sessionstore.js"
  • I make incorrect assumptions on what Visual Studio Team System will do with my files based on my background using Subversion. I think the basic problem is that I'll make changes to files outside of Visual Studio, so Team System doesn't know I've made changes and overwrites without prompting the next time I do a checkout. I think I've learned my lessons here, but there have been several times this past year that I've recovered overwritten changes by restoring a Previous Version
  • Occasionally I'll shift-delete a bunch of files (shift-delete destroys the files immediately, bypassing the recycle bin), then realize I needed the file for some reason. Yeah, that's a klutz move. Previous Versions works there, too.

Hey, this sounds like System Restore

You're right! Previous Versions is related to System Restore since Windows uses the Volume Shadow copy service to create backups used by both System Restore and Previous Versions. System Restore is used for operating system specific files, while Previous Versions is used for everything else. System Restore was actually included in Windows ME, but don't hold that against it. System Restore is a great way to save a good computer gone bad.

I was first shown this when my wife's cousin and his friends - a bunch of college kids - stayed at our house a few years ago. I'd thoroughly borked our family's Media Center 2004 computer and was anticipating weeks of late nights trying to find stable drivers, when I came home from work to find the spring break kids watching TV. When I asked how they'd fixed the computer, they gave me the same look I probably give my parents when they lose e-mail attachments and said, "We just restored to a few days ago." Uh, right, I was planning to do that... Truth is, I'd bought the line the hipsters were selling me and had ignored System Restore. But in this case, it was exactly the right answer - rather than spend a week trying to manually restore my system to the way it had been the day before, they spent 10 minutes restoring the files and made it in time for Wapner.

What's Not To Like?

I've had discussions with friends who continue to dismiss the Previous Versions feature, and recommend turning it off. I don't think any of the arguments make sense, especially when you've lost a file you need. Here's a brief rundown on the pro's and con's:

Volume Shadow Copy performance impact

It's minimal, because it usually only runs when your machine is idle. System upgrades or software installation can request a restore point be created, which could take a few seconds. Bottom line - I haven't seen any facts behind the urban legend that Previous Versions or System Restore actually affect system performance in a negative way. I know that, like Raymond Chen, when I find the occasional use for them, they save me days of work. That seems like a pretty solid bet.

Volume Shadow Copy uses up disk space

By default, Vista uses 15% of the drive or 30% of the free space (whichever is less). That might be an issue if disk space wasn't so cheap as to be essentially free. But even if you're stuck on a small drive, you can modify the space Windows uses for System Restore with a simple registry tweak.

It's only included in Vista Business and Vista Ultimate

That's a bit of a a setback. Vista's got way too many versions, and if yours isn't Business or Ultimate, you've got a lousy deal in the Volume Shadow Copy area. That's because Vista still ships with the Volume Shadow Copy service enabled, but without a user interface to access it. So it's filling up 15% of your drive with files you can't access, which is less than optimal.

But we're not going to let a roadblock like that stop us, are we? Those files are there, and we're totally going to get them.

Option One - Shadow Explorer

Shadow Explorer is a free program which provides a user interface to your Previous Version files. It's not pretty, but we want our file pretty bad so we'll let it slide.

Shadow Explorer

Option Two - Show the files in Explorer with two Console Commands

Probably the quickest solution is to use some command-line trickery to make the Volume Shadow copies show up in Explorer. Adi Oltean wrote a nice post on this a bit ago - I'll summarize the steps, but you should really read his post to understand what he's doing. While the actual commands may look a bit scary, it's actually incredibly easy. There are just three steps:

  1. From an elevated command prompt, run the following: vssadmin list shadows |more
  2. Find the shadow copy set with the creation date you want and copy the Shadow Copy Volume line from set, which should look like this: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy10
  3. Create a symbolic to the the above path, with the following command (substituting in the correct info): mklink /d c:\shadowcopy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy10\

Pay attention to that last line! You've got to get the /d switch (to create a directory link) and you need to get that trailing backslash. But, you should be able to do the above three steps in about a minute, at which point you can browse through the shadow copy via command-line or the Windows Explorer.

Shadow Copy Symlink

This all works because the files were always stored on your hard drive, they just weren't visible because they weren't associated with a drive letter. Creating a symbolic link takes care of that. When you're done, just delete the folder in Explorer and the link is destroyed.

Option Three - Upgrade to Vista Business or Ultimate

You can use Vista Anytime Upgrade to upgrade to a version of Vista which includes the Previous Versions user interface. Remember that Vista's been making these file snapshots since you installed it, it just hasn't provided you a user interface to get to them. Upgrading will take care of that, and if you've got the budget or really need the files, it might be worth the $159 to $199 (depending on your current version) to just get to Ultimate.

There are three ways to look at this:

  1. How thoughtful of Vista to make shadow copies for me in all versions of Vista, so if I upgrade I'll have a backup history!
  2. Data recovery is a lame feature to use as an upsell - it should have been in all versions.
  3. This is "data blackmail" since someone who's lost a file is kind of being extorted into upgrading to get the files back.

Take your pick. I think I wind up on the second one - the Previous Versions UI should be in all versions. But again, this argument is academic when you've lost a file and want it back.

18 Comments

  • > Team System doesn't know I've made changes and overwrites without prompting the next time I do a checkout

    Impossible; Team System clients never overwrite files that are marked writable. Do you have repro steps?

    Visual Studio might be doing god knows what, I suppose, but writable files are sacrosanct.

  • Thanks for the comprehensive and clearly written post -- good stuff to know

  • OMG I love you I love you I love you!!!!! You really saved my life on this one. Thanks a million!

  • It works because reputable writers make links to things ,

  • Thanks for tips and article.

  • Kudos to you!
    Nice post, concise and to the point. It is nice to know that vista is nicer than its reputation makes it up to be(I am a MacOS and Xp user). And Shadow explorer is a nice piece of software.
    Thanks for the help
    RC

  • :) great article for vista.. But vista very hard :(

  • At last Vista has added a feature that was in,
    e.g. VMS in the 1980's! Seriously, though,
    the article was very helpful and Shadow Explorer worked like a charm to recover a file
    that Page Breeze Pro overwrote with an empty file. Saved me a lot of work.

  • Shadow Explorer saved my butt. Many thanks to the author on this. I had no idea Vista Home Premium was running Shadow in the background and I'm damn happy it was today. Thanks again!

  • I got into a problem where I needed to get a file that was in the Offline Files cache ($windowsdir$\CSC) which was in a shadow copy.
    The trouble was, I couldn't copy the CSC file because I didn't have permissions, and I couldn't take permissions because a shadow copy is read only.

    I eventually worked out that I could use the above instructions (part 2) to link the shadow copy as a symlink, and then use ROBOCOPY in /B[ackup] mode to copy the files to another location where I could take ownership of them, and copy them into the user's home directory.

  • Hi, thanks so much for this post!

    I had overwritten a file and I tried to recover a previous version of it with ShadowExplorer since I only have Vista Home Premium. I was glad to retrieve part of my file, but ShadowExplorer's problem is probably that it didn't have the most recent (or even earliest) date available for that particular file.

    So now I'm going to try Console Commands to see if that will get me the most recent version of the file.

  • I tried doing the Console Commands, but just like my system restore, it can only go back 3 weeks ago.. I was looking for a file that was modified a day or two ago before today. Can anyone help me find more specific dates of a previous file version rather than general dates from system restore? Thanks.

  • Youre so cool! I dont suppose Ive read anything like this
    before. So good to search out any individual with some unique
    ideas on this subject. realy thanks for starting this up.
    this web site is something that is needed on the internet,
    someone with a bit of originality. useful job for
    bringing one thing new to the internet!

  • Write more, thats all I have to say. Literally, it seems as though
    you relied on the video to make your point. You clearly know what youre talking about, why waste your intelligence on just posting videos to your weblog when you could be giving us something informative to read?

  • At this time I am going to do my breakfast, later than having my breakfast coming over again to read additional news.

  • Thanks for sharing your thoughts. I really appreciate
    your efforts and I am waiting for your next write ups thanks once
    again.

  • Hey this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you have
    to manually code with HTML. I'm starting a blog soon but have no coding experience so I wanted to get guidance from someone with experience. Any help would be enormously appreciated!

  • I have windows 7 starter edition, and i overwrite an important file yesterday, i try every thing to recover and nothing, so i find shadow explorer, i run it on the same manchine and see nothing, but then extract the HD and added to another Pc and try shadowexplorer again, its see a copy of yerterday for a lot of files and folder but no one of any user profile, only public profile, i dont know why but can be maybe a problem of rights? and why inthe original PC does not work?
    Thanks and sorry about my english

Comments have been disabled for this content.