Sunday, July 29, 2012

Windows World: zero touch install part 1.

The problem: Zero touch Windows OS install without using Microsoft' SCCM. 


*This was for Windows XP that was being re-deployed. This was not an upgrade to Windows 7. The XP image was also already created ahead of time with a completed answer file. The mission was to get it onto the target computers.


Part 1: PXE Boot. 

The first task I decided to tackle was how to get the machines to PXE boot remotely and without user intervention. With a short call and a few questions later I learned all the machines were HP and that made it simple. HP offers a package that exposes the BIOS settings to WMI. The code to change the boot setting is even provided to you by HP.

Here is the snippet of code doing the actual changing. It sets PXE boot to enable, then sets network boot to first boot choice.
1: Set objWMIService = GetObject("winmgmts:{impersonationlevel=impersonate}//./root/HP/InstrumentedBIOS")
2: Set colItems = objWMIService.ExecQuery("select * from HP_BIOSSettingInterface",,48)
3: For each objItem in colItems
4:     objItem.SetBiosSetting oReturn, "Network Service Boot", "Enable" ,"<kbd/>"
5:     if oReturn then
6:         wscript.echo "Network Service Boot" & " Can not be set, Error=" & ErrCode(oReturn)
7:         wscript.quit(oReturn )
8:     end if
9:     objItem.SetBiosSetting oReturn, "Boot Order", "Network Controller,Hard Drive,USB device,USB device,ATAPI CD-ROM Drive" ,"<kbd/>"
10:    if oReturn then
11:        wscript.echo "Boot Order" & " Can not be set, Error=" & ErrCode(oReturn)
12:        wscript.quit(oReturn )
13:    end if
14: Next

To get the code, or view more things to be done through the WMI: Read Hp's technical whitepaper with the full information.  


Since Windows Server 2008 was already in place, Windows Deployment Services could be used as the actually deployment piece. It's part of Server 2008 as a role you can install. I decided to build a small lab to understand and learn WDS. I also download the WAIK 3.x kit to mess with the Windows boot loaders. 


After an afternoon of playing around I was able to deploy the image to the HP machine. I could even run the script remotely changing the boot order, then reboot the machine and watch it PXE boot. Soon another problem reared it's head: After the machine is rebooted it's still set to PXE boot. We are now stuck in a perpetual boot loop. The HP utilities have to be installed to change BIOS settings.


Part 2 coming soon.
Decided to start a small blog to keep track of some of the things I've done. Also, rewriting important pieces of information helps me retain it longer.  I am a Systems Admin that has worked with Linux, Solaris Unix, NCR Unix,  and Windows Server 2003/8/R2. The first thing I will blog about is actually going to be a ZTI install I did in a windows environment. I consider Linux/Unix my strong point, but it was a task I opted to try and in the end the solution worked wonderfully. So, I thought I would share it first.

-spacehat.