ZCM 11 imaging megapost – part 2 (drivers)

windows 7 novell blog banner

As promised here’s the next post in the series for ZCM automated imaging. This one will cover how to create your driver \ software add-on images and how to use Powershell to run them automatically after imaging.

Installing Image Explorer

This part is nice and easy, on a 32-bit machine navigate to http://yourzcmserver/zenworks-setup then going to Imaging Tools and download \ run the file named something like novell-zenworks-zmgexplorer-11.2.2.12991.msi. If I remember correctly you also need Java installed.The MSI will extract to  the C:\Novell\ZENWorks\bin\preboot folder and from there double-click on zmgexp.bat to run the program.

The interface is pretty simple and apart from the usual New \ Save \ Open buttons the other ones are Add Files to image, Add Folder to image and Create Folder

To make life easy I prefer to build the correct folder structure on my management VM then import the whole thing into Image Explorer using the Add Folder button. You can just as easily create the folder structure within Image Explorer and import files individually but I like to save myself clicks if I can help it 😉

Tip: if you capture a Windows 7 image using default settings you’ll actually get two partitions. The first is a 100MB recovery partition, followed by your actual image. If you leave the 100MB partition intact you’ll need to make sure your add-on image has its files placed in the 2nd partition or it won’t work. To do this go to Image > Create Partition

I place my package at the root of the hard drive so it’s easy to call from scripts, again set this up to suit your environment. Click the thumbnails below to enlarge.

Note the warning here when saving files using Image Explorer!

dpinst folder   dpinst partition

Driver folders

First step, create a folder somewhere on your management machine called DRIVERS. Our driver add-on image is going to include the drivers themselves in subfolders under the root. I like to use AUDIO, GRAPHICS, NIC and CHIPSET as my names but it’s all personal preference. I also tend to strip out unncessary exe files and drivers for the wrong OS platform e.g. x64 drivers for an x86 system but again your choice here.

DPInst

Having the drivers is great but we actually need a way of installing them. You can do this via sysprep but it’s a bit more fiddly to set up and not quite as easy to control \ change afterwards. For that reason I prefer to stick with the Novell-recommended method of using Microsoft’s DPInst utility to perform the installation. This method allows us force drivers so we know exactly which ones are being installed, plus we can write some status messages into a Powershell script so we know exactly what’s going on.

You can download DPInst as part of the Windows Driver Kit (WDK)

DPInst uses an XML file (DPInst.XML) to control exactly what it’s going to do when the exe is called. Command line switches are used to tell DPInst to run silently, information on both can be found in the links below

My current settings are listed below, using * in the search section saves you manually defining all the folders you want to search for driver files…

<?xml version=”1.0″ ?>

<dpinst>
 <legacymode/>
 <forceIfDriverIsNotBetter/>
 <quietinstall/>
 <suppressEulaPage/>
 <suppressAddRemovePrograms/>
 <search>
 <subDirectory>*</subDirectory>
 </search>
</dpinst>

Running DPInst with Powershell

If you followed the Novell Cool Solutions article to create your sysprep file you’ll have a section in there that runs a Powershell script towards the end of the process. In the example the author has 3 scripts that get called in sequence, one of which is the DPInst command.

For reference the script section is the code below. Note the use of the Diagnostics.Process and WaitForExit to ensure the command completes before moving on to the next part of the script. Also note the use of the comma to combine the command and parameters (the comma combines two variables with a space in between)

$OSArch = (Get-WMIObject Win32_OperatingSystem).OSArchitecture
$DPInstParams = "/q"
if ($OSArch -match "32-bit") { $DPInstCommand = "C:\SETUP\DPINST.exe" }
if ($OSArch -match "64-bit") { $DPInstCommand = "C:\SETUP\DPINST64.exe" }
$process = [Diagnostics.Process]::Start($DPInstCommand,$DPInstParams)
$process.WaitForExit()

Tip: if you follow the next guides on installing the Novell Client and ZCM agent chances are you’re going to need more than 3 scripts. In which case you’ll need to increase the Autologon count in your sysprep file to match the number of scripts you want to run.

Tip: run DPInst as early as you can in the series of scripts, this is important if you have machines with network cards that Windows 7 doesn’t natively include drivers for. Reason being if you use any scripts later on that need to look at the machine’s IP address or install programs that need network connectivity (ZCM Agent etc) they’re going to fall over if the network card isn’t active.

I also like to add some additional output while DPInst is running to tell the user that the process may take a while to finish. To do this use the Write-Host command to output text to the Powershell window e.g.

Write-Host "Running DPINST to check for additional devices..."
Write-Host "(this may take a long time, please wait)"

The next post will cover the Novell Client and ZCM Agent installation processes, again using Powershell

Advertisements

11 Responses to ZCM 11 imaging megapost – part 2 (drivers)

  1. dragon788 says:

    Hello again gshaw,
    If only you’d made this post a month or two ago you’d have saved me all sorts of trouble. I’ve probably been tracking pretty well parallel to your progress on our systems, though I started from behind since I was away from the IT world until the middle of December for something like 3 years, and then jumped right into a Zenworks environment that was rather poorly configured.

    One thing that caused me no end of trouble was actually the DPinst.xml file. Being rather out of touch from IT for 3 years made me forget things like file encoding and line endings (as I see you had trouble with as well). Apparently the DPinst.xml file MUST be in UTF8 encoding, and if you create/edit it in regular Notepad, it defaults to saving as ANSI, which causes a failure in the Generalize section of Sysprep, and presents a severe hazard to nearby inanimate objects.

    • gshaw0 says:

      Haha yup I’ve experienced the joys of XML encoding in the past, being paranoid I’m going to check mine tomorrow now (even though they’re working OK at present). Think I downloaded mine as a sample file so should be in the right format.

      Hopefully someone will find the info useful now it’s all collated in one place, think I’ve got about 20-30 boomarks from the Novell forums alone figuring out each piece of the puzzle as I’ve gone along.

  2. Stephen says:

    Only issue I had was with Mass Storage Devices, have you had to play with this yet. I’ve documented my solution into the Novell forums. Unsure if you have hit this hurdle yet and if this solution of dpinst works.

    • gshaw0 says:

      Fortunately no issues so far as all the systems I’ve imaged are Intel chipsets and Windows 7 has the generic Intel AHCI ones built in. Did you use DISM or something similar to inject additional drivers to your base image?

  3. Trey says:

    Thank you for this entire post and gathering all the information from around Cool Solutions and the forums to make a comprehensive guide. This has helped save me from the confusion of trying to connect everything together.

  4. Gershwin says:

    Hi GShaw, Thanks for this great post, but I am finding the “Add-On image + using DPinst + using a powershell script to do this” a little confusing.

    Take a look at your screenshots above and the description. You say windows will create 2 partitions, the 100MB and the actual Windows 7 partition, I get that. But then in your screenshot, you only have a 100MB Partition and some other partition which you are creating.

    I’ve got to the point where I’ve
    1. Made the unattend.xml file (testetd and working how I want)
    2. All updates, config and software installed in (crtl-shift-f3)audit mode (on vmware virtual machine).
    3. Placed normal batch scripts on %homedrive% which handles my other extra configs + installs novell client + zcm11 agent over 3 stages. A shortcut to the first script is placed in startup (I know this is could have been done with a runsynchronous command in sysprep – I prefer doing it the startup way).
    4. I’ve then run SYSPREP /generalize /oobe /shutdown /unattend:unattend.xml
    5. Taken an image via zenworks.

    Now I am at the stage where due to some of our machines having different hardware, I need to use DPinst to install drivers.

    When I open the finished image with the zcm image explorer, there are indeed 2 partitions, the 100MB partition as well as the partition that has windows installed. Your screenshots are confusing me at this point.

    Would it be possible to give me a slight walkthrough of what I need to do next?

    Thanks

  5. Gershwin says:

    Also, I have now figured out that I need to use the zenworks image explorer to create an empty add-on image and ensure that I have 2 partitions. I then need to ensure that I have all the necessary drivers (in appropriate folders) as well as DPinst.exe and DPInst.xml in a drivers folder on my tech machine, then upload the entire folder to the 2nd parition. Now I have copied your DPinst.xml above and also copied your powershell script above and made my own.

    How does the add-on image then get applied to the base image?

    • gshaw0 says:

      Hi Gershwin, glad you’re finding the info useful 🙂 Looks like you’ve figured out the first bit – the add-on image is “layered” on top of the base image and the reason you make the two partitions is so it matches what you’ve captured on your base.

      The next bit you’ve mentioned is how to apply drivers per machine – for more info and sample scripts click to head over to another one of my posts that describes the process in more detail but basically it works as follows:

      – use the zisview command to read the machine model from the BIOS
      – place the resulting string into a variable
      – use the img rp command to lay down the base image
      – use an if, then, else statement that goes along and checks the model string and if it equals any of your machines run a specific img rp command for your driver add-on image
      – reboot and then Windows boots up, runs sysprep and your DPInst script

      I didn’t use the ZCM automated imaging Bundles as we were moving over from Zen 7 so it was easier to run the process manually via a custom PXE menu, all in the post linked above… enjoy!

  6. Gershwin says:

    Hi GShaw,

    OK, great thanks for this. I have actually managed to get the DPInst.exe working as part of my initial batch scripts. I have basically made a single image for all of our machines and added the appropriate drivers onto the windows partition “%homedrive%\drivers\hardwaretype\drivertype” of the current sysprepped image.

    The add-on image using if, else statements will come later after I’ve wrapped my head around it but for now I’ve added all the drivers of all our different machine types into this folder and single image, then used DPInst to search through the underlying folders with “*” in the DPInst.xml file. This folder adds an extra 600MB to the image but that is fine for now.

    This works great, but now I have another question regarding the ZCM Agent installation which I will post on the appropriate page (part4).

    Once again thanks for this post.

  7. Pingback: A warning for those using the Novell Image Explorer | gshaw0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: