8

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>

6
  • 4
    What is the end goal of this, are you trying to reverse engineer an app? The reason I ask is without the reports on what is different, keeping a freeze dried state would be easy. Even seeing the changes may not be too hard, but not checking them into version control. I would just like more understanding on what you want to accomplish and maybe I could suggest a different approach. Sep 24, 2010 at 5:16
  • Agree with @Scott, I don't see this being very practical (or even possible, for that matter). More details as to what you are trying to accomplish would be great. Sep 24, 2010 at 7:11
  • 1
    +1 ... you're almost certainly going about this the wrong way. Sep 24, 2010 at 16:07
  • @Scott: my goal is to use version control for my Windows customizations. I have no idea why my question suggests reverse engineering to you. @Zac: I can't be going about this the wrong way, since I haven't made the first step. Sep 24, 2010 at 18:27
  • It just seemed like your goal was to do something on a system and then see what happened, vice setup a configuration that you can restore to later. If you did need to restore to a configuration later, I would use some virtual machine software to take snapshots. That won't tell you what happened but it would get you to the same spot again and again. If you want to see what an app does there are programs that make msi files by doing a diff of a system pre and post install. You can then look inside the msi and see what the app touched/changed. But none of these are "version control". Sep 24, 2010 at 23:31

7 Answers 7

9

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.

6
  • 1
    +1 I agree with that. I can't see the features of Disk-Imaging but I use DriveImage (runtime.org/driveimage-xml.htm) which allows you to backup the disk while using the system using reliable techniques. It also allows you to browse the files
    – Cristian T
    Sep 24, 2010 at 14:28
  • It might be simpler to use a VM and take snapshots, rather than use a disk-imaging product. That would be a lot simpler to migrate between machines if the hardware isn't identical. Sep 26, 2010 at 5:43
  • @harrymc: I'm sorry if my initial formulation wasn't clear the first time around (I suspect it took a unix background to understand what I meant), but I'm trying to back up my user configuration, not the system configuration. Sep 27, 2010 at 7:29
  • 1
    The answer would still be the same, unless you can narrow down pretty sharply the list of elements in the user configuration. There is no real "user configuration" area in Windows, unlike Linux dot directories. A user registry hive exists, but much user-info is scattered in other places and all over the disk in "Program Files", "Users" etc. You can't even monitor registry changes, because Windows itself modifies a hell of a lot of them while working. And every application invents its own rules. There is a reason why Linux is more efficient ...
    – harrymc
    Sep 27, 2010 at 8:00
  • As a Windows user, I would also have liked to have a mechanism such as you outline. Alas, it's quite impossible. You would need to trace every application and kind of change using Process Monitor, in order to find where the data is stored. This is an enormous project demanding a monstrous investment of time.
    – harrymc
    Sep 27, 2010 at 8:06
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.

2
+250

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.

3
  • Given that I don't care about HTML reports, what would Regshot do that Microsoft's reg.exe and Cygwin's regtool don't do? As for DocShield, what does it do that any version control software won't do better? Sep 28, 2010 at 19:45
  • Bounty awarded for Regshot. I don't think it's really what I want, but it's a good start that I might be able to build upon (especially given it's open source). Sep 30, 2010 at 21:37
  • I think mine was more what you are looking for...but not because I wanted the bounty just to let you know. Sep 30, 2010 at 23:14
1

It wouldn't be simple, but you could use Sysinternals Process Monitor to determine which files and registry settings were changed. You could then add the registry edits and updated files into a larger program that will make the changes for you. You could probably use Power Shell or something like AutoIt. Then check the resultant script into your vcs. I use a similar method for automating strange settings into logon scripts and custom Group Policy administration templates.

1
  • If I understand you correctly, you're basically proposing to keep only the diff induced by my changes, instead of the whole registry and Application Data content, right? How would I detect changes made when the monitor program is not running for some reason? Is there a reasonable way to extend the workflow to enable update operations (i.e., I've already done a checkout and want to apply a few more changes made on another machine)? Sep 28, 2010 at 19:42
1

I don't have a OS solution for you, but there is a paid possibility. What you could do, is to backup your drive using DriveImage XML

The backup format is XML. You can then save this xml file (diffs are also possible) to your favorite Version Control System.

As HarryMC has said, you can't really use this image to make changes to a new system, but you could definitely use the image on a new system with exactly the same hardware.

1

You can use ForensiT's profile management software to copy your whole profile with setting off of a windows box. Go here to check it out: User Profile Manager

2
  • I don't see how this program could help me: it looks like it's for deploying profiles to multiple machines, which is not my central concern (managing history). I can see that it might be a valuable tool for administrators, but I'm a user here. Oct 4, 2010 at 18:43
  • It provides you with the ability to backup your user profile and be able to restore it when you choose. Isnt that what your looking for? Oct 7, 2010 at 13:10
-2

It seems to me you are describing a database application where you track the registry keys and index them by a tag. Although I am not technical enough with registry keys to do this, in your example you want to search the database for Pink Desk top and get the instruction which will implement that change on a different computer. That is, if I understand your intentions

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .