Server Management - Remote Server Management
1753317 Members
6739 Online
108792 Solutions
New Discussion юеВ

VBscript and WMI to detect RILO cards

 
John Serban
New Member

VBscript and WMI to detect RILO cards

Is there a way to use vbscript and WMI to detect the presence of RILO cards on servers running Windows 2000 or Windows 2003
3 REPLIES 3
acartes
Honored Contributor

Re: VBscript and WMI to detect RILO cards

Finding the iLO/RILOE driver is easy (see below). Finding the hardware without the driver is a bigger problem. I think you'd have to enumerate Win32_PnPEntity objects looking for specific PCI ID's.

On Error Resume Next

Set Service = GetObject("winmgmts:").Get("Win32_BaseService.Name='CpqRib'")
If Err <> 0 Then
WScript.Echo "RILOE driver not installed"
ElseIf Service.State <> "Running" Then
WScript.Echo "RILOE driver not running"
Else
WScript.Echo "RILOE driver is running"
End If

Set Service = GetObject("winmgmts:").Get("Win32_BaseService.Name='CpqRib2'")
If Err <> 0 Then
WScript.Echo "RILOE II driver not installed"
ElseIf Service.State <> "Running" Then
WScript.Echo "RILOE II driver not running"
Else
WScript.Echo "RILOE II driver is running"
End If

Set Service = GetObject("winmgmts:").Get("Win32_BaseService.Name='CpqCiDrv'")
If Err <> 0 Then
WScript.Echo "iLO driver not installed"
ElseIf Service.State <> "Running" Then
WScript.Echo "iLO driver not running"
Else
WScript.Echo "iLO driver is running"
End If
acartes
Honored Contributor

Re: VBscript and WMI to detect RILO cards

Sorry for the yucky formatting. I can't control that.
John Serban
New Member

Re: VBscript and WMI to detect RILO cards

Thanks for the information. I had to modify the script because the values are drivers and not services. Below is the script to find the specific driver names.

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("Computer1")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SystemDriver where (Name = 'CpqRib'OR Name = 'CpqRib2'OR Name = 'CpqCiDrv'", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
WScript.Echo "AcceptPause: " & objItem.AcceptPause
WScript.Echo "AcceptStop: " & objItem.AcceptStop
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "CreationClassName: " & objItem.CreationClassName
WScript.Echo "Description: " & objItem.Description
WScript.Echo "DesktopInteract: " & objItem.DesktopInteract
WScript.Echo "DisplayName: " & objItem.DisplayName
WScript.Echo "ErrorControl: " & objItem.ErrorControl
WScript.Echo "ExitCode: " & objItem.ExitCode
WScript.Echo "InstallDate: " & WMIDateStringToDate(objItem.InstallDate)
WScript.Echo "Name: " & objItem.Name
WScript.Echo "PathName: " & objItem.PathName
WScript.Echo "ServiceSpecificExitCode: " & objItem.ServiceSpecificExitCode
WScript.Echo "ServiceType: " & objItem.ServiceType
WScript.Echo "Started: " & objItem.Started
WScript.Echo "StartMode: " & objItem.StartMode
WScript.Echo "StartName: " & objItem.StartName
WScript.Echo "State: " & objItem.State
WScript.Echo "Status: " & objItem.Status
WScript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
WScript.Echo "SystemName: " & objItem.SystemName
WScript.Echo "TagId: " & objItem.TagId
WScript.Echo
Next
Next


Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function