PowerShell | Identify device as laptop.

  • PowerShell | Identify device as laptop.

    Posted by Roddy Gelberty on 5 July 2020 at 7:34 pm

    Does anyone know of a quick way to identify a device as a laptop using PowerShell. I want to use this within an SCCM task sequence to set a TS variable.

    Roddy Gelberty replied 2 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Topaz George

    5 July 2020 at 7:42 pm

    Hope this helps.

    %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\PowerShell.exe -NonInteractive -WindowStyle Hidden -noprofile -ExecutionPolicy Bypass -command "&{$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment;if ((get-wmiobject -class Win32_SystemEnclosure).chassistypes -in ("""8""","""9""","""10""","""11""","""14""")) {$tsenv.Value('isLaptop') = 'True'} else {$tsenv.Value('isLaptop') = 'False'}}"
  • Roddy Gelberty

    5 July 2020 at 8:38 pm

    That is brilliant. Using MDT to gather/run scripts to calculate this value increases the time to execute an SCCM task sequence. This will shorten the duration of my SCCM TS.