Using Model variable for Lenovo systems in MDT

I have been pushing my customers for quite some time to use the Model variable in the task sequences for OS Deployment instead of using direct WMI queries. Each time you perform a WMI query in a task sequence step it takes extra time to run that query. When you have a lot of different models of machines you may be increasing your deployment times by several minutes just by doing WMI queries. MDT has a script called ztigather.wsf that runs and gathers both the Make and Model of machines already so instead of using a WMI query just use a condition with a Task Sequence variable called Model.

The challenge is when trying to do this with Lenovo systems. Lenovo systems do not properly set the Model to what you would think it would be. Lenovo does however have the “correct” value for Model inside of the Win32_ComputerSystemProduct WMI class.

Since I really like consistency I decided to modify the ztigather.wsf file in order to make sure that Model was the actual Model no matter the type of computer.

To do that insert code after the following block:


' Get the make, model, and memory from the Win32_ComputerSystem class

Set objResults = objWMI.InstancesOf("Win32_ComputerSystem")
For each objInstance in objResults

If not IsNull(objInstance.Manufacturer) then
sMake = Trim(objInstance.Manufacturer)
End if
If not IsNull(objInstance.Model) then
sModel = Trim(objInstance.Model)
End if
If not IsNull(objInstance.TotalPhysicalMemory) then
sMemory = Trim(Int(objInstance.TotalPhysicalMemory / 1024 / 1024))
End if

Next

Insert this code:


If sMake = "LENOVO" then
Set objResults = objWMI.InstancesOf("Win32_ComputerSystemProduct")
For each objInstance in objResults

If not IsNull(objInstance.Version) then
sModel = Trim(objInstance.Version)
End if
Next
End If

Just save the file and now Model is truly the correct variable for all hardware manufacturers.

Enjoy!

By |2016-04-12T11:06:29+00:00March 5th, 2015|SCCM|1 Comment

About the Author:

steve bowman

Model Technology

Let us help you get your end point and data center strategy on cruise control!  Ask about our Calibration Assessment.

CONTACT US

  • 12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141
  • (314) 254-4138
  • sales@model-technology.com

RECENT TWEETS