How to detect Lenovo models and drivers with Task Sequences

Generally, using WMI to query a mainboard and determine driver sets is quite a straightforward exercise.  We can easily run up a tool like MSInfo32.exe to determine the Manufacturer and Model of a machine and these same BIOS files can be used in a Task Sequence to allow a driver set to be used.  The Image above shows a series of models that are available for the Manufacturer “Dell Inc.

Plenty of examples exist on the web to show how “Make” and “Model” may be used to create a driver matrix with SCCM and MDT.  Unfortunately, this approach doesn’t accommodate Lenovo workstations.

Unlike Dell and Hewlett Packard, Lenovo often change the Model designation to track batches of machines that roll off the factory line.   This means that a large number of Model designations may all refer to a single driver set.


A search of the Lenovo support site for the “M91” model shows dozens of batches of the Lenovo M91 Model that may exist.  The number in brackets represents the first four digits of what is branded into the “MODEL” field of the Lenovo BIOS.  What’s needed is a method of linking all the possible model numbers to a simple model type.  This can be achieved by using MDT scripting.

With this example, I have created an INI file for use with Microsoft’s Deployment Toolkit.

I have started by going to the Lenovo support website and collecting all the model numbers used for the machines I have to support.  These are written to an INI called MODELS.INI under a Lenovo section. 

When my Task Sequence runs, it will be able to translate the first four digits of the Lenovo Model field to the Driver set I’ve imported. 

To do this, I will use an MDT Script that I’ve called ZTIDiscoverMachineType (that’s available for download here).  When it’s run, it retrieves the MDT Task Sequence properties of MAKE and MODEL.  If the script is being run against a Lenovo machine, the Model field is truncated to the first four digits and the Readini function returns the Model category from my Models.ini file.  When the script is run, it will create a new MACHINETYPE variable that can be used to condition elements within a Task Sequence.

Thanks to Keith Lacelle, Denis St-Pierre and Rob van der Woude for providing the INI reading function!

Because I can now rely on a simple variable for identifying a driver set, I can now organise Lenovo drivers in the same way a running Task Sequence will identify them.

Calling the Lenovo / Machine Type Discovery Script

This example is for Microsoft’s Deployment Toolkit but the principles are the same for SCCM.

Notice that I’ve copied my custom, ZTI script into a directory called “Custom” that hangs off the Script directory amongst my MDT files.  Whenever I use my new MACHINETYPE variable in a Task Sequence, I’ll need to ensure that my “gather” script has been called first.

The file system of my Deployment share looks like the Image below:

Within the Deployment Workbench I’m able to create Selection Profiles that match each of the Lenovo model types.  Each profile contains only the drivers for that particular model of machine.

I am able to now add into my Task Sequence “Inject Drivers” actions.

The Driver injection can be customised to specifically use a Driver selection profile

 … and each driver injection is conditional to only run with known Machine Types.