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 3 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Topaz George

    Organizer
    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

    Member
    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.

Log in to reply.

DCOM hardening issue.

This application fails to authenticate with WMI on the SCCM server because Microsoft has not yet hardened DCOM on their Windows Preinstallation Environment. We are working on a different approach, but it will only be released during the first quarter of 2024. But until that time, the only workaround will be to uninstall the update corresponding to KB5004442.