Video Screencast Help

Add Mass Storage Device Drivers (NICs too!) to WinPE 2.1

Created: 21 Oct 2008 • Updated: 28 Oct 2008 | 6 comments
Frank_Contreras's picture
+4 4 Votes
Login to vote

Adding mass storage device drivers to WinPE just got easier. One of the biggest benefits of Deployment Server 6.9 is that I get the flexibility of WinPE 2.1! I go to put one of my servers in automation and it turns out my Silicon Image Raid controller is not natively supported as well as the default NICs of my VMware clients. I found the Vista drivers for my SiI3x12 and vmxnet. Now I just need to inject them into the WinPE image.

One of the touted features of WinPE 2.1 is the ability to easily add drivers to it. See Microsoft's article on this called Walkthrough: Create a Windows RE Image. Step 4 addresses how to add mass storage device drivers. I found where Altiris installs the WAIK when I used the defaults. So now we have all the bits we need to put together a solution.

Wouldn't it be nice if there was a handy-dandy script that did all the work and all you had to do was point to where the driver files are? I thought so. So here's a vbscript that can be run on your deployment server to inject drivers into your winpe.wim file.

After your drivers are added, just recompile your PXE image or boot media and you should be good to go.

In the attached script (AddDriverWinPE.vbs), change the value of strDrivers in line 14 to point to the location of your drivers. Peimg.exe grabs the .inf files and puts them in WinPE.

This script can also create a back-up of winpe.wim just in case you need to roll back. To roll back, delete the newly created winpe.wim and rename the backup to winpe.wim.

By the way, adding vmxnet NIC drivers through the Altiris GUI caused WinPE to hang, but using this method did the trick.

Enjoy!

'==========================
' NAME: AddDriverWinPE.vbs
' AUTHOR: Frank Contreras
' DATE  : 10/17/2008
'==========================

Option Explicit

Dim objFSO, objFile, objShell
Dim strWinpeFile, strWinpeMount, strImagexFile, strDrivers, strTools, strPEImg
Dim intYN, strQT

strQT          = Chr(34)
strDrivers    = "C:\3112Raid_x86_10600_logo\*.inf"
strTools      = "C:\Program Files\Altiris\eXpress\Deployment Server\WAIK\Tools"
strWinpeFile  = "\PETools\x86\winpe.wim"
strWinpeMount = "\PETools\x86\mount"
strPEImg      = "\PETools\peimg.exe"
strImagexFile = "\x86\imagex.exe"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")

'Verify Wim File
If not objFSO.FileExists(strTools & strWinpeFile) Then
  WScript.Echo "WinPE 2.1 does not appear to be installed."
  WScript.Echo "Check the file path and look for the winpe.wim file."
  WScript.Quit
End If

'Backup File
intYN = MsgBox ("Backup winpe.wim?", vbYesNo," ")
If intYN = 6 Then
  WScript.Echo "  Backing up winpe.wim to winpe.wim-"& Year(Now) & Month(Now) & Day(Now) & "-" & replace(replace(Time,":","-")," ","")
  objFSO.CopyFile strTools & strWinpeFile, strTools & strWinpeFile & "-" & Year(Now) & Month(Now) & Day(Now) & "-" & replace(replace(Time,":","-")," ","")
End If

'Create WinPE mount directory
If Not objFSO.FolderExists(strTools & strWinpeMount) Then
  WScript.Echo "  Creating WinPE mount directory"
  objFSO.CreateFolder(strTools & strWinpeMount)
End If

'Mount winpe image
WScript.Echo "  Mounting winpe image.."
objShell.Run strQT & strTools & strImagexFile & strQT & " /mountrw " & strQT & strTools & strWinpeFile & strQT & " 1 " & strQT & strTools & strWinpeMount & strQT, 2, True

'Install Drivers
WScript.Echo "  Installing drivers from " & strDrivers
objShell.Run strQT & strTools & strPEImg & strQT & " /inf=" & strQT & strDrivers & strQT & " /image=" & strQT & strTools & strWinpeMount & strQT, 2, True

'Unmount winpe image and commit changes
WScript.Echo "  Committing changes and unmounting winpe image."
objShell.Run strQT & strTools & strImagexFile & strQT & " /unmount /commit " & strQT & strTools & strWinpeMount & strQT, 2, True

License: AJSL
By clicking the download link below, you agree to the terms and conditions in the Altiris Juice Software License
Support: User-contributed tools on the Juice are not supported by Altiris Technical Support. If you have questions about a tool, please communicate directly with the author by visiting their profile page and clicking the 'contact' tab.

Comments 6 CommentsJump to latest comment

look199's picture

Thanks! This worked wonderfully.

0
Login to vote
dondreak's picture

AWESOME. Thank you. This will help a lot. HP keeps making things hard by changing drivers every other month. 2 times last month.

0
Login to vote
RCurtis's picture

This is probably a dumb question...but after you load these drivers via the script, do you have to keep them in the folder pointed to by the strDrivers var?  Can they be deleted?

0
Login to vote
Frank_Contreras's picture

The drivers will actually be part of the .iso image when it is compiled.  You don't need to keep the drivers to use the .iso, but you should keep them around in case you do the procedure and use the drivers again.

0
Login to vote
kpjernigan's picture

What if, the drives are nested inside a subfolder(s)?  Can the script look recursivly through the subfolders for the .inf files?  Or can it be written in such a way as to look through the all the subfolders and add the .inf files it finds?

-Kev

0
Login to vote
JimChud's picture

Hi,

I amended your script so that it would automatically flow through a folder as required (give it the top level folder location and it will scan through and add any inf's it finds in those sub folders). This was primarily due to the release of the Dell WinPE Driver Cab and adding them manually was taking an age.

Hopefully this may help one or two people.

Dim objFSO, objFile, objShell, objFolder
Dim strWinpeFile, strWinpeMount, strImagexFile, strDrivers, strTools, strPEImg, strFolder
Dim intYN, strQT

strQT = Chr(34)
strFolder = "I:\Drivers\Dell Drivers\winpe\x64"
strDrivers = "C:\3112Raid_x86_10600_logo\*.inf"
strTools = "D:\Program Files\Altiris\eXpress\Deployment Server\WAIK\Tools"
strWinpeFile = "\PETools\amd64\winpe.wim"
strWinpeMount = "\PETools\amd64\mount"
strPEImg = "\PETools\peimg.exe"
strImagexFile = "\x86\imagex.exe"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")

'Backup File
intYN = MsgBox ("Backup winpe.wim?", vbYesNo," ")
If intYN = 6 Then
WScript.Echo " Backing up winpe.wim to winpe.wim-"& Year(Now) & Month(Now) & Day(Now) & "-" & replace(replace(Time,":","-")," ","")
objFSO.CopyFile strTools & strWinpeFile, strTools & strWinpeFile & "-" & Year(Now) & Month(Now) & Day(Now) & "-" & replace(replace(Time,":","-")," ","")
End If

'Create WinPE mount directory
If Not objFSO.FolderExists(strTools & strWinpeMount) Then
WScript.Echo " Creating WinPE mount directory"
objFSO.CreateFolder(strTools & strWinpeMount)
End If

'Mount winpe image
WScript.Echo " Mounting winpe image.."
'WScript.Echo strQT & strTools & strImagexFile & strQT & " /mountrw " & strQT & strTools & strWinpeFile & strQT & " 1 " & strQT & strTools & strWinpeMount & strQT
objShell.Run strQT & strTools & strImagexFile & strQT & " /mountrw " & strQT & strTools & strWinpeFile & strQT & " 1 " & strQT & strTools & strWinpeMount & strQT, 2, True

Set objFolder = objFSO.GetFolder(strFolder)
Sub ScanDir (objFolder)
For Each strDir In objFolder.SubFolders
ScanDir(strDir)

'Verify Wim File
If not objFSO.FileExists(strTools & strWinpeFile) Then
WScript.Echo "WinPE 2.1 does not appear to be installed."
WScript.Echo "Check the file path and look for the winpe.wim file."
WScript.Quit
End If

'Install Drivers
'WScript.Echo " Installing drivers from " & strDir.Path
objShell.Run strQT & strTools & strPEImg & strQT & " /inf=" & strQT & strDir.Path & "\*.inf" & strQT & " /image=" & strQT & strTools & strWinpeMount & strQT, 2, True
Next
End Sub
ScanDir objFolder

'Unmount winpe image and commit changes
WScript.Echo " Committing changes and unmounting winpe image."
objShell.Run strQT & strTools & strImagexFile & strQT & " /unmount /commit " & strQT & strTools & strWinpeMount & strQT, 2, True

 

Regards Jim.
Connect Etiquette: "Mark as Solution" those posts which resolve your problem and give a thumbs up to useful comments, articles and downloads.

0
Login to vote