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!

About the Author: steve bowman

Three Minutes For A More Secure & Efficient Infrastructure

Short and to the point, Steve’s Email Blasts give you endpoint management tips, tricks, and news in three minutes or less email read-time, guaranteed.

Model says no to spam. Privacy Policy

Model Technology Solutions

Model Technology Solutions is a small but mighty band of infrastructure experts. We’ve helped companies in diverse industries to modernize and automate their infrastructures through effectively managing their Microsoft endpoint suite.

With us on your team, you’ll watch your security and compliance go up and your IT team’s costs (and headaches) go down. You’ll relax in knowing that your endpoints will be secure and online when your users need them most. And you’ll finally get back to your most-important tasks.

Model Technology Solutions
12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141

Phone: (314) 254-4138
General Inquiries: model@model-technology.com
Sales and Quotes: sales@model-technology.com