Unsolved
This post is more than 5 years old
6 Posts
0
82730
August 22nd, 2007 22:00
HOWTO: WMI Script to retrieve Dell hardware info
I struggled for quite a while trying to figure out how to extract hardware information from my Dell servers. Searching the Dell Forums revealed that a lot of people were looking to do the same thing. Answers were far and few between; when they did come, forum patrons were pushed towards using OpenManage Command Line Interface (of which I can't really get excited about).
After a couple hours with my nose inside WMI, I present to you the answers you seek:
Sub Get_Dell_Hardware (ByVal strComputer)
On Error Resume Next
Dim objInstance, colInstances, objProperty
Dim i, strTemp, intStartPosition, intEndPosition
Set colInstances = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2\dell:" & _
"Dell_CMDeviceApplication" ).Instances_
For Each objInstance In colInstances
WScript.Echo String(60,"=" )
For Each objProperty In objInstance.Properties_
intStartPosition = 0
intEndPosition = 0
strTemp = ""
If objProperty.Name = "Antecedent" Then
intStartPosition = InStr(objProperty.Value, "name=" ) + 6
intEndPosition = InStr(intStartPosition,objProperty.Value,Chr(34),1)-intStartPosition
strTemp = mid(objProperty.Value, _
intStartPosition, _
intEndPosition)
WScript.Echo "Device: " & strTemp
End If
intStartPosition = 0
intEndPosition = 0
strTemp = ""
If objProperty.Name = "Dependent" Then
intStartPosition = InStr(objProperty.Value, "name=" ) + 6
intEndPosition = InStr(intStartPosition,objProperty.Value,Chr(34),1)-intStartPosition
strTemp = mid(objProperty.Value, _
intStartPosition, _
intEndPosition)
WScript.Echo vbTab & "Subcomponent Device: " & strTemp
End If
intStartPosition = 0
intEndPosition = 0
strTemp = ""
If objProperty.Name = "Dependent" Then
intStartPosition = InStr(objProperty.Value, "version=" ) + 9
intEndPosition = InStr(intStartPosition,objProperty.Value,Chr(34),1)-intStartPosition
strTemp = mid(objProperty.Value, _
intStartPosition, _
intEndPosition)
If InStr(objProperty.Value, "FRMW" ) > 0 Then
WScript.Echo vbTab & "Firmware Version: " & strTemp
Elseif InStr(objProperty.Value, "DRVR" ) > 0 Then
WScript.Echo vbTab & "Driver Version: " & strTemp
Elseif InStr(objProperty.Value, "APP" ) > 0 Then
WScript.Echo vbTab & "Application Version: " & strTemp
Elseif InStr(objProperty.Value, "BIOS" ) > 0 Then
WScript.Echo vbTab & "BIOS Version: " & strTemp
Else
WScript.Echo vbTab & "Data Not Found"
End If
End If
Next
Next
End Sub
Big thanks to Marcin Policht who showed me how to program with WMI in ways Microsoft couldn't show me. http://www.serverwatch.com/tutorials/article.php/1548421
This was tested against a PowerEdge 1750 Server running Windows Server 2003 SP2 x86. OpenManage Server Administrator 5.1.0 was installed. The script was run from a Windows Vista Ultimate x32 workstation. Both machines are in the same domain. I used my Domain Admin account to run the script.
I received no errors during the running of the code, but due to the way code is displayed on this message forum, you might have an extra line break or other formatting error to fix before it will run right on your workstation. If you have comments, questions, or think you found a bug, lemee know here.
PS. Dell, you really need to add an option to disable emoticons. They show up in my code when I don't want them to. Second, you should consider adding the ability to display code in a forum post without removing the tab/space line formatting.
TAGS: VBS script WMI driver firmware hardware programmatically extract read
Message Edited by Turranx on 08-22-2007 07:59 PM
After a couple hours with my nose inside WMI, I present to you the answers you seek:
Sub Get_Dell_Hardware (ByVal strComputer)
On Error Resume Next
Dim objInstance, colInstances, objProperty
Dim i, strTemp, intStartPosition, intEndPosition
Set colInstances = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2\dell:" & _
"Dell_CMDeviceApplication" ).Instances_
For Each objInstance In colInstances
WScript.Echo String(60,"=" )
For Each objProperty In objInstance.Properties_
intStartPosition = 0
intEndPosition = 0
strTemp = ""
If objProperty.Name = "Antecedent" Then
intStartPosition = InStr(objProperty.Value, "name=" ) + 6
intEndPosition = InStr(intStartPosition,objProperty.Value,Chr(34),1)-intStartPosition
strTemp = mid(objProperty.Value, _
intStartPosition, _
intEndPosition)
WScript.Echo "Device: " & strTemp
End If
intStartPosition = 0
intEndPosition = 0
strTemp = ""
If objProperty.Name = "Dependent" Then
intStartPosition = InStr(objProperty.Value, "name=" ) + 6
intEndPosition = InStr(intStartPosition,objProperty.Value,Chr(34),1)-intStartPosition
strTemp = mid(objProperty.Value, _
intStartPosition, _
intEndPosition)
WScript.Echo vbTab & "Subcomponent Device: " & strTemp
End If
intStartPosition = 0
intEndPosition = 0
strTemp = ""
If objProperty.Name = "Dependent" Then
intStartPosition = InStr(objProperty.Value, "version=" ) + 9
intEndPosition = InStr(intStartPosition,objProperty.Value,Chr(34),1)-intStartPosition
strTemp = mid(objProperty.Value, _
intStartPosition, _
intEndPosition)
If InStr(objProperty.Value, "FRMW" ) > 0 Then
WScript.Echo vbTab & "Firmware Version: " & strTemp
Elseif InStr(objProperty.Value, "DRVR" ) > 0 Then
WScript.Echo vbTab & "Driver Version: " & strTemp
Elseif InStr(objProperty.Value, "APP" ) > 0 Then
WScript.Echo vbTab & "Application Version: " & strTemp
Elseif InStr(objProperty.Value, "BIOS" ) > 0 Then
WScript.Echo vbTab & "BIOS Version: " & strTemp
Else
WScript.Echo vbTab & "Data Not Found"
End If
End If
Next
Next
End Sub
Big thanks to Marcin Policht who showed me how to program with WMI in ways Microsoft couldn't show me. http://www.serverwatch.com/tutorials/article.php/1548421
This was tested against a PowerEdge 1750 Server running Windows Server 2003 SP2 x86. OpenManage Server Administrator 5.1.0 was installed. The script was run from a Windows Vista Ultimate x32 workstation. Both machines are in the same domain. I used my Domain Admin account to run the script.
I received no errors during the running of the code, but due to the way code is displayed on this message forum, you might have an extra line break or other formatting error to fix before it will run right on your workstation. If you have comments, questions, or think you found a bug, lemee know here.
PS. Dell, you really need to add an option to disable emoticons. They show up in my code when I don't want them to. Second, you should consider adding the ability to display code in a forum post without removing the tab/space line formatting.
TAGS: VBS script WMI driver firmware hardware programmatically extract read
Message Edited by Turranx on 08-22-2007 07:59 PM
No Events found!


Turranx
6 Posts
0
August 22nd, 2007 22:00
[Your Computer Name Here]
============================================================
Device: OpenManage Server Administrator
Subcomponent Device: OpenManage Server Administrator
Application Version: 5.1.0
============================================================
Device: BIOS
Subcomponent Device: BIOS
BIOS Version: A11
============================================================
Device: RAGE XL PCI Family (Microsoft Corporation)
Subcomponent Device: RAGE XL PCI Family (Microsoft Corporation) Driver
Driver Version: 5.10.2600.6014
============================================================
Device: DELL PERC 3/DC & PERC 3/DCL RAID Controller
Subcomponent Device: DELL PERC 3/DC & PERC 3/DCL RAID Controller Driver
Driver Version: 6.46.2.32
============================================================
Device: Dell PERC 3/Di RAID Controller
Subcomponent Device: Dell PERC 3/Di RAID Controller Driver
Driver Version: 2.8.0.6085
============================================================
Device: RAID Controller Component Device
Subcomponent Device: RAID Controller Component Device Driver
Driver Version: 6.35.2.32
============================================================
Device: PCI standard host CPU bridge
Subcomponent Device: PCI standard host CPU bridge Driver
Driver Version: 5.2.3790.0
============================================================
So forth and so on...
Message Edited by Turranx on 08-22-2007 08:00 PM
surfer2008
1 Message
0
March 27th, 2008 15:00
Hello Turranx:
Your script is exactly what I am looking for. Our datacenter has 211 Dell servers. I am newbie when it comes to scripting.
Copied the script onto notepad and renamed the extension to vbs. I don’t know how to initialize it. Do I use cscript and what is the syntax?.I’d appreciate any suggestions you can offer.
Thanks in advance.
Surfer2008
Surfer2008