3月312017
WMI方式查询计算机是笔记本/台式机或是虚拟机的类型
MsgBox(0,"结果","(" & @ComputerName & ")系统架构是: [" & $sResult & "]")
Func _GetSystemEnclosure($sPCName)
Local $oWMI = ObjGet("winmgmts:\\" & $sPCName & "\root\cimv2")
;查询 (Tag=Key属性)
Local $colSystemEnclosure = $oWMI.ExecQuery("SELECT ChassisTypes FROM Win32_SystemEnclosure")
Local $sCodeDesc_Chs,$sCode
For $oFoundItem In $colSystemEnclosure
For $sCode In $oFoundItem.ChassisTypes
Switch $sCode
Case 1
$sCodeDesc_Chs = "其它计算机"
Local $sModel = $oWMI.Get("Win32_ComputerSystem.Name='" & $sPCName & "'").Model
If StringInStr($sModel,"Virtual",0) Then $sCodeDesc_Chs = "虚拟机"
Case 3
$sCodeDesc_Chs = "桌面计算机"
Local $sModel = $oWMI.Get("Win32_ComputerSystem.Name='" & $sPCName & "'").Model
If StringInStr($sModel,"Virtual",0) Then $sCodeDesc_Chs = "虚拟机"
Case 5
$sCodeDesc_Chs = "披萨盒的机箱设计"
Case 6
$sCodeDesc_Chs = "迷你塔式机"
Case 7
$sCodeDesc_Chs = "塔式机"
Case 8
$sCodeDesc_Chs = "便携式计算机"
Case 9
$sCodeDesc_Chs = "膝上型计算机"
Case 10
$sCodeDesc_Chs = "笔记本"
Case 11
$sCodeDesc_Chs = "手提式设备"
Case 12
$sCodeDesc_Chs = "插接站.扩展坞"
Case 13
$sCodeDesc_Chs = "一体机"
Case 14
$sCodeDesc_Chs = "迷你型笔记本"
Case 15
$sCodeDesc_Chs = "节省空间型设备"
Case 16
$sCodeDesc_Chs = "盒型设备"
Case 17
$sCodeDesc_Chs = "主(大型)系统机架?"
Case 18
$sCodeDesc_Chs = "扩展机架"
Case 19
$sCodeDesc_Chs = "子机架"
Case 20
$sCodeDesc_Chs = "总线扩展机架"
Case 21
$sCodeDesc_Chs = "外围机架"
Case 22
$sCodeDesc_Chs = "机架式存储"
Case 23
$sCodeDesc_Chs = "机架式服务器"
Case 24
$sCodeDesc_Chs = "密封式计算机"
Case Else ;2
$sCodeDesc_Chs = "未知计算机"
EndSwitch
Next
Next
Return $sCodeDesc_Chs
EndFunc
扫描二维码,在手机上阅读
发表评论
木有头像就木JJ啦!还木有头像吗?点这里申请属于你的个性Gravatar头像吧!