HP Insight Management WBEM Providers User Manual

Page 21

Advertising
background image

For Each objOperationalStatus in objComputerSystem.OperationalStatus

WScript.Echo "Operational status: " & objOperationalStatus

Next

Next

The following VBScript code is used to display system firmware version:

strComputer = "."

strNamespace = "\root\hpq"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & strNamespace)

Set colSystemROMFirmware = objWMIService.ExecQuery("Select * from HP_SystemROMFirmware")

For Each objSystemROMFirmware in colSystemROMFirmware

WScript.Echo "Caption: " & objSystemROMFirmware.Caption

WScript.Echo "Version: " & objSystemROMFirmware.VersionString

WScript.Echo

Next

This VBScript code is used to display computer system chassis model name, serial number and
asset tag:

strComputer = "."

strNamespace = "\root\hpq"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & strNamespace)

Set colComputerSystemChassis = objWMIService.ExecQuery("Select * from HP_ComputerSystemChassis")

For Each objComputerSystemChassis in colComputerSystemChassis

WScript.Echo "Model: " & objComputerSystemChassis.Model

WScript.Echo "Serial number: " & objComputerSystemChassis.SerialNumber

WScript.Echo "Asset tag: " & objComputerSystemChassis.UserTracking

Next

This VBScript code is used to list system memory modules and their capacities:

strComputer = "."

strNamespace = "\root\hpq"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & strNamespace)

Set colMemoryModule = objWMIService.ExecQuery("Select * from HP_MemoryModule")

For Each objMemoryModule in colMemoryModule

WScript.Echo "Caption: " & objMemoryModule.Caption

WScript.Echo "Capacity (bytes): " & objMemoryModule.Capacity

Wscript.Echo

Next

This VBScript code is used to list system processors, current clock speed, and the number of enabled
cores:

strComputer = "."

strNamespace = "\root\hpq"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & strNamespace)

Set colProcessor = objWMIService.ExecQuery("Select * from HP_Processor")

For Each objProcessor in colProcessor

WScript.Echo "Caption: " & objProcessor.Caption

WScript.Echo "Description: " & objProcessor.Description

WScript.Echo "Current clock speed (MHz): " & objProcessor.CurrentClockSpeed

WScript.Echo "Number of enabled cores: " & objProcessor.NumberOfEnabledCores

Wscript.Echo

Next

Microsoft Visual Basic Scripting Edition examples

21

Advertising