PoshCode Archive  Artifact [bdba790640]

Artifact bdba7906407ed2b28ad708bc83fa72f1fc42a21d1d77767f2d19610118e51450:

  • File Chassis-Type.ps1 — part of check-in [e87bfd48cc] at 2018-06-10 13:17:22 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. (user: AlphaSun size: 2357)

# 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.
# version: 0.1
# type: class
# author: AlphaSun
# license: CC0
# x-poshcode-id: 2941
# x-archived: 2016-05-12T09:41:22
# x-published: 2012-08-31T14:56:00
#
#
$SystemEnclosure = Get-WMIObject -Class Win32_SystemEnclosure; $Type = $SystemEnclosure.ChassisTypes; CLS ; Write-Host -BackgroundColor White -ForegroundColor Blue "Chassis Type:"
	if ($Type -eq 1)
		{Write-Host "$Type - Other"}
	elseif ($Type -eq 2)
		{Write-Host "$Type - Virtual Machine"}
	elseif ($Type -eq 3)
		{Write-Host "$Type - Desktop"}
	elseif ($Type -eq 4)
		{Write-Host "$Type - Low Profile Desktop"}
	elseif ($Type -eq 5)
		{Write-Host "$Type - Pizza Box"}
	elseif ($Type -eq 6)
		{Write-Host "$Type - Mini Tower"}
	elseif ($Type -eq 7)
		{Write-Host "$Type - Tower"}
	elseif ($Type -eq 8)
		{Write-Host "$Type - Portable"}
	elseif ($Type -eq 9)
		{Write-Host "$Type - Laptop"}
	elseif ($Type -eq 10)
		{Write-Host "$Type - Notebook"}
	elseif ($Type -eq 11)
		{Write-Host "$Type - Handheld"}
	elseif ($Type -eq 12)
		{Write-Host "$Type - Docking Station"}
	elseif ($Type -eq 13)
		{Write-Host "$Type - All-in-One"}
	elseif ($Type -eq 14)
		{Write-Host "$Type - Sub-Notebook"}
	elseif ($Type -eq 15)
		{Write-Host "$Type - Space Saving"}
	elseif ($Type -eq 16)
		{Write-Host "$Type - Lunch Box"}
	elseif ($Type -eq 17)
		{Write-Host "$Type - Main System Chassis"}
	elseif ($Type -eq 18)
		{Write-Host "$Type - Expansion Chassis"}
	elseif ($Type -eq 19)
		{Write-Host "$Type - Sub-Chassis"}
	elseif ($Type -eq 20)
		{Write-Host "$Type - Bus Expansion Chassis"}
	elseif ($Type -eq 21)
		{Write-Host "$Type - Peripheral Chassis"}
	elseif ($Type -eq 22)
		{Write-Host "$Type - Storage Chassis"}
	elseif ($Type -eq 23)
		{Write-Host "$Type - Rack Mount Chassis"}
	elseif ($Type -eq 24)
		{Write-Host "$Type - Sealed-Case PC"}
	else
		{Write-Host "$Type - Unknown"}