Thursday, November 18, 2010

Who needs Deep Freeze?

If you are an admin for large computing environments, say a college campus, you are likely familiar with a brilliant piece of software called Deep Freeze. This program allows you to "freeze" the state of a computer. From that moment on, any changes that occur on the machine will be forgotten when the computer reboots. It is some pretty sweet software, and a must have for environments that are prone to users who might mess things up.

The only problem with Deep Freeze is that it is expensive! I have recently discovered a way to use virtual hard disks (see my last post) to mimic the behavior of deep freeze. The trick is to use a parent/child relationship between vhd files. The parent vhd contains your base image. This is equivalent to the "frozen" computer with Deep Freeze. Now, make a child disk and boot to that. Anytime you want to revert to the parent vhd simply create a new child vhd based on the parent, and retarget your computer to point to the new child. Now reboot and you are back to normal. This has enormous potential to be scripted. I am currently working on a script that does this exact thing. I just couldn't wait to blog about it because this idea for maintaining a pristine lab image is just too cool.

how to create the child vhd file

diskpart
create vdisk file=c:\child.vhd parent=c:\parent.vhd
select vdisk file=c:\child.vhd
attach vdisk
select partition 1
assign letter=q
exit
rem Only do this line if you want to boot straight to the vhd without a boot menu
bcdedit /delete {default}
bcdboot q:\windows

now restart and you are done! To revert to the snapshot go through the same steps, but create a new child disk that is named something else. I have a script that generates a guid and uses that as the naming scheme for the current child disk. It seems like it will work for me, but I'm still working out the kinks.

This script assumes that windows has already been installed to c:\parent.vhd

No comments:

Post a Comment