Infrastructure Architecture Blog by Panos Macheras

Focusing on topics related to the Enterprise IT Infrastructure (Private Cloud, Management, Virtualization, Deployment, Security and Identity)

Windows 7 SteadyState solution simplified!

Windows 7 SteadyState solution simplified!

  • Comments 140
  • Likes

image

Download: Windows 7 SteadyState Version 1.0 Setup Files and Step-By-Step Guide!

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":

image

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.

image

Step 4: Copy the Windows 7 media to the hard disk

Copy all the files from your Windows 7 DVD to the WIN7CD subfolder.

image

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:

set-executionpolicy unrestricted

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.

image

image

If you get the following message, click "This program installed correctly":

image

At the end you should see a Windows Explorer window with the ISO file:

image

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):

image

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).

image

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.

image

Click “Finish”. Windows 7 installation (configured for SteadyState) is complete:

image

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:

image

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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).
  9. 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.

A special thanks goes to The Deployment Guys for automating the deployment of Windows 7 to a VHD file. You can find their solution here.

Panos Macheras
Microsoft Infrastructure Consultant

.

Comments
  • Panos, First - great stuff, a really straight forward guide! This is my first search for SteadyState since we implemented SCT v1 then WSS v2.0 & v2.5 on XP in our cafe nearly 3 years ago! It's given me great hope for a simple, yet robust Win7 solution!

    You mention in Q5 & Q7 a reference to FAQ#1 & #5 re: VHD maximum size - but don't provide a link to it - not being a follower of your blog I don't know whether this is a FAQ you maintain somewhere, or whether it's a FAQ off one of the other links. After a few quick excursions to these other pages, I've still not found this elusive FAQ list.

    We have gaming PCs which have over 400GB of apps/games, so obviously need to ensure that the VHD solution will cope.

    Could you update your doc to give active links to the FAQ sections mentioned.

    Many thanks

    Steve

  • Hi Steve,

    Thanks for trying out my Win7 SteadyState solution.

    FAQ#1 and #5 are from that very same list! So FAQ#1 (for example) is the "How do I change the size of win7.vhd on the OSDisk? " question answered just above. The same for FAQ#5: It is item number 5 in this very list (about System Requirements). No need to look elsewhere.

    For a 500 GB VHD, for example, you will need to open ZTIDiskpartVHD.wsf  and modify the following line:

    DiskPartWrite oExec, "Create vdisk file='c:\win7.vhd' MAXIMUM=30000 type=expandable"

    to:

    DiskPartWrite oExec, "Create vdisk file='c:\win7.vhd' MAXIMUM=500000 type=expandable"

    Good luck!

    Panos

  • Hi Panos,

    Well I feel a complete fool with that! Thankyou - I must admit I was looking for a more indepth FAQ about the limits and configs of VHD files. (do you have to allocate 50% blank space for the differential VHD etc)

    However, in order to rectify this, I thought I'd give you some quick feedback:

    Scenario:I created a clean host build Win7x86 system in a VM, using clean MSDN Win7x86UltimateSP1, installed WAIK, MDTx86, and SteadyState files all installed AND "set-executionpolicy unrestricted" - however, SETUP still getting "ImportOS.ps1 is not digitally signed" error, UNTIL I manually UNBLOCKED each and every file in the SteadyState prep dir by RH-Clicking, properties, UNBLOCK - then the SETUP script created an ISO. (if you can't see UNBLOCK within properties then it's already done)

    I then took this ISO into another clean VM, booted into x86 and began to build. Unfortunately within seconds, a big red error box, 1 error, 2 warnings about "end tag 'os' does not match the start tag 'variable'..." and then lots of debug dump.

    I thought I'd created the perfect clean build and test environments, but I still can't get further. The investigation continues.

  • Hi Steve,

    You can read an in-depth explanation of VHD files here: technet.microsoft.com/.../dd440865(WS.10).aspx.

    Thanks for sharing your experience on how to unblock the setup files. It seems that different installations require different things to make the scripts to work (for example on my VMs the only thing required is the set-executionpolicy command).

    Now, regarding the error you are getting during setup: This error usually means that an XML file is badly formatted. Please try to install the solution again on a brand new VM (if you didn't try that already). Sometimes when you get an error during setup you need to cleanup C: and the boot sector to make the bootable ISO working again so using a brand new VM will give you that.

    To investigate further please send me a complete screenshot of the error message you are getting by using the "Email Blog Author" in the "Options" pane on the top-right of the blog.

    Thanks,

    Panos.

  • Please also have a look at the updated note on Step 4 about which DVD media will work. You have to use either Windows 7 Ultimate or Windows 7 Enterprise (x64 or x86 version). Other editions or multi-editions (DVDs that include all editions together) will NOT work with the solution.

    Panos.

  • Why will other Windows editions (like Professional) not work?  It would be nice to know the reason. Thanks.

  • This is good stuff Panos. I do have some feedback and a question though. I to like Steve had to right click and unblock all the files downloaded in order for teh ISO to be created so just an FYI on that.

    Also I setup the install successfully on a USB drive and installed it on a brandnew machine. The install went fine and I got the the 'Operating system deployment was successful' at the end. While still booted in the 'Windows 7' side I only changed the screen resolution and then rebooted to the 'SteadyState' side. I then went through and deleted random folders and reg keys trying to see if a restart would fix all the issues that say a serious virus could cause. While after rebooting the computer I got an error message:

    Windows Boot Manager

    Windows Failed to start

    File: \Boot\BCD

    Status: 0xc0000034

    Info: An error occurred while attempting to read the boot config data.

    No matter  how many reboots it comes back. I have tried to do this with 2 different USB drives and 2 different computers with the same result.

    Any ideas why this would happen?

    Thanks,

    Kris

  • Hi this is just what i was looking for, here's my question how would i combine this steady state to an already prepared (all applications installed and configured) captured image, or computer.

    thanks

  • Hi Panos,

    This is really great work.  I am trying to get a test system configured but I am running into trouble when I go to make the ISO.  When I run the setup.exe, it does not complete and give me an AutoIT error reading:

    Line 37 (File: C:\SteadyState\Win7SteadyState1.0\SETUP.exe)

    Error Subscript used with non-Array variable

    I'm completely new to scripting so I was hoping you might be able to shed some light on this for me.  Thanks and keep up the great work!

    Omar M.

  • Hi Panos,

    Great work here!

    I am having a problem getting my ISO's created.  When I run setup.exe, I get the following error:

    Line 37 (File: C:\SteadyState\SteatdyWinSteadyState1.0\Setup.exe)

    Error: Subscript used with non-Array variable.

    Any help would be greatly appreciated!

  • Me to i get the same error and i dont know what to do , any help please ?

  • Hi Panos!

    This is a very good tutorial! Can I apply Your method to already installed PCs? I installed all computers in our schools lab, and I don't want to do all over again. I saw I can copy the existing system to a wim file, then I can apply that file to a vhd. Can I use that vhd file with your solution?

    Thanks in advance!

  • I suggest additional steps because I tested them:

    1) Many Win 7 ultimate DVDs contain remains of multi-editions although you cannot recognize them during the installation. To remove these remains, copy contents of Win 7 in the folder "Win7SteadyState1.0\WIN7CD" and then go to the folder "sources" to remove any clg file for any other edition and use the free open source "gimagex v. 2.0.17" to delete any image index for any other edition in "install.wim" without mounting.

    2) If you use Win 7 SP1, you need to install "WAIK supplement for Windows 7 SP1" as update to "WAIK". To install it, use the following steps: Emulate the iso file with the free open source emulator "WinCDEmu" and then if Waik is installed in C while D is the emulated disk for WAIK update, then run "Command Prompt" with "Run as administrator" on right click:

    a) xcopy D:\ "C:\Program Files\Windows AIK\Tools\PETools" /ERUY

    It must copy 134 files.

    b) xcopy D:\*winpe-dot3svc* "C:\Program Files\Windows AIK\Tools\PETools" /ERY

    It must copy 82 files.

    Enjoy.

  • Hi Panos, I'm testing this solution in a laptop, but with problems, sometimes when I change the wallpaper, and then restart, the wallpaper remains.I reinstall several times but the problem continues not always have the same behavior.

    Thanks

  • Hi Panos,

    I am getting the same error as Omar M. Any ideas? I am using a Win7wSP1 Ent media

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment