beautypg.com

Microsoft visual basic scripting edition examples – HP Insight Management WBEM Providers User Manual

Page 19

background image

File name

Version

Profile name

P00123_-_HP_SCSI_HBA_Profile.pdf

1.0.1

P00123 HP SCSI HBA Profile

P00124_-_HP_Location_Profile.pdf

1.1.0

P00124 HP Location Profile

P00125_-_HP_Blade_System_Lite_Profile.pdf

2.1.0

P00125 HP Blade System Lite Profile

P00129_-_HP_Standalone_Tape_Drive_profile.pdf

1.0.0

P00129 HP Standalone Tape Drive
Profile

P00130_-_HP_Host_Attached_SATA_profile.pdf

1.0.0

P00130 HP Host Attached SATA
Profile

Microsoft Visual Basic Scripting Edition examples

You can write scripts to obtain data from the Insight Providers using Microsoft® Visual Basic
Scripting Edition (VBScript) or any other scripting language that supports Microsoft® ActiveX.

The following are example codes for accessing Insight Provider data using VBScript code.

This VBScript code is used to display computer system operational status information:

strComputer = "."

strNamespace = "\root\hpq"

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

Set colComputerSystem = objWMIService.ExecQuery("Select * from HP_WinComputerSystem")

For Each objComputerSystem in colComputerSystem

WScript.Echo "Caption: " & objComputerSystem.Caption

For Each objStatusDescription in objComputerSystem.StatusDescriptions

WScript.Echo "Status description: " & objStatusDescription

Next

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

Microsoft Visual Basic Scripting Edition examples

19