vbs wmi获取电脑硬件信息实例
程序员文章站
2022-04-29 17:15:55
set wmi=getobject("winmgmts:\\") set board=wmi.instancesof("win32_baseboard"...
set wmi=getobject("winmgmts:\\")
set board=wmi.instancesof("win32_baseboard")
for each b in board
msg="主板:"&b.manufacturer&vbtab&b.product&vbtab&chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
set cpus=wmi.instancesof("win32_processor")
msg=msg&"cpu 特征:"+chr(13)
for each cpu in cpus
msg=msg+cpu.deviceid&vbtab&cpu.name&chr(13) _
&vbtab&cpu.socketdesignation&vbtab&cpu.currentclockspeed&"mhz"&vbtab&cpu.l2cachesize&"kb_l2"&chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
set mem=wmi.instancesof("win32_physicalmemory")
msg=msg&"内存容量:"+chr(13)
for each m in mem
msg=msg&m.tag&space(10)&m.capacity&+chr(13)
next
set mem=wmi.instancesof("win32_computersystem")
for each m in mem
msg=msg&"内存总容量:"&round((m.totalphysicalmemory/1024^2),2)&"m"+chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
set display=wmi.instancesof("win32_videocontroller")
msg=msg&"显示系统:"+chr(13)
for each video in display
msg=msg&video.deviceid&vbtab&video.name&chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
set disks=wmi.instancesof("win32_diskdrive")
msg=msg&"硬盘容量:"+chr(13)
for each d in disks
if int(d.size/(1024^3))=0 then
n=round(d.size/(1024^2),2)&"m"
else
n=round(d.size/(1024^3),2)&"g"
end if
msg=msg+d.deviceid&" 空间为: "&n&chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
msgbox msg,0,"电脑基本特征"
set board=wmi.instancesof("win32_baseboard")
for each b in board
msg="主板:"&b.manufacturer&vbtab&b.product&vbtab&chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
set cpus=wmi.instancesof("win32_processor")
msg=msg&"cpu 特征:"+chr(13)
for each cpu in cpus
msg=msg+cpu.deviceid&vbtab&cpu.name&chr(13) _
&vbtab&cpu.socketdesignation&vbtab&cpu.currentclockspeed&"mhz"&vbtab&cpu.l2cachesize&"kb_l2"&chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
set mem=wmi.instancesof("win32_physicalmemory")
msg=msg&"内存容量:"+chr(13)
for each m in mem
msg=msg&m.tag&space(10)&m.capacity&+chr(13)
next
set mem=wmi.instancesof("win32_computersystem")
for each m in mem
msg=msg&"内存总容量:"&round((m.totalphysicalmemory/1024^2),2)&"m"+chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
set display=wmi.instancesof("win32_videocontroller")
msg=msg&"显示系统:"+chr(13)
for each video in display
msg=msg&video.deviceid&vbtab&video.name&chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
set disks=wmi.instancesof("win32_diskdrive")
msg=msg&"硬盘容量:"+chr(13)
for each d in disks
if int(d.size/(1024^3))=0 then
n=round(d.size/(1024^2),2)&"m"
else
n=round(d.size/(1024^3),2)&"g"
end if
msg=msg+d.deviceid&" 空间为: "&n&chr(13)
next
msg=msg&chr(13)&"---"+chr(13)
msgbox msg,0,"电脑基本特征"
上一篇: IBM:2013年全面方案云存储走向落地
推荐阅读
-
微信小程序获取位置展示地图并标注信息的实例代码
-
微信小程序城市定位的实现实例(获取当前所在国家城市信息)
-
微信小程序获取用户信息的两种方法wx.getUserInfo与open-data实例分析
-
Python 通过调用接口获取公交信息的实例
-
Android获取手机型号/系统版本号/App版本号等信息实例讲解
-
js 获取元素的具体样式信息getcss(实例讲解)
-
android 获取当前手机的 DHCP 信息ip,server 等操作实例教程
-
Html5 Geolocation获取地理位置信息实例
-
Hardware_Info.vbs 获取硬件信息的VBS代码
-
# 提高#spring cloud alibaba 获取配置中心实例信息