Use GetObject ("winmgmts:") to obtain system information

Source: Internet
Author: User

Use a WMI Object to list all processes in the system:

---- Instance. vbs ----


 ProgramCode

Dim WMI, objs

Set WMI = GetObject ("winmgmts :")

Set objs = WMI. instancesof ("win32_process ")

For each OBJ in objs

Enum1 = enum1 + obj. Description + CHR (13) + CHR (10)

Next

Msgbox enum1

Obtain the physical memory capacity:

----- Physicalmemory. vbs -----

Program code

Strcomputer = "."

Set wbemservices = GetObject ("winmgmts: \" & strcomputer)

Set wbemobjectset = wbemservices. instancesof ("win32_logicalmemoryconfiguration ")

For each wbemobject in wbemobjectset

Wscript. Echo "physical memory (MB):" & CINT (wbemobject. totalphysicalmemory/1024)

Next

Obtain all system services and running statuses

---- Service. vbs ----

Program code

Set serviceset = GetObject ("winmgmts:"). instancesof ("win32_service ")

Dim S, infor

Infor = ""

For each s in serviceset

Infor = infor + S. Description + "=>" + S. State + CHR (13) + CHR (10)

Next

Msgbox infor

Use a WMI Object to list all processes in the system:

---- Instance. vbs ----

Program code

Dim WMI, objs

Set WMI = GetObject ("winmgmts :")

Set objs = WMI. instancesof ("win32_process ")

For each OBJ in objs

Enum1 = enum1 + obj. Description + CHR (13) + CHR (10)

Next

Msgbox enum1

Obtain the physical memory capacity:

----- Physicalmemory. vbs -----

Program code

Strcomputer = "."

Set wbemservices = GetObject ("winmgmts: \" & strcomputer)

Set wbemobjectset = wbemservices. instancesof ("win32_logicalmemoryconfiguration ")

For each wbemobject in wbemobjectset

Wscript. Echo "physical memory (MB):" & CINT (wbemobject. totalphysicalmemory/1024)

Next

Obtain all system services and running statuses

---- Service. vbs ----

Program code

Set serviceset = GetObject ("winmgmts:"). instancesof ("win32_service ")

Dim S, infor

Infor = ""

For each s in serviceset

Infor = infor + S. Description + "=>" + S. State + CHR (13) + CHR (10)

Next

Msgbox infor

CPU serial number:

--- Cpuid. vbs ---

Program code

Dim cpuinfo

Cpuinfo = ""

Set MOC = GetObject ("winmgmts:"). instancesof ("win32_processor ")

For each MO in MoC

Cpuinfo = CSTR (Mo. processorid)

Msgbox "CPU serialnumber is:" & cpuinfo

Next

Hard Disk Model:

--- Hdid. vbs ---

Program code

Dim Hdid, MoC

Set MOC = GetObject ("winmgmts:"). instancesof ("win32_diskdrive ")

For each MO in MoC

Hdid = Mo. Model

Msgbox "Hard Disk Model:" & Hdid

Next

Nic MAC address:

--- Macaddress. vbs ---

Program code

Dim MC

Set MC = GetObject ("winmgmts:"). instancesof ("win32_networkadapterconfiguration ")

For each MO in MC

If mo. ipenabled = true then

Msgbox "Nic MAC address:" & Mo. macaddress

Exit

End if

Next

Test your video card:

Program code

On Error resume next

Dim ye

Dim yexj00

Set yexj00 = GetObject ("winmgmts: {impersonationlevel = impersonate}"). instancesof ("win32_videocontroller ")

For each ye in yexj00

Msgbox "No.:" & Ye. videoprocessor & vbcrlf & "Manufacturer:" & Ye. adaptercompatibility & vbcrlf & "name:" & Ye. name & vbcrlf & "status:" & Ye. status & vbcrlf & "memory:" & (ye. adapterram \ 1024000) & "MB" & vbcrlf & "drive (DLL):" & Ye. installeddisplaydrivers & vbcrlf & "drive (INF):" & Ye. inffilename & vbcrlf & "version:" & Ye. driverversion

Next

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.