Video Screencast Help
Symantec Appoints Michael A. Brown CEO. Learn more.

Install Drivers and Packages to Vista in WinPE

Created: 13 Nov 2007 • Updated: 07 Jul 2009 | 4 comments
Language Translations
CondorMan's picture
+3 3 Votes
Login to vote

Vista allows IT Administrators to install boot critical drivers and Windows Packages (Service Packs and Hotfixes) to Windows Vista while in WinPE Automation prior to booting into Vista for the first time. This takes a lot of heartache out of Hardware Independent Imaging and helps to ensure that the OS is patched against the latest security vulnerabilities before it is ever exposed to the Network/Internet.

Offline Driver and Package installation is done using PkgMgr.exe. To take advantage of this capability, you will need to do four things:

  1. Rebuild WinPE Boot Images
  2. Get the WAIK
  3. Create a Drivers directory and Windows Packages directory
  4. Create DS Jobs for offline driver and package installation

Rebuild WinPE Boot Images

You will need to change a configuration file to allow support for PkgMgr.exe and then re-build your WinPE Boot Images.

  1. Launch Notepad
  2. Open the file "C:\Program Files\Altiris\eXpress\Deployment Server\Bootwiz\platforms\WinPeX86.ini"
  3. Search for the line "%SRC%\%PATH_WINDIR%\system32\scecli.dll=-"
  4. Change it to ";%SRC%\%PATH_WINDIR%\system32\scecli.dll=- Required for PkgMgr.exe". Make sure to include the ";" at the beginning of the line.
  5. Save the file
  6. Open the file "C:\Program Files\Altiris\eXpress\Deployment Server\Bootwiz\platforms\WinPeX64.ini"
  7. Search for the line "%SRC%\%PATH_WINDIR%\system32\scecli.dll=-"
  8. Change it to ";%SRC%\%PATH_WINDIR%\system32\scecli.dll=- Required for PkgMgr.exe". Make sure to include the ";" at the beginning of the line.
  9. Save the file
  10. Rebuild all of your WinPE Boot Images
    1. If you use PXE, do the following:
      1. Open PXE Configuration
      2. Go to the Boot Menu tab.
      3. Under Regenerate Boot Images, enable WinPE and then click Regenerate.
    2. If you use Bootable CDs you will need to re-create and burn the CD iso files
    3. If you use Automation Partitions you will need to re-create the Automation Partition Installers.

Get the WAIK

Microsoft's Windows Automated Installation Kit (WAIK) is a set of tools designed to assist in deploying the Windows Vista OS. To use PkgMgr.exe, we will need to get the WAIK files and add them to the eXpress share of your Deployment Server.

  1. Download the WAIK file from here.
  2. The file you downloaded is an .img file. You can either burn it to a CD, or use Daemon Tools to mount the .img file to a virtual CD drive.
  3. Install the WAIK.
  4. Copy the folder "C:\Program Files\Windows AIK\Tools" to \\YourDeploymentServer\eXpress\WAIK\Tools
  5. PkgMgr.exe needs msxml6.dll and msxml6r.dll in order to run. If you have HII Tools 3.2.0 or greater installed, these files are already in the right place for you. Otherwise, you will need to place the 32-bit version of those .dll files in the "WAIK\Tools\Servicing" and "WAIK\Tools\x86\Servicing" folders, and place the 64-bit version of those .dll files in the "WAIK\Tools\amd64\Servicing" folder. You should be able to find the files in the C:\Windows\System32 folder of any computer with MSXML installed.

Create Drivers and Windows Packages Directories

You can use any location as the source to install Drivers and Packages from. I recommend using "%Altiris_Share%\Drivers\%#!computer@model_num%" for the Drivers directory and "%Altiris_Share%\Windows Packages\Vista\%PROCTYPE%" for the Packages directory.

After you have created the Driver directory, you will need to add your Drivers. If you are using HII Tools, you can skip this step since HII Tools automates the driver installation process. You will need to make sure that the drivers that you are placing in that directory or any subdirectory has an .inf file that is compatible with Windows Vista. You can test the driver by manually installing it to a computer from within Device Manager, by right-clicking the device and choosing install driver.

After you have created the Windows Package directory, you will need to add your Service Packs and Hotfixes. First, you will need to download the relevant .msu files for the hotfixes you want to install. You can search for and download all Microsoft Hotfixes from http://catalog.update.microsoft.com.

When you have the .msu files, you will need to extract the .cab files from them. I recommend using 7-zip, a very robust file archiver. You can download 7-Zip from http://www.7-zip.org. Right-click the .msu file and select "7-Zip>Extract Files..." and extract the files to a temporary location. You will have extracted 4 files, an .txt file, an .xml file, and two .cab files. Generally you will want the larger of the two .cab files and it will probably have the same name as the .txt and .xml files. Once you have identified the .cab file that contains the actual hotfix, copy that file to the root of your Windows Package directory, not in a subdirectory. You can now delete the .msu and temp files.

Create DS Jobs for Offline Driver and Package Installation

I have created a Hardware Independent Imaging Job Wizard (HIIJobWiz) to help you create a job to deploy a Windows Vista image and do an offline installation of Drivers and Windows Packages. If you have HII Tools installed, the HIIJobWiz is available from the Deployment Console under "Tools > HII Tools > HII Job Wizard". If you do not have HII Tools installed, you can download HIIJobWiz from http://www.symantec.com/connect/node/2831, and extract HIIJobWiz.exe to the root of your eXpress share (\\YourDeploymentServer\eXpress)

The HII Job Wizard is very self-explanatory, simply choose the type of job you want to create and fill out the information it asks. It will then create jobs to create and distribute hardware independent images.

If you do not have HII Tools installed, you will need to configure a few files and settings that HII Tools would have done for you. If you wish to do your Hardware Independent Imaging without installing HII Tools, make sure to read through the next section "Technical details about the jobs created by HIIJobWiz" for information about all of the files and settings that you will need to configure.

Technical Details About the Jobs Created by HIIJobWiz

The HII Job Wizard will create a job with three tasks in it. (1) Distribute the image, (2) Assign drive letters to new partitions, and (3) Install Drivers and Windows Packages. This section of the document will explain in detail what the tasks do.

Task 1: Distribute the Image

The Distribute Image task has some settings changed from the default that will allow us to run the Install Drivers and Windows Packages task while still in WinPE Automation without needing to reboot.

  1. Under "Additional Parameters", the parameter "-rescan" is specified. This tells WinPE to detect the newly deployed partitions so that we do not need to reboot.
  2. "Automatically perform configuration task after completing this imaging task" is disabled. When this option is enabled, Deployment Server forces the computer to boot into Production before it allows the other tasks to run. So, in order to run tasks 2 and 3, we must disable this option.

Task 2: Assign drive letters to new partitions

This task runs the command "diskpart /s .\HII\diskpart.txt". This will execute Microsoft's diskpart utility with a diskpart script file named .\HII\diskpart.txt. This file is included with HII Tools 3.2.0 and greater. If you do not have HII Tools installed, you will need to create the diskpart.txt that looks something like this (for each hard disk, starting at 0, you will select each partition, starting at 1, and assign it a drive letter):

select disk 0
select partition 1
assign
select partition 2
assign
...
select partition n
assign
select disk 1
select partition 1
assign
select partition 2
assign
...
select partition n
assign
...
select disk n
select partition 1
assign
select partition 2
assign
...
select partition n
assign

Task 3: Install Drivers and Windows Packages

  1. Set the path to the Drivers and Windows Packages into environment variable so that we can reference them later in the script.
    SET DriverSource=%Altiris_Share%\Drivers\%#!computer@model_num%
    SET PackageSource=%Altiris_Share%\Windows Packages\Vista\%PROCTYPE%
  2. Find the OS path and set the %ProductionDrive% and %ProductionRoot% variables so that we can reference those locations later in the script.
    call .\HII\FindOS.bat
    If you do not have HII Tools 3.2.0 or greater installed, you will need to create the FindOS.bat file with the following contents:

    REM Find the OS path and set the %ProductionDrive% and %ProductionRoot% variables
    REM Set the %ProductionDrive% variable
    echo.
    echo Finding Production Drive...
    echo. > %temp%\atrsprod.tag
    .\RDeploy\Windows\firm.exe COPY %temp%\atrsprod.tag PROD:\atrsprod.tag
    SET ProductionDrive=undiscovered
    SET TempAtrsProd=undiscovered
    SET TempWinProd=
    for %%i in (Z:,Y:,X:,W:,V:,U:,T:,S:,R:,Q:,P:,O:,N:,M:,L:,K:,J:,I:,H:,G:,F:,E:,D:,C:) do if not %%i == %ALTIRIS_SHARE% (if not %%i == %ALTIRIS_BOOTDISK% (if not %%i == %temp% (if exist %%i\atrsprod.tag set TempAtrsProd=%%i)))
    for %%i in (Z:,Y:,X:,W:,V:,U:,T:,S:,R:,Q:,P:,O:,N:,M:,L:,K:,J:,I:,H:,G:,F:,E:,D:,C:) do if not %%i == %ALTIRIS_SHARE% (if not %%i == %ALTIRIS_BOOTDISK% (if not %%i == %temp% (if exist %%i\bootmgr set TempWinProd=%TempWinProd%,%%i)))
    for %%i in (Z:,Y:,X:,W:,V:,U:,T:,S:,R:,Q:,P:,O:,N:,M:,L:,K:,J:,I:,H:,G:,F:,E:,D:,C:) do if not %%i == %ALTIRIS_SHARE% (if not %%i == %ALTIRIS_BOOTDISK% (if not %%i == %temp% (if exist %%i\boot.ini set TempWinProd=%TempWinProd%,%%i)))
    for %%i in (%TempWinProd%) do if %%i == %TempAtrsProd% set ProductionDrive=%%i
    if %ProductionDrive% == undiscovered (for %%i in (%TempWinProd%) do set ProductionDrive=%%i)
    if %ProductionDrive% == undiscovered (set ProductionDrive=%TempAtrsProd%)
    if %ProductionDrive% == undiscovered (set ProductionDrive=C:)
    set TempAtrsProd=
    set TempWinProd=
    echo Production Drive detected as %ProductionDrive%
    echo.
    .\RDeploy\Windows\firm.exe DELETE PROD:\atrsprod.tag
    
    REM Set the %ProductionRoot% variable
    echo Finding Production Root...
    for /D %%i in (%ProductionDrive%\*.*) do if exist "%%i\System32\kernel32.dll" set ProductionRoot=%%i
    echo Production Root detected as %ProductionRoot%
    
    
  3. Prepare an unattend.xml file for pkgmgr driver installation. PkgMgr requires an .xml file to tell it where the drivers are located. We create this file in a temporary location for PkgMgr to read.
    echo ^<?xml version="1.0" encoding="utf-8"?^>  >%temp%\unattend.xml
    echo ^<unattend xmlns="urn:schemas-microsoft-com:unattend"^> >>%temp%\unattend.xml
    echo     ^<settings pass="offlineServicing"^> >>%temp%\unattend.xml
    echo         ^<component name="Microsoft-Windows-PnpCustomizationsNonWinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^> >>%temp%\unattend.xml
    echo             ^<DriverPaths^> >>%temp%\unattend.xml
    echo                 ^<PathAndCredentials wcm:action="add" wcm:keyValue="0"^> >>%temp%\unattend.xml
    echo                     ^<Path^>%DriverSource%^</Path^> >>%temp%\unattend.xml
    echo                 ^</PathAndCredentials^> >>%temp%\unattend.xml
    echo             ^</DriverPaths^> >>%temp%\unattend.xml
    echo         ^</component^> >>%temp%\unattend.xml
    echo     ^</settings^> >>%temp%\unattend.xml
    echo     ^<cpi:offlineImage cpi:source="wim:c:/vistadist/install_x86.wim#Windows Vista BUSINESS" xmlns:cpi="urn:schemas-microsoft-com:cpi" /^> >>%temp%\unattend.xml
    echo ^</unattend^> >>%temp%\unattend.xml
    
    
  4. Install drivers using pkgmgr.exe and the temporary unattend.xml we created earlier
    .\WAIK\Tools\%PROCTYPE%\Servicing\pkgmgr.exe /o:"%ProductionDrive%;%ProductionRoot%" /n:"%temp%\unattend.xml" /s:%temp%\tempdrv /l:".\HII\Logs\%ID%_pkgmgr_drivers.log" /quiet
    
    
  5. For every .cab file in the Windows Package location, call PkgMgr.exe to install the hotfix.
    FOR %%i IN ("%PackageSource%\*.cab") DO (
        ECHO Installing %%i
        MKDIR %temp%\%%~ni
        .\WAIK\Tools\%PROCTYPE%\Servicing\pkgmgr.exe /o:"%ProductionDrive%;%ProductionRoot%" /ip /m:"%%i" /s:%temp%\%%~ni /l:".\HII\Logs\%ID%_pkgmgr_update_%%~ni.log" /quiet
        RMDIR /S /Q %temp%\%%~ni
    )
    
    

Comments 4 CommentsJump to latest comment

Dan Waksman's picture

I am using DS 6.9 and it required a lot les work after some tweaking. I created InstallDrivers.xml in the Deploy directory:

<?xml version="1.0" encoding="utf-8"?>  
<unattend xmlns="urn:schemas-microsoft-com:unattend"> 
    <settings pass="offlineServicing"> 
        <component name="Microsoft-Windows-PnpCustomizationsNonWinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
            <DriverPaths> 
                <PathAndCredentials wcm:action="add" wcm:keyValue="0"> 
                    <Path>\\%DSSERVER%\eXpress\Drivers\%#!computer@model_num%</Path> 
                </PathAndCredentials> 
            </DriverPaths> 
        </component> 
    </settings> 
    <cpi:offlineImage cpi:source="wim:c:/vistadist/install_x86.wim#Windows Vista BUSINESS" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> 
</unattend>

Then I used the following in a Run Script task:

REM Add Vista drivers offline

REM Token Replacement for InstallDrivers.xml file
REM ReplaceTokens .\Deploy\InstallDrivers.xml .\Deploy\temp\%COMPNAME%.xml

REM Run pkgmgr.exe
.\WAIK\Tools\%PROCTYPE%\Servicing\pkgmgr.exe /o:"c:\;c:\windows" /n:".\Deploy\temp\%COMPNAME%.xml" /l:".\Logs\%COMPNAME%_pkgmgr_drivers.log"
+2
Login to vote
CondorMan's picture

6.9 uses WinPE 2.1 and has the WAIK built-in, which simplifies the process a lot. Thanks for the info.

+1
Login to vote
Dan Waksman's picture

Sure does, but there's very little documentation for Vista deployments!

0
Login to vote
Sean.B's picture

There is some documentations out there, but a lot of reading on forums is where you get the most from. MS's documentation has a few errors in it and is a real pain to follow. Clear as mud too.

0
Login to vote