Why is OOBE running on every boot of a sysprep`d virtual machine

sysprepvirtualboxwindows-server-2008-r2

In an attempt to minimize the disk space used by a bunch of Windows VMs I'm about to work with, I've tried to create a base image in the hope of using differencing disks. I'm nearly there but OOBE keeps running every time I boot a VM and I have to configure the language and admin password. How can I stop OOBE running on boot?

Here's what I've done so far:

  1. Create a VirtualBox VM with a 60GB expanding disk. 2GB RAM, 1CPU.
  2. Install Windows Server 2008 R2 and patch the OS using Windows Update.
  3. Run sysprep ticking the generalize option and shutting down the OS.
  4. Remove the VM from VirtualBox Manager but keep the files.
  5. Attach the virtual disk (a .vdi file) from the VM created in #1.
  6. Modify the disk in Virtual Media Manager setting it as Immutable.
  7. Create a new VM selecting the disk from #6 as the main hard disk.
  8. Boot the new VM from #7.
  9. OOBE runs. Set the language, password and other prefs.
  10. Shutdown the VM.
  11. Start the VM from VirtualBox Manager.
  12. OOBE runs again.

Each VM that uses the Immutable disk get's a .vid file in it's snapshots directory, and changes made to the VM are persisted between sessions, that is, programs I install are still installed after a reboot, but OOBE runs every time. How can I stop it?

Best Answer

(I looked at the Vbox docs, so maybe I cheated...)

"6". Modify the disk in Virtual Media Manager setting it as Immutable.

Your differencing disks by default will always reset themselves, so you'll be back at the beginning on a reboot unless you change the flag for the differencing disks.

Every differencing disk has got an autoreset flag which, by default, is set to on. To set it to off you have to use the VBoxManage command:

$ VBoxManage modifyhd | \ --autoreset off

Your differencing disk won't "forget" any more the changes it records.

However, what you really want to do is use the multi-attach disk choice instead:

An image in multiattach mode can be attached to more than one virtual machine at the same time, even if these machines are running simultaneously. For each virtual machine to which such an image is attached, a differencing image is created. As a result, data that is written to such a virtual disk by one machine is not seen by the other machines to which the image is attached; each machine creates its own write history of the multiattach image.

Technically, a “multiattach” image behaves identically to an “immutable” image except the differencing image is not reset every time the machine starts.