Non classé

SCCM – Task sequence – Get personalised IsLaptop variable

By February 20, 2020No Comments
  1. Create a new powershell task in a task sequence, configure de execution policy on with bypass and enter the script:
#Create TS envrionnement object on $tsenv
#Create TS envrionnement object on $tsenv
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
#Check if computer is laptop [boolean]
[uint16[]]$laptop = 8,9,10,11,12,14,18,21,30,31,32
$CheckIFisLaptop = foreach ($chassis in (Get-CimInstance -ClassName Win32_SystemEnclosure).ChassisTypes) {
if ($chassis -in $laptop) {
$TRUE
break
}
else {
$FALSE
break
}
}
#Send value on the new TS variable
$tsenv.value("NewIsLaptop") = "$CheckIFisLaptop"

 
Affect the $NewIsLaptop variable on your needed task, on the options/Add conditions/Task Sequence Variable. Enter value TRUE.