Version control for Windows configuration

How can I put my Windows personal configuration under version control?

Summary (details and examples follow):

  • Personal configuration (e.g. desktop preferences), not system configuration (e.g. drivers); should work without admin rights
  • Version control, not backups or disk imaging

Here are a few things I want to be able to do:

  • Commit the current state of my configuration to a repository, preferably with some granularity (if I've made two changes, I'd like to be able to commit one without commit the other).
  • Write a changelog entry whenever I commit, and see the list of changelog entries for each configuration file.
  • See the differences between the current state and a repository version.
  • Check out from my repository on a new Windows machine and reproduce my configuration (at least if the new machine has the same version of Windows).

<added1> I won't try to give a completely precise definition of “configuration”; I'm trying to cover all kinds of personal preferences (e.g., anything settable in the control panel without admin rights, shortcuts in my user-specific “Programs” menu, …). I don't want to include my documents or installed applications. </added1>

<added2> Note that I'm targetting my personal configuration, not the system configuration (that would be useful too, but it's not the purpose of this question). For instance I expect a solution to work without admin rights. </added1>

What I do in unix is to put (a selection of) my dot files under version control. Under Windows, I presume I should commit the registry and some files (which?) under Application Data. I would like something better than putting the whole registry file under version control (that's not enough granularity, and I fear locking issues). <added1> Ideally I would use wrappers or scripts with some common version control software (Bazaar, CVS, Darcs, Git, Mercurial, Subversion, …), but that's not an absolute requirement. </added1>

I currently need to work with Windows 2000 and Windows XP. Since this is for a work machine, payware won't do (open source would be ideal). I'm more comfortable with the command line than with GUIs.

<added1> Here's a sample workflow:

  • One day I decide I want my desktop background to be pink. So I make the change through the GUI. This modifies a line in a configuration file key in the registry. I then commit the change, to keep track of it.
  • Later I wonder why my desktop background is pink. So I search for “desktop color” in the changelog.
  • One day I need to use a new machine. So I check out from my configuration repository, and voilà, pink desktop.

Here are some things I'm not trying to do:

  • I am not trying to make backups. I want to be able to trace changes (by semantics, or at least syntax, not just by date), and to share information between machines (one repository, multiple checkouts).

  • I am not trying to replicate a Windows installation. I don't want to carry over hardware dependencies, installed applications, or documents.

</added1>


Solution 1:

As far as I know, Windows configuration is too scattered to reliably backup, among too many files and places in the registry.

It's impossible to backup the registry on one machine and restore it on another (or even on the same), because too many keys are too specific to the machine and because some keys are protected by Windows.

System Restore aims at keeping the machine state, but for your purpose it's unreliable, since it will decide itself which backups to delete to save space, and has other negative issues such as not being available in Windows 2000.

The only universal solution I can see is to image the system disk in its entirety and to restore it when required, using a disk-imaging product.

There are several disk-imaging products of very good quality, which I can recommend if you find that this solution interests you. Several of them keep a repository of images with descriptive. Although the best ones are commercial, the freeware ones are still very good.

Disk-imaging works best when the system drive doesn't contain user data.

Solution 2:

Coming from the server side of the fence, where you'd expect us to be very paranoid about config changes and where they came from, I can say that they don't really exist. Global config-tracking is an entirely manual process for the most part. It is possible to monitor (but not prevent) specific registry areas for changes, but I know of no free/cheap software packages that allow that and several very expensive ones (it's a much more complex problem than tracking file-info and then diffing two text files; thus, expensive).

This drives Unix admins batty. Kyle Brandt, sysadmin for StackOverflow Inc, was griping about this kind of thing a couple of weeks ago as he was staging up a new batch of Windows machines for StackExchange. The Linux/Windows crossover SysAdmins all commiserated with him. There simply is no Windows equivalent of putting /etc under VCS. There are some ugly kludges out there, such as disk imaging/snapshotting or only forcing config changes through Group Policies (and track changes to the GPOs manually), but nothing nearly as elegant.

Sorry.

Solution 3:

Personally I track changes in windows registry with Regshot. You take a snapshot prior to the change then a second one after making it. You can also get a nice HTML report of the changes. Of course you have to make sure only a few changes are done between the snapshots if you want to figure out what every change does. Regshot is an open source program.

If you are looking for file system changes tracking/backup the closest there is would probably be DocShield. You can track any folder with it though application data is probably your best guess for your personal preferences changes of most windows users profiles aware software. DocShield is free for home users. You can imitate what it does by using xcopy /d:{m-d-y} of the folders you need and then zip/7z the output.

Then add output from both backups to any version control repository with your remarks.