Created
August 29, 2022 14:46
-
-
Save dpo007/b1e0c2469e321768aa982ec097f8e5ce to your computer and use it in GitHub Desktop.
PowerShell :: Detect if local computer is portable or not, based on WMI/ChassisType.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$isPortable = $false | |
$chassisType = (Get-CimInstance -Query "Select * from Win32_SystemEnclosure").ChassisTypes[0] | |
switch ($chassisType) { | |
# Case 8 "Portable" | |
# Case 9 "Laptop" | |
# Case 10 "Notebook" | |
# Case 11 "Handheld" | |
# Case 14 "Sub-Notebook" | |
{$_ -in 8, 9, 10, 11, 14} { $isPortable = $true } | |
} | |
$isPortable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment