vbs wmi獲取電腦硬體資訊例項

2022-09-21 14:15:12 字數 1679 閱讀 2740

set wmi=getobject("winmgmts:\程式設計客棧\")

setoepgjpyab 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 cpoepgjpyabu 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

m程式設計客棧sg=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,"電腦基本特徵"

本文標題: vbs wmi獲取電腦硬體資訊例項

本文位址: /ruanjian/vb/42963.html

獲取電腦硬體資訊

csharp csharp csharp csharp using system using system.collections using system.management namespace hardwareinfos public static hashtable getallinfos ...

C 獲取電腦硬體資訊

獲取cpu編號 view plaincopy to clipboardprint?managementclass mc new managementclass win32 processor managementobjectcollection moc mc.getinstances string ...

C 獲取電腦硬體配置資訊

using system using system.management using system.collections using system.collections.specialized using system.text namespace rainsoft.management end...