PoshCode Archive  Artifact [728d7cd0a6]

Artifact 728d7cd0a67fbc21f2d4f2f086911f489aa2758237e6e8831ffc1cc35da26d13:

  • File Chassis-Type.ps1 — part of check-in [c8b468eb6d] at 2018-06-10 13:29:02 on branch trunk — Ever wonder what kind of chassis your computer thinks it’s running on? Have a need to know if you’re RDP’d into a physical or virtual system? This script can probably answer the question for you. This script was adapted to PowerShell from a VBScript I’ve had for a while. It uses WMI to determine the Chassis type and translates the reported numerical code into decipherable text. – Thought i would rewrite this code using the switch function rather than elseif. Easier to read and less code to write. (user: Owen08 size: 2263)

# encoding: ascii
# api: powershell
# title: Chassis Type
# description: Ever wonder what kind of chassis your computer thinks it’s running on? Have a need to know if you’re RDP’d into a physical or virtual system? This script can probably answer the question for you. This script was adapted to PowerShell from a VBScript I’ve had for a while. It uses WMI to determine the Chassis type and translates the reported numerical code into decipherable text. – Thought i would rewrite this code using the switch function rather than elseif. Easier to read and less code to write.
# version: 0.1
# type: class
# author: Owen08
# license: CC0
# x-poshcode-id: 3668
# x-archived: 2016-05-11T05:45:37
# x-published: 2013-09-27T10:22:00
#
#
$system = Get-WMIObject -class Win32_systemenclosure
$type = $system.chassistypes

Switch ($Type)
    {
        "1" {"Chassis type is: $Type - Other"}
        "2" {"Chassis type is: $type - Virtual Machine"}
        "3" {"Chassis type is: $type - Desktop"}
        "4" {"Chassis type is: $type - Low Profile Desktop"}
        "5" {"Chassis type is: $type - Pizza Box"}
        "6" {"Chassis type is: $type - Mini Tower"}
        "7" {"Chassis type is: $type - Tower"}
        "8" {"Chassis type is: $type - Portable"}
        "9" {"Chassis type is: $type - Laptop"}
        "10" {"Chassis type is: $type - Notebook"}
        "11" {"Chassis type is: $type - Handheld"}
        "12" {"Chassis type is: $type - Docking Station"}
        "13" {"Chassis type is: $type - All-in-One"}
        "14" {"Chassis type is: $type - Sub-Notebook"}
        "15" {"Chassis type is: $type - Space Saving"}
        "16" {"Chassis type is: $type - Lunch Box"}
        "17" {"Chassis type is: $type - Main System Chassis"}
        "18" {"Chassis type is: $type - Expansion Chassis"}
        "19" {"Chassis type is: $type - Sub-Chassis"}
        "20" {"Chassis type is: $type - Bus Expansion Chassis"}
        "21" {"Chassis type is: $type - Peripheral Chassis"}
        "22" {"Chassis type is: $type - Storage Chassis"}
        "23" {"Chassis type is: $type - Rack Mount Chassis"}
        "24" {"Chassis type is: $type - Sealed-Case PC"}
        Default {"Chassis type is: $type - Unknown"}
     }