<

Windows PE/Imagex imaging

Published on
8,691 Points
2,691 Views
Last Modified:
Approved
Imaging the new M4500 Laptops
Automated Installation Kit,imagex,M4500,Microsoft,sysprep,Windows,Windows 7

The new M4500 laptops are in, and they are very sweet.  Lots of power!  Of course they come with none of our standard software so we needed to come up with an image.  I knew that windows 7 imaging was different than previous versions, MS had done a lot of work to make the process as clean as possible.  But that doesn’t mean it’s easy, in fact it’s really really hard.  You end up using a ton of different tools and there’s always multiple ways to accomplish any given task.  What follows is the steps I took to get it to work.

I started off with a laptop fresh out of the box.  I booted it up and ran through the setup process.  This included picking a username and doing some basic time zone selection stuff.  Then I started to install all the software that the base image is supposed to have.  That took a lot of time, but it wasn’t too bad, the biggest gotcha was trying to find the appropriate version of Office to install.

At this point I had a computer setup as I wanted it, and just needed to figure out how to copy it to the other laptops.  I came across a page at MSDN () that generally described what I was trying to do .  http://technet.microsoft.com/en-us/library/dd744287(WS.10).aspx

The first thing I picked up from this is there is a new kind of recovery/sys admin console called windows PE.  This is  a small stripped down windows that allows you to run applications, generally to capture and apply images to disk partitions.  This can be created by using a toolkit called the Windows Automated installation Kit (or AIK) (which i’ve placed the installer at \\10.0.0.141\software\Microsoft\AIK).  

The process is pretty simple, the only FYI is that i used the x86 architecture (you can use the amd64 if you want, the ia64 is for itanium based computers so stay away from that)  I decided to put everything on a flash drive instead of making a CD.  The steps for this are @ http://technet.microsoft.com/en-us/library/dd744530(WS.10).aspx

Once I had my PE flash drive ready I knew I needed somewhere to put the image. I figured it’d be ~20gigs (it turned out to be closer to 10) so I figured throw it up on the network.  Well, from another M4500 install I did I knew that the wired and wireless NICs aren’t in the default driver packs.  

Turns out that Windows PE has this awesome tool called drvload that takes an inf file and installs the driver for your hardware.  It’s documented @ http://technet.microsoft.com/en-us/library/dd744511(WS.10).aspx.  Further, Dell has a huge CAB file you can download for PE environments for the M4500’s.  I put this CAB file at \\10.0.0.141\software\Drivers\M4500\Dell-WinPE-Drivers-A02.CAB .

But after thinking about it I determined this was going to be slower than just using a USB drive.  I figured as long as Win PE can recognize USB drives i’d just go that way, and guess what, it does!  Very simply I may add, just plug it in and it mounts the USB drive!

At some point Eric (a colleague) pointed me to a set of helper tools @ http://blog.brianleejackson.com/winpe-3-0-boot-environment-scripts, I threw the contents on the flash drive as well.  the only tool I ended up using was gimagex which is just a GUI for imagex (which we’ll talk about later).

So reading through the walk through the next thing was to get my reference image (the laptop with stuff installed) ready for capture.  I followed the documentation @ http://technet.microsoft.com/en-us/library/dd799291(WS.10).aspx which really just steps your through the sysprep tool followed by the imagex tool.

This is where it really started to get complicated, & I had to rely on Eric for a lot of info.  It turns out that there’s different “Modes” of windows, in general they are :
windowsPE – when you run windows setup
offlineServicing – ignore it
generalize – when you run sysprep with /generalize and reboot
specialize – when an image that has been generalized is first booted
auditSystem – When you use sysprep with /audit and reboot, this mode runs before logon
auditUser – when you logon after auditSystem mode
oobeSystem – when you take your laptop out of the box and boot it up, or when you run sysprep with /oobe switch.  this is the short setup wizard you always get.
The audit stuff is what’s most interesting.  This lets you generalize a system so it can be deployed to many machines, but not go straight to configuration. Instead the computer boots up in a special mode that lets you check stuff out without making permanent changes. No account or domains are created, etc.  

The idea is to let all the drivers install (cause this takes like 10 minutes) and verify the computer boots, maybe add some files and clean some stuff up that isn’t right in your image, then you use sysprep to go from audit to oobe.  You capture the image prior to booting up in audit mode, thus you can test each PC.

Because I needed to put a 35 GB VMware image on each laptop I decided to go with audit mode. This way I could copy the file over after imaging the computer, thus I wouldn’t have to include the file as part of the image (making the image huge, when it really wasn’t worth it), and I wouldn’t have to logon to each machine either!

The next tricky thing about sysprep is the answers file.  This is an xml file you can supply to sysprep that enables a ton of VERY advanced stuff.  It does this by turning these features on in the setup wizard that appears in OOBE mode.  thus sysprep compiles the answer file and isntalls it on the machine so that your desires are fulfilled in OOBE mode.  

Some of the stuff you can do is set an administrator’s password, automatically join a domain, run arbitrry scripts, enable auto logon, set language, skip setup pages, etc.  It’s really insane, you can even create a totally silent windows7 install (if you have certain things, like a volume license key). in general you need to browse the list of available options and use F1 help to really understand what each does.  I ended up using a lot of the settings mentioned in these two articles:

    http://blog.brianleejackson.com/sysprep-a-windows-7-machine-–-start-to-finish-v2
    http://technet.microsoft.com/en-us/library/dd744509(WS.10).aspx

I also followed some best practices as defined @ http://technet.microsoft.com/en-us/library/dd744516(WS.10).aspx

So how do you create an answers file?  Well that’s another tool that’s part of the AIK called System Image Manager (terrible name).  This is a GUI app.  I didn’t exactly follow the steps at http://technet.microsoft.com/en-us/library/dd744509(WS.10).aspx, instead of using the install.wim image, I used the  "\sources\install_Windows 7 PROFESSIONAL.clg file (basically skipped a step) on a windows 7 install disk I had.  In the bottom left are all the options, and you add them to the modes of the answers file in the top middle pane. This is where F1 help comes in, just highlight any “component” or option and hit F1 to get a ton of info on what that setting does.

In the end the only thing of significance I did was set the administrators password and enabled auto-logon to the administrator account.  I was kind of disappointed with my results here, and wanted to do the following things:
Automatically Join the Domain – To do this you have to supply a fixed set of domain credentials (the setup won’t prompt), i didn’t have any i was willing to put in an XML file so i skipped this)

Re-prompt for the windows key since each laptop has it’s own license – you can set a volume key via a specific setting, but for some reason on these dells even when i said prompt for key = showalways it STILL didn’t show. I could not figure this out.  According to everything i read, sysprep is supposed to remove the keys and prompt you for them again.

Skip creation of a use during OOBE setup – This was soooo annoying, in fact the only reason I setup admin autologon was so that i wouldn’t have to create an account, but I could not make this work for the life of me.
 
I finally found an article on MSDN @ http://technet.microsoft.com/en-us/library/dd349350(WS.10).aspx that said the following:

Help update: Suppressing the user accounts-creation page in Windows Welcome

The user accounts-creation page in Windows Welcome is suppressed if a user or a group is added to a local security group. Add a user or a group to a local security group by doing one of the following:

    Create a local user.
    Add a domain user to a local security group with the Microsoft-Windows-Shell-Setup UserAccounts unattended installation setting.

To suppress the user accounts-creation page in Windows Welcome, without creating a local user, use one of the following workarounds:

    Workaround 1

    If the computer is already joined to a domain, use the following XML example to add the Domain Users security group to the Local Users security group.

    <DomainAccounts>
     <DomainAccountList wcm:action="add">
      <DomainAccount wcm:action="add">
      <Group>Users</Group>
      <Name>Domain Users</Name>
      </DomainAccount>
      <Domain>FabrikamDomain</Domain>
      </DomainAccountList>
    </DomainAccounts>

Because joining a domain automatically adds the Domain Users security group to the Local Users security group, the DomainAccountscommand does not affect the membership of the Local Users group. However, using this XML example to join a domain will also suppress the user accounts-creation page in Windows Welcome.

    Workaround 2

    Use the Sysprep/Quit command to set the following registry value to 1:

    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OOBE\UnattendCreatedUser

Workaround 1 wasn’t valid for me, and I have no idea what workaround 2 even means. I tried running sysprep /quit, but it certainly didn’t do anything…  In the end using the answers file did very little good, and I think I should have just skipped using it.

All I had to do was run sysprep. I copied my answers file over as answers.xml to the system32\sysprep (where sysprep lives always in windows 7) directory and ran the following command:

    sysprep /generalize /audit /shutdown /unattended:”c:\windows\system32\sysprep\answers.xml”

That took about 3 minutes to run, and then the computer shut down. One final note.  When you run sysprep /generalize it clears all the active drivers.  The actually inf and sys files aren’t deleted, they are still there, it’s just they aren’t active.  So when you reboot, windows will go through it’s normal scan for plug & play software and will find all the drivers for you and install them.  There’s a way to make it so sysprep doesn’t deactive drivers, and thus it doesn’t take as much time for you system to boot. You only want to do this if the exact same hardware is in use, which in our case it was…however I was scared and didn’t try this setting.

Next up was capturing the reference image.  I popped in my USB Win PE boot disk and started up the laptop. I hit F12 fast so that I could choose to boot the USB drive instead of the HD (on some laptops I just changed the boot order but this made them freak whenever a usb drive was plugged in that wasn’t a bootable disk, so I switched it back). Win PE came up, it’s just a command line.  It’s running on drive X:.  The USB key was on drive F: so I switched over there, and ran the gimagex utility that I downloaded from the website previously.  

This utility is pretty self explanatory, all I did was plug in the big external drive (which self mounted to G) and did a capture as outlined @ http://technet.microsoft.com/en-us/library/dd744320(WS.10).aspx  You end up with a WIM (windows image) file.

After that is applying the image.  this is done by booting up the target machine in Win PE and using imagex to apply your wim file.  This isn’t the only way.  You can actually rename your wim file as install.wim and replace the existing install.wim file on a widows installation DVD, and boom, you now have an install DVD for your image.  There’s a little bit more to it than that, so I didn’t opt to go this route, but it might be the better choice in the long run.

Anyways, prior to applying the image, I actually formatted the drive by running the following commands (it was the same for all of my runs cause the drives were partioned the same, but for other installs it’ll be different and you don’t want to format the wrong partition so be careful!)

    diskpart

    select disk 1

    select partition 3

    format quick FS=NTFS label=”Windows”

    exit

After this I just had to apply the image to that drive using gimagex (the apply tab). Once complete I exited windows PE by typing exit and the system restarted and entered initial setup.  One note here, I had to make sure I clicked cancel when it got ot 69% and the free fall sensor loaded up. One time I didn’t do this (went and got some food) and the image didn’t work right, it kept rebooting.

Once setup is done you get logged in as administrator in audit mode.  It was at this point I copied over that giant vmware image to the c:\vms directory.  This was a special step for the computers for the lab on 8-12-2010 and doesn’t need to be repeated.  After that I selected the shutdown option in the sysprep dialog that automatically shows up in audit mode and clicked OK.

My imaging was done!
0
Comment
Author:kardell2006
0 Comments

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Join & Write a Comment

This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month