Board logo

标题: [转贴] 获取系统信息的几个VBScript脚本 [打印本页]

作者: find    时间: 2012-3-25 14:09     标题: 获取系统信息的几个VBScript脚本

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

----Instance.vbs----


  1. Dim WMI,objs
  2. Set WMI = GetObject("WinMgmts:")
  3. Set objs = WMI.InstancesOf("Win32_Process")
  4. For Each obj In objs
  5. Enum1 = Enum1 + obj.Description + Chr(13) + Chr(10)
  6. Next
  7. msgbox Enum1
复制代码




获得物理内存的容量:

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


  1. strComputer = "."
  2. Set wbemServices = GetObject("winmgmts:\\" & strComputer)
  3. Set wbemObjectSet = wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")
  4. For Each wbemObject In wbemObjectSet
  5. WScript.Echo "物理内存 (MB): " & CInt(wbemObject.TotalPhysicalMemory/1024)
  6. Next
复制代码




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

----service.vbs----


  1. Set ServiceSet = GetObject("winmgmts:").InstancesOf("Win32_Service")
  2. Dim s,infor
  3. infor=""
  4. for each s in ServiceSet
  5. infor=infor+s.Description+" ==> "+s.State+chr(13)+chr(10)
  6. next
  7. msgbox infor
复制代码




CPU的序列号:

---CPUID.vbs---


  1. Dim cpuInfo
  2. cpuInfo = ""
  3. set moc = GetObject("Winmgmts:").InstancesOf("Win32_Processor")
  4. for each mo in moc
  5. cpuInfo = CStr(mo.ProcessorId)
  6. msgbox "CPU SerialNumber is : " & cpuInfo
  7. next
复制代码




硬盘型号:
---HDID.vbs---


  1. Dim HDid,moc
  2. set moc =GetObject("Winmgmts:").InstancesOf("Win32_DiskDrive")
  3. for each mo in moc
  4. HDid = mo.Model
  5. msgbox "硬盘型号为:" & HDid
  6. next
复制代码




网卡MAC物理地址:

---MACAddress.vbs---


  1. Dim mc
  2. set mc=GetObject("Winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")
  3. for each mo in mc
  4. if mo.IPEnabled=true then
  5. msgbox "网卡MAC地址是: " & mo.MacAddress
  6. exit for
  7. end if
  8. next
复制代码




测试你的显卡:


  1. On Error Resume Next
  2. Dim ye
  3. Dim yexj00
  4. set yexj00=GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_VideoController")
  5. for each ye in yexj00
  6. 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
  7. next
复制代码

http://xiaosu.blog.51cto.com/2914416/602516




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