HBA PortWWN From WMI

(imported topic written by Steve91)

Hi Guys

Not sure this is totally possible, I’m trying to query some HBA’s and return amongst other info the Node WWN and Port WWN

Node WWN is fine with the below query:

q: (integer values of selects “NodeWWN from MSFC_FCAdapterHBAAttributes” of wmi “root\wmi” as hexadecimal)

A: 20

A: 0

A: 0

A: e0

A: 8b

A: 82

A: a0

A: 86

A: 20

A: 0

A: 0

A: e0

A: 8b

A: 81

A: 6d

A: 8b

A: 20

A: 0

A: 0

A: e0

A: 8b

A: 82

A: a3

The problem I have is with the PortWWN. VBScript example below:

’ (VBScript)

Set enumSetAdapters = oWbemServices.InstancesOf(“MSFC_FCAdapterHBAAttributes”)

Set enumSetPorts = oWbemServices.InstancesOf(“MSFC_FibrePortHBAAttributes”)

nIndex = 0

For Each oEltAdapter in enumSetAdapters

For Each oEltPort in enumSetPorts

If (oEltAdapter.InstanceName = oEltPort.InstanceName) Then

sAdapterName = oEltAdapter.MfgDomain & _

“-” & oEltAdapter.Model & “-” & nIndex

WScript.Echo " adapter: " & sAdapterName

WScript.Echo " node_wwn: " & WWNToString(oEltAdapter.NodeWWN)

WScript.Echo " port_wwn: " & _

WWNToString(oEltPort.Attributes.PortWWN)

WScript.Echo

nIndex = nIndex + 1

End If

Next ’ oEltPort

Next ’ oEltAdapter

Note that this script gets the PortWWN property, but not directly from an instance of MSFC_FibrePortHBAAttributes. Instead, it must get PortWWN from an embedded Attributes property, which references an instance of the MSFC_HBAPortAttributesResults class.

Is this possible with a WMI query in BigFix?

Cheers

(imported comment written by BenKus)

What does it return if you do this query:

q: selects “* from MSFC_FCAdapterHBAAttributes” of wmi “root\wmi”

Ben

(imported comment written by sowensby91)

I am interested in the same thing. Here is the output I get:

Q: selects "* from MSFC_FCAdapterHBAAttributes" of wmi "root\wmi"
A: Active=True
A: DriverName=ql2300.sys
A: DriverVersion=9.1.4.15
A: FirmwareVersion=3.03.21
A: HardwareVersion=
A: HBAStatus=0
A: InstanceName=PCI\VEN_1077&DEV_2312&SUBSYS_01000E11&REV_02\4&2534a57b&0&4858_0
A: Manufacturer=QLogic Corporation
A: MfgDomain=com.qlogic
A: Model=QLA2312
A: ModelDescription=QLogic QLA2312 Fibre Channel Adapter
A: NodeSymbolicName=QLA2312 FW:v3.03.21 DVR:v9.1.4.15
A: NodeWWN= ???
A: NumberOfPorts=1
A: OptionROMVersion=1.43
A: SerialNumber=G87651
A: UniqueAdapterId=0
A: VendorSpecificID=588385809
A: Active=True
A: DriverName=ql2300.sys
A: DriverVersion=9.1.4.15
A: FirmwareVersion=3.03.21
A: HardwareVersion=
A: HBAStatus=0
A: InstanceName=PCI\VEN_1077&DEV_2312&SUBSYS_01000E11&REV_02\4&2534a57b&0&5058_0
A: Manufacturer=QLogic Corporation
A: MfgDomain=com.qlogic
A: Model=QLA2312
A: ModelDescription=QLogic QLA2312 Fibre Channel Adapter
A: NodeSymbolicName=QLA2312 FW:v3.03.21 DVR:v9.1.4.15
A: NodeWWN= ???
A: NumberOfPorts=1
A: OptionROMVersion=1.43
A: SerialNumber=K38548
A: UniqueAdapterId=0
A: VendorSpecificID=588385809
 
Q: (integer values of selects "NodeWWN from MSFC_FCAdapterHBAAttributes" of wmi "root\wmi" as hexadecimal)
A: 20
A: 0
A: 0
A: e0
A: 8b
A: a
A: 23
A: 7e
A: 20
A: 0
A: 0
A: e0
A: 8b
A: f
A: d4
A: d8

(imported comment written by SystemAdmin)

FYI: this information is only available after you install the Fibre Channel Information Tool (fcinfo) from Microsoft

http://www.microsoft.com/downloads/details.aspx?FamilyID=73d7b879-55b2-4629-8734-b0698096d3b1&displaylang=en

Any way to get this into a more presentable format for an analysis?

Q: (integer values of selects “NodeWWN from MSFC_FCAdapterHBAAttributes” of wmi “root\wmi”) as hexadecimal
A: 20
A: 0
A: 0
A: e0
A: 8b
A: 9b
A: 44
A: c5
A: 20
A: 0
A: 0
A: e0
A: 8b
A: 9b
A: 8e
A: c2

I would love for it to read this way:
A: 20:00:00:e0:8b:9b:44:c5
A: 20:00:00:e0:8b:9b:8e:c2

I haven’t tested this, and I’m fairly sure there are easier ways of achieving this, but how about trying the following:

(following texts whose (number of substrings “:” of it is 7) of substrings “:” of preceding texts whose (number of substrings “:” of it mod 8 is 0) of substrings “:” of it) of (“:” & concatenation “:” of ((integer values of selects “NodeWWN from MSFC_FCAdapterHBAAttributes” of wmi “root\wmi”) as hexadecimal as string) & “:”)

Poof Mind Blown

Thanks! It works but let me know if there is an easier way.

How can I have leading 0’s added?

Example of what is returned:
A: 20:0:0:e0:8b:9b:4:c5
A: 20:0:0:e0:8b:9b:e:c2

Example of what I’d like to have returned:
A: 20:00:00:e0:8b:9b:04:c5
A: 20:00:00:e0:8b:9b:0e:c2

You would have to add something like this:

Q: (if length of it < 2 then "0" & it else it ) of "0"
A: 00

to the expression @Aram gave so something like this (but haven’t tested it either)

(following texts whose (number of substrings ":" of it is 7) of substrings ":" of preceding texts whose (number of substrings ":" of it mod 8 is 0) of substrings ":" of it) of (":" & concatenation ":" of ((if length of it < 2 then "0" & it else it ) of ((integer values of selects "NodeWWN from MSFC_FCAdapterHBAAttributes" of wmi "root\wmi") as hexadecimal as string)) & ":")
1 Like