Windows 7 SteadyState solution simplified!
On my last Blog Post I described a procedure to implement a Windows 7 SteadyState by utilizing differencing VHD files and the "Boot from VHD" feature of Windows 7. It was great to see the enthusiastic response from the community and how much some of you desperately needed such a solution.
However the procedure to implement my solution had many drawbacks: It was difficult to implement all the steps as they required a LOT of manual work. For that same reason deploying the solution to more that 10 PCs was pretty much out of the question. Another drawback was that it required the use of WinPE to handle the VHD files.
I promised to implement a more straight-forward method by using the Microsoft Deployment Toolkit (MDT) to deploy and configure the OS. So here it is! The solution in this Blog Post has many advantages over the old one:
- It is straightforward. Just a simple reboot will get you to the initial SteadyState.
- It is less prone to errors and faster. By avoiding the use of WinPE we return to the initial SteadyState after a single reboot.
- It is easy to install. Just follow the instructions below. You should be up and running in less than 20 minutes (with most of the steps automated).
- It is easy to deploy on several machines. We create a bootable media (DVDR) and use that to automatically install everywhere. MDT can also be used to install over the network.
I urge everyone needing to implement a Windows 7 SteadyState scenario to give it a try (Internet Cafes, Kiosks, etc.). I believe that you will find the solution clean and effective. As usual I am eager to receive your feedback on how this solution can be improved further or to address any specific scenarios that you have in mind.
Windows 7 SteadyState Step-By-Step guide:
We will need one PC where the Windows Automated Installation Kit (WAIK) and the Microsoft Deployment Toolkit (MDT) will be installed. Both of these are free downloads from Microsoft. We will use these tools with AutoIt scripts to create a bootable ISO from which we will use to automatically install Windows 7 and the SteadyState solution.
Step 1: Install WAIK for Windows 7
Download the Windows Automated Installation Toolkit from here: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5753. Run the installation. Choose "Windows AIK Setup":
Run the setup wizard and accept the defaults.
Step 2: Install MDT 2010 Update 1
Download the Microsoft Deployment Toolkit from here: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=25175. Select either the x86 or the x64 version (depending on the OS you are currently running). Run the setup file and select the defaults on the installation wizard.
Note: This solution was tested with the x86 version of MDT.
Step 3: Download the Windows 7 SteadyState setup files
Download the package containing the Windows 7 SteadyState solution files here.
Create a folder (for example: C:\SteadyState) and unzip the Win7SteadyState.zip files there.
Step 4: Copy the Windows 7 media to the hard disk
Copy all the files from your Windows 7 DVD to the WIN7CD subfolder.
IMPORTANT NOTE (updated!): ONLY use Windows 7 Enterprise or Windows 7 Ultimate edition media. Other editions or multi-edition DVDs (which include all editions) will not work! You can get a 90-day trial edition of the Windows 7 Enterprise Edition here: http://technet.microsoft.com/en-us/evalcenter/cc442495
Step 5: Run the setup script
UPDATE: Before running "SETUP.exe" make sure that you have set the execution policy in Powershell correctly. Open Powershell (as an administrator) and execute the following command:
Answer "Y" to the Execution Policy Change question and close Powershell. Thanks goes to Brendan for pointing this out!
To automatically create our Windows 7 SteadyState installation ISO we will run the setup.exe script. This script (written in AutoIT) will configure MDT and prepare a bootable ISO which we will use to deploy the solution.
Run the script as a local administrator and wait for it to prepare your bootable ISO file which you will use to install the Windows 7 SteadyState solution to your PCs.
You should see several Powershell scripts executing while the image is prepared.
If you get the following message, click "This program installed correctly":
At the end you should see a Windows Explorer window with the ISO file:
Burn the ISO file to a DVDR.
Step 6: Boot from the SteadyState ISO
Boot with your newly created DVDR on the computer you want to install the Windows 7 SteadyState solution.
WARNING: This procedure will completely format your hard disk so make sure you are prepared for this!
The bootable ISO will:
- Install Windows 7 on a VHD file
- Create and configure the use of differencing disks
- Configure Windows Boot Manager
When your PC boots from the ISO you will have to select either the x86 or the x64 installation of Windows 7. Choose whatever version of Windows 7 you used during the creation of the ISO (in Step 4 above):
WARNING: Choosing the wrong OS version here will cause the installation to fail! If that happens simply restart the procedure.
After selecting the proper OS version the install procedure will start automatically. Allow plenty of time for the installation to complete (usually 15-30 minutes).
At the end of the procedure you should see a message that the "Operating System deployment completed successfully". Do not proceed further if you have not received this message.
Click “Finish”. Windows 7 installation (configured for SteadyState) is complete:
Step 7: Configure your initial Windows 7 SteadyState
Proceed to install and configure whatever you want to be part of your initial Windows 7 SteadyState (install Office or run Windows Update for example).
After you are done simply reboot the machine.
After reboot you are given two options during the start procedure:
The first option (Windows 7) runs your initial State where you can configure it to your liking. Whatever changes you make will be permanent after your next reboot.
The second option (SteadyState) runs the initial SteadyState but any changes you make on it will be discarded on the next reboot.
This is basically it! In case you want to make changes that need to reboot your OS (installing Windows 7 SP1 for example) then simply select the first option after the first reboot. This will ensure that your changes are persistent in your SteadyState.
You can automate further the installation (for example by automating the Microsoft Office installation or a 3rd party program) by modifying the MDT 2010 Task Sequence which was created by the setup script. For further guidance on how to work with MDT 2010 look here: http://technet.microsoft.com/en-us/solutionaccelerators/dd407791
Frequently Asked Questions:
How do I change the size of win7.vhd on the OSDisk?
Open the ZTIDiskpartVHD.wsf file in Notepad and look for the following line:
DiskPartWrite oExec, "Create vdisk file='c:\win7.vhd' MAXIMUM=30000 type=expandable"
We see here that we use an expandable VHD with a maximum size of 30000 MB (approximately 29 GBs). Edit the size to whatever you find more appropriate for your environment. Run SETUP.exe again to create a new ISO image with your change.
Can I use a bootable USB drive instead of an ISO?
Yes you can! Copy and paste all the files contained in the c:\DeploymentShare\Media\Content folder, to your USB disk. Make the USB disk bootable by running the command: bootsect /nt60 f: /force
The bootsect.exe utility is located in the Boot folder of your Windows 7 media. Replace f: with the drive letter of your USB disk.
I want to change the amount of seconds the boot screen is visible during boot or hide it altogether. How do I do that?
Edit the BootScriptSteadyState.au3 and change the following line:
RunWait('cmd /c bcdedit -timeout 5',"",@SW_HIDE)
The default is 5 seconds. A value of zero means that you will not get the boot menu at all.
Compile the script (you will need to download and install AutoIt to be able to do that). Run SETUP.exe again to create a new ISO image with your change or simply replace c:\windows\system\BootScriptSteadyState.exe of a current installation.
What does SETUP.exe do exactly?
SETUP.exe is a script written in AutoIt. You can see the source code by opening the SETUP.au3 file. To make any changes download and install AutoIT (it is free!). This will allow you to compile a new SETUP.exe and use that to further customize the solution.
Are there any system requirements for your solution? Do I need to pay any licensing fees to use it?
The system requirements are as follows:
For the PC where you create the ISO image: Windows 7 must be installed. Creating the ISO file requires at least 10 GB on the C: drive.
For the PCs where you will install the Windows 7 SteadyState solution: The PCs must be able to run Windows 7 (as defined by the Windows 7 System Requirements) with a hard disk of at least the amount of the Win7.vhd file when expanded to its maximum capacity (the default is 30 Gb but you can change it - see FAQ number 1) plus the size of your initial SteadyState (5 Gb for a bare minimum Windows 7 installation + whatever you install afterwards). The absolute minimum is 35 Gb but I would recommend using at least 50-60 Gb hard disks if not more. If you have smaller disks then lower the size of the initial VHD.
Regarding licensing: You only need to have a valid Windows 7 license for the PC where you install the SteadyState solution. WAIK and MDT are both free tools governed by their own licensees for use which you can read into each product's documentation.You are free to customize any of the files I have provided as part of the solution (source code, configuration files, etc.). However I would humbly ask that you provide a reference back to this webpage if you intent to publish your changes on the web or elsewhere.
MDT 2010 is capable of doing advanced deployments by using PXE or even integrating with SCCM for ZTI scenarios. Is your solution compatible with these capabilities?
Of course! SETUP.exe will fully configure your MDT 2010 installation and produce an ISO file to use for the installation. However you can customize the MDT 2010 installation to support any kind of deployment that best fits your environment including installing with PXE boot or by using a CDROM to simply connect your PC back to the MDT 2010 PC. See here for guidance on how to take advantage of the advanced deployment features that MDT 2010 offers.
I have frequent problems with BSODs and system crashes during boot. What could be the cause?
Make sure that you have enough free disk space on C:. If there is not enough free disk on C: to store the temporary state then you will get BSODs during boot. For estimates on free disk space see FAQ number 5. In case you are stuck in such a situation, either re-install the solution from the ISO file (by changing the size of your VHD file as described in FAQ number 1), or boot from your Windows 7 media, open a command prompt and delete any temp#######.vhd files you have found on your hard disks. Then reboot.
Will your solution work in an Active Directory environment?
I cannot see why not, but please have in mind that including a domain-joined PC in a SteadyState means that the AD Computer Account password will be reset on each boot. While this should not be a problem you should make sure that you have no issues with Group Policy being applied or authenticating to other resources in the domain (i.e. File Servers).
I get several errors in the Boot Manager about improper configuration. What might be wrong?
You probably restarted the PC while being in the configurable SteadyState by just turning the power off. This means that the differencing VHD cannot use the originating VHD to boot. If you are in this scenario simply boot to whichever boot option is available, reboot normally, go to the persistent changes state and reboot normally again. You can now continue to use the temporary state as you normally would.
Microsoft Infrastructure Consultant