the last 4 digits of the disk ID tend to be the LUN number, if i remember correctly.
please ignore the gay way of writing an xml file ;-), something might be of use?
objTS.WriteLine vbTab & vbTab & "<possibleluns>"
Dim strDiskNames, arrDiskNames, dic2Check, colDiskDrives, aDiskDrive, aDiskName
Set dic2Check = CreateObject("Scripting.Dictionary")
'might need to change this string, yuk, in a hurry
strDiskNames = "EMC;Qlogic"
arrDiskNames = Split(strDiskNames, ";")
For Each strTemp In arrDiskNames
If Not dic2Check.Exists(strTemp) Then
dic2Check.Add strTemp, "1"
End If
Next
' Get physical disk drive
Set colDiskDrives = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive")
For Each aDiskDrive In colDiskDrives
For Each aDiskName In dic2Check
If InStr(LCase(aDiskDrive.Caption), LCase(aDiskName)) Then
strTemp = ""
If Len(aDiskDrive.PNPDeviceID) > 3 Then
'this bit is well dodgy, get the LUN number from the last 3 digits!
strTemp = Right(aDiskDrive.PNPDeviceID, 4)
'If IsNumeric(strTemp) Then
If strTemp <> "0000" Then 'this one is the funny blank one which i dont really know what it is for SAN magic
objTS.WriteLine vbTab & vbTab & vbTab & "<possiblelun>"
objTS.WriteLine vbTab & vbTab & vbTab & vbTab & "<lunnumber>" & strTemp & "</lunnumber>"
On Error Resume Next
objTS.WriteLine vbTab & vbTab & vbTab & vbTab & "<size>" & (aDiskDrive.Size)/(1024*1024) & "</size>"
On Error Goto 0
objTS.WriteLine vbTab & vbTab & vbTab & vbTab & "<caption>" & aDiskDrive.Caption & "</caption>"
objTS.WriteLine vbTab & vbTab & vbTab & vbTab & "<pnpdeviceid>" & Replace(aDiskDrive.PNPDeviceID, "&", "*") & "</pnpdeviceid>"
'WScript.Echo CStr(strTemp & "=" & aDiskDrive.Index & "=" & aDiskDrive.Caption & "=" & aDiskDrive.PNPDeviceID)
objTS.WriteLine vbTab & vbTab & vbTab & "</possiblelun>"
End If
'End If
End If
End If
Next
Next
Set colDiskDrives = Nothing
objTS.WriteLine vbTab & vbTab & "</possibleluns>"
I Hear, I Forget
I See, I Remember
I Do, I Understand
Ronald McDonald