(Tested with WinPE 1703 and Windows 10 1703 / SCCM 2012 Version 1706 / MDT )
A short guide how to store WMI information into a Task Sequence Variable without the need of a script. (And therefore without a "Update Distribution Point")
Create a new "Run Command Line" Step
Set the step name for example: "Set Task Sequence Variable OSD_VariableName"
The example shows how to store the property "Version" of the WMI Class "Win32_ComputerSystemProduct" into the Variable "OSD_VariableName". This is for example usefully for Lenovo devices because the property holds the real model name (Lenovo Model Names) and not the cryptic ID which may change.
Other examples would be:
Device Disk Count:
powershell -Command "& {(New-Object -COMObject Microsoft.SMS.TSEnvironment).Value('OSD_DiskCount') = @(Get-WmiObject -query 'Select * from Win32_DiskDrive WHERE MediaType = \"Fixed hard disk media\"').Count}"
Event more complicated commands are possible but at some point a script provides more flexibility.
Important Note:
"Run Command Line" step in conjunction with "powershell-Command"& {Crazy-PowershellFunction}" has problems with double quotes ("). If they are required they need to be escaped with "\". See for example: Device Disk Count:
Other special characters my produce similar issues.
If you like this quick and simple solution and found some other useful commands please share them in a reply to this Topic
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
OSD Run Command Line: WMI to TS Variable
(Tested with WinPE 1703 and Windows 10 1703 / SCCM 2012 Version 1706 / MDT )
A short guide how to store WMI information into a Task Sequence Variable without the need of a script. (And therefore without a "Update Distribution Point")
The example shows how to store the property "Version" of the WMI Class "Win32_ComputerSystemProduct" into the Variable "OSD_VariableName". This is for example usefully for Lenovo devices because the property holds the real model name (Lenovo Model Names) and not the cryptic ID which may change.
Other examples would be:
Device Disk Count:
Device TPM Chip Available:
Event more complicated commands are possible but at some point a script provides more flexibility.
Important Note:
"Run Command Line" step in conjunction with "powershell -Command "& {Crazy-PowershellFunction}" has problems with double quotes ("). If they are required they need to be escaped with "\". See for example: Device Disk Count:
Other special characters my produce similar issues.
If you like this quick and simple solution and found some other useful commands please share them in a reply to this Topic
Share this post
Link to post
Share on other sites