Board logo

标题: [原创代码] PowerShell判断电脑是台式机还是笔记本 [打印本页]

作者: DAIC    时间: 2013-9-2 20:51     标题: PowerShell判断电脑是台式机还是笔记本

在别的论坛看到有人问这个问题,我试着写了一下。
  1. $objSysEnc = gwmi Win32_SystemEnclosure
  2. switch ($objSysEnc.ChassisTypes) {
  3.     1  {"Other"; break}
  4.     2  {"Unknown"; break}
  5.     3  {"Desktop"; break}
  6.     4  {"Low Profile Desktop"; break}
  7.     5  {"Pizza Box"; break}
  8.     6  {"Mini Tower"; break}
  9.     7  {"Tower"; break}
  10.     8  {"Portable"; break}
  11.     9  {"Laptop"; break}
  12.     10 {"Notebook"; break}
  13.     11 {"Hand Held"; break}
  14.     12 {"Docking Station"; break}
  15.     13 {"All in One"; break}
  16.     14 {"Sub Notebook"; break}
  17.     15 {"Space-Saving"; break}
  18.     16 {"Lunch Box"; break}
  19.     17 {"Main System Chassis"; break}
  20.     18 {"Expansion Chassis"; break}
  21.     19 {"SubChassis"; break}
  22.     20 {"Bus Expansion Chassis"; break}
  23.     21 {"Peripheral Chassis"; break}
  24.     22 {"Storage Chassis"; break}
  25.     23 {"Rack Mount Chassis"; break}
  26.     24 {"Sealed-Case PC"; break}
  27.     default {"unknown"}
  28. }
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2