利用GetObject("WinMgmts:")获取系统信息

用WMI对象列出系统所有进程:

----Instance.vbs----

程序代码
DimWMI,objs
SetWMI=GetObject(" WinMgmts:")
Setobjs=WMI.InstancesOf("Win32_Process")
ForEachobjInobjs
Enum1=Enum1+obj.Description+Chr(13)+Chr(10)
Next
msgboxEnum1


获得物理内存的容量:

-----physicalMemory.vbs-----

程序代码
strComputer="."

SetwbemServices=GetObject(" winmgmts:\\"&strComputer)
SetwbemObjectSet=wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")

ForEachwbemObjectInwbemObjectSet
WScript.Echo"物理内存(MB):"&CInt(wbemObject.TotalPhysicalMemory/1024)
Next


取得系统所有服务及运行状态

----service.vbs----
程序代码
SetServiceSet=GetObject(" winmgmts:").InstancesOf("Win32_Service")
Dims,infor
infor=""
foreachsinServiceSet
infor=infor+s.Description+"==>"+s.State+chr(13)+chr(10)
next
msgboxinfor


CPU的序列号:

---CPUID.vbs---

程序代码
DimcpuInfo
cpuInfo=""
setmoc=GetObject(" Winmgmts:").InstancesOf("Win32_Processor")
foreachmoinmoc
cpuInfo=CStr(mo.ProcessorId)
msgbox"CPUSerialNumberis:"&cpuInfo
next


硬盘型号:
---HDID.vbs---
程序代码
DimHDid,moc
setmoc=GetObject(" Winmgmts:").InstancesOf("Win32_DiskDrive")
foreachmoinmoc
HDid=mo.Model
msgbox"硬盘型号为:"&HDid
next


网卡MAC物理地址:

---MACAddress.vbs---
程序代码
Dimmc
setmc=GetObject(" Winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")
foreachmoinmc
ifmo.IPEnabled=truethen
msgbox"网卡MAC地址是:"&mo.MacAddress
exitfor
endif
next


测试你的显卡:
程序代码

OnErrorResumeNext
Dimye
Dimyexj00
setyexj00=GetObject(" winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_VideoController")
foreachyeinyexj00
msgbox"型号:"&ye.VideoProcessor&vbCrLf&"厂商:"&ye.AdapterCompatibility&vbCrLf&"名称:"&ye.Name&vbCrLf&"状态:"&ye.Status&vbCrLf&"显存:"&(ye.AdapterRAM\1024000)&"MB"&vbCrLf&"驱动(dll):"&ye.InstalledDisplayDrivers&vbCrLf&"驱动(inf):"&ye.infFilename&vbCrLf&"版本:"&ye.DriverVersion
next
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值