D-Day is Deployment Deadline Day. D-Day is also the day where I have had a record amount of trouble with my work computer, which has had to be restarted twice so far, firstly when Explorer crashed and wouldn’t restart, and then the second time Windows Live Writer wouldn’t load.

The process of getting from a reference image to deploying it to target machines is somewhat multi faceted. The process we use goes something like this:

  • The VM is shut down
  • A pre-sysprep backup of the VHD is made
  • The VM is booted
  • The VM is sysprepped (which can only be done live). At the end it shuts down again automatically.
  • A post-sysprep backup of the VHD is made.
  • The VHD is copied to another VM for offline servicing.
  • DISM is used to inject the drivers in offline servicing.
  • The VHD is copied to a network share to be deployed.

Bare metal deployment requires numerous steps and I have been in the process of creating and testing command or Diskpart scripts to automate as much as possible. A spare SD Card with Windows PE, scripts and tools loaded on it is set up to boot. Press the right key and the hardware boot menu comes up, then select the SD Card to boot from it. First task was a simple Diskpart script to create the three partitions needed on the HDD. So what was done on Wednesday afternoon was to boot every new PC to this card and run this script against Diskpart to initialise and format the disk. Then we had two days off for our annual staff retreat and I came in to work again today, Saturday.

Looking at the rest of what was needed I got started with a script that mapped a network driver letter to the share on the file server to allow the VHD to be copied over the network instead of an external HDD. This is all fine but the problem that showed up is that network drivers for this particular hardware platform are not included in Windows PE. Some time ago I wrote about learning how to inject drivers into Windows PE 2.0. As this is PE 3.0 the process is slightly different and is basically the same as injecting them into a Windows boot image: using DISM, first step is to use DISM to mount the boot.wim file (you don’t need to use ImageX to do this anymore). But as we don’t need or want the 1.4 GB of images that the VHD got, I just gave it the path to the network drivers folder and it injected two drivers only taking about 4 MB. After all changes are completed use DISM to commit changes to the WIM. Then this was copied over the existing boot.wim folder on the SD card and away we went. The Net Use command can be scripted to specify both username and password in the command line so that has been handled OK.

My next act was to attempt to fully script the process of running BCDBoot to copy the boot files and set up the BCD in the system partitition. This has run into snags because as soon as I tried to get Diskpart to set up the partition it threw various errors. In the script I got it to attach the VHD and assign it a drive letter. It objected to the select vol that it was given and apparently therefore could not assign the drive letter or do any of the other commands except detach the VDisk at the end. But when I ran diskpart with the script that attaches and assigns, the volume was there as expected at the end so I don’t see why all the other errors occurred. At this point I decided it was just easier to put all the scripts and tools onto Y drive (the network install share I had set up earlier) than mucking around with the SD card all the time, and this lets me make some boot CDs as well to speed things up for deployment.

Also in the deployment tools documentation for Windows 7 AIK is detailed instructions on how to install RE and customise it to specific requirements. A future project is to add the RE to the system partition so that a boot media isn’t needed to boot up the machines for reinstallation in future. I’ll look into it sometime when I get some free time.

Basically at this point all the machines are copying the image all at once and network performance seems to be extremely slow. This means the machines will probably take half the night to complete copying the 15 GB file. I’ll come back in the morning to finish working on them.