The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

Posts Tagged ‘Drivers’

Device drivers can make you feel “differently”…

Posted by Mikael Nystrom on August 15, 2011

Today’s story is about a driver, a driver that did not really wanted to be installed. I’ll guess you been in that situation before and I will give a tip on how to make those drives install like a charm. The driver of today’s topic is a Smartcard driver, so first of all we need to force the driver in to the deployment solution, which normally is not too advanced. You just down load the driver, unpack the driver and import the driver into the Deployment Workbench in MDT or as a driver package into SCCM, in MDT we need to create a selection profile so we can ignore PNP and just inject the driver and so I did. First test shows that, yes the driver does get into the driver store but it does not work. You can always see what driver you have in Windows 7 using DISM

DISM /Online /Get-Drivers /Format:Table

Ok, so now I need to read about this driver, so after a while it turns out that the driver can only be installed using “Right click on the INF file and select install” method, Well that then tells me that using the old Rundll32 trick should work, but no luck. Ok, ok let us try the Devcon trick the, nope sorry. Now at this time the customer is asking me if I have any problems and of course I don’t have any problems, it’s just a “bad” driver-day…

So, it works when right clicking, ok. But nothing else seems to work, hmm. There is one thing I haven’t tried yet and that is to use the IExpress trick, let us try that and 25 minutes later (re-deploy the machine) it worked like a charm. Now you may ask yourself. –What is the IExpress trick?

Package nasty drivers in a self-extracting and self-installing executable

Now, let us be very clear about one thing, all other methods are better than this (if they work) but sometimes I don’t have time to fly over to the developer with my baseball bat and explain how to do things…

1. Get the driver

In this case the driver is downloadable from the vendor and from http://catalog.update.microsoft.com. From the Vendor it’s a ZIP and from MS catalog it’s a CAB file. A nice thing about MS Catalog is that you can search for the PNP number, but in this case I know the name. A search on “HID C200” will give me “HID Global – Input – HID Crescendo C200”

2. Unpack the driver

ZIP files is, well just ZIP file. CAB files can be opened easily using the command Expand

Expand file.CAB –f:* C:\Driver

3. Pack the Driver using IExpress

What you might not know is that included in Windows 7 there is a packaging application called IExpress and in this case it is really useful.

So, here is the step by step:

clip_image001

Start IExpress by typing IEexpress in a CMD prompt and select to create a new package.

clip_image002

Select to “Extract and run an installation command”.

clip_image003

Give it a name.

clip_image004

Select no confirmation prompt.

clip_image005

Don’t display any license agreement.

clip_image006

Browse to the folder where you have unpacked the drivers and select them all.

clip_image007

Use the dropdown list and select the inf file, if you want to run something else like a batch file, just type the name and it will work.

clip_image008

Nope, no windows please…

clip_image009

Nope, don’t need any kind of messages…

clip_image010

Be sure to select “long names” if the driver have that".

clip_image011

Nope, no restart, we will fix that in the task sequences ourselves.

clip_image012

Save it.

clip_image013

Create the package.

clip_image014

Wait…

4. Deploy the package

Now you have an executable application that works in MDT (have not tested in SCCM, but it might work there too) that will deploy the “nasty” driver in a way that works…

/mike – aka the Deployment Bunny

Posted in Deployment, Drivers, MDT, Windows 7 | Tagged: , , | 1 Comment »

Nice to know: – Why did Windows 7 pick THAT driver ?

Posted by Mikael Nystrom on June 6, 2011

Working with customer is fun and challenging, best thing is that the ask very relevant question, questions that I asked my self long ago but never gave it any thoughts. Recently a customer asked me, “How do make Windows pick the correct driver?” and that my friends are a really god question

The secret behind this is called ranking, ranking occurs when drivers are added to the driver store and that happens of course when we deploy a new Windows 7 machine and drivers are injected. When using MDT in a LiteTouch configuration, the LiteTouch script will do a Plug and Play scanning of the hardware and the use the information the get the correct drivers from the MDT out-of box drivers folder. Now, MDT cant really “know” if that particular driver is the perfect driver so it will copy all drivers to the \Drivers folder on the machine to be deployed. But if you use Driver Groups or any other method that will “filter” the drivers the script would then only copy the one and only driver need.

Well that’s in the perfect word and since that does not exist we will get multiple drivers copied down to the \Drivers folder and then when MDT (using DISM in a offline mode) pushes those drivers into the OS there will be scenarios when we are going to have drivers that have the same PNP number and Windows must choose the correct one and now its time for ranking. In the best of worlds, when all the vendors created perfect drivers and everyone is always running the latest and the greatest this would not be a problem. But in the reality not all vendors have a perfect .inf file, in fact some of them are uglier then others and they does not even work.

Before we go into details on how that work, you might want to know how to “see” this, well that is not a secret there is of course a log file for that and the logical name for that is c:\Windows\inf\setupapi.dev.log and here is a sample where it just happens to be two drivers to pick from: (This log files has been modified and shortened just to show you)

The answer is in setupapi.dev.log

     dvi:      Enumerating INFs from path list ‘C:\Windows\inf’
inf:      Opened PNF: ‘C:\Windows\System32\DriverStore\FileRepository\usb.inf_amd64_neutral_e2b28ecac19a29af\usb.inf’ ([strings.0409])
dvi:      Created Driver Node:
dvi:           InfName      – C:\Windows\System32\DriverStore\FileRepository\usb.inf_amd64_neutral_e2b28ecac19a29af\usb.inf
dvi:           Rank         –
0x00ff2007
dvi:      Created Driver Node:
dvi:           InfName      – C:\Windows\System32\DriverStore\FileRepository\ewusbdev.inf_amd64_neutral_7ed8b2230e11292c\ewusbdev.inf
dvi:           Rank         – 0x00ff0001
inf:      Searched 2 potential matches in published INF directory
ndv:      Selecting best match from Driver Store (including Device Path)…
dvi:                Selected:
dvi:                     Description – [HUAWEI Mobile Connect - USB Device]
dvi:                     InfFile     – [c:\windows\system32\driverstore\filerepository\ewusbdev.inf_amd64_neutral_7ed8b2230e11292c\ewusbdev.inf]
dvi:                     Rank        – [0x00ff0001]

setupapi.dev.log  explained

    • Windows is missing a driver for 0x00ff2007
  • It finds two INF files that could be used
  • By “ranking” them Windows then make a decision
  • The driver with the lowest value wins, since that just have to be the best…
  • In this case
  • 0x00ff0001 is lower then 0x00ff2007 and therefore the HUAWEI Mobile Connect – USB Device is better then a generic USB driver

 

Why and how?

It is always nice to know what all these number means and here it is:

(The official “not so easy to understand” page is here http://msdn.microsoft.com/en-us/library/ff546225(VS.85).aspx“)

The ranking number is divided into 3 parts 0xAABBCCCC

  • AA stands for: – “Signature Code”
    • This one is easy, 00 means its signed, ff means that it is not signed. You can also see how the signer is in the log file
  • BB stands for: – “Feature Score”
    • Well, here is when the fun begins, the feature score is something the vendor decide by themselves, but to be honest I have not seen this being used by anyone. It should popup in the .inf file if they do.
  • CCCC stands for: – “Identifier Score”
    • This is also pretty simple, almost every device have at least for different PNP number, here is my NVidia card

image

And you can see that I have four different PNP numbers on this one, the top one is the exact match, the bottom is kind of generic. The better driver I have the better it will match the top of this list and that will make a low value.

So the best driver you could possible have is 0×00000000, but I have not really seen that kind of driver (yet)

You can find some more information on TechEd on this here:

/mike aka Deployment Bunny

 

Posted in Deployment, Drivers | Tagged: , | 6 Comments »

 
Follow

Get every new post delivered to your Inbox.

Join 1,540 other followers