Using Model variable for Lenovo systems in MDT
By Steve Bowman
Published March 5, 2015
Estimated Reading Time: < 1 minute

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!

Post Tags:
Article By Steve Bowman
Steve Bowman is a Partner at Model Technology as well as their Vice President of Sales and Marketing. Steve is a father, husband, Franciscan, and lover of technology. He's bilingual in business and technology and have over 30 years of experience in selling enterprise technology solutions in a variety of industries.

Related Posts

No more cyber insurance forms!

Tired of filling out endless cyber insurance forms?

  • Download accurate security reports about your environment with a single click.
  • Avoid costly reporting errors.
  • Use your time in better ways.
  • Prove your cyber readiness with confidence.

Download our vCISO platform brochure to learn more.