Reputation: 107
I am using WMI Classes to query all kinds of information from servers. The reason I am using WMI Objects is because I work with versions of Windows Server 2003 to Windows Server 2022 (PS 1.0 to 5.X). But now I need to query FC ports in multiple physical servers.
I have tried the following classes which return some useful properties but none about the operating status of the FC ports:
root\CIMV2: Win32_SCSIController
root\WMI: MSFC_FibrePortHBAStatistics
root\WMI: MSFC_FibrePortHBAAttributes
root\WMI: MSFC_HBAPortAttributesResults
root\WMI: MSFC_FCAdapterHBAAttributes
root\WMI: MSFC_HBAFCPInfo
root\WMI: MSFC_HBAPortStatistics
What I need is very simple which is basically counting the total of FC ports and then indicate many of those are active ports. Lets say I have 4 FC ports and only 2 are connected and linking so my output should be something like this:
Number of FC ports: 4
Number of used FC ports: 2
Unfortunately, the closest operational indication I was able to get was HBA_STATUS and Active properties which my guess is it only indicates administrative status. As a test I tried installing Fiber Channel Information Tool (fcinfo) and I get this output which is great and exactly what I need but installing the software is not an option:
PS C:\Users\Administrator> fcinfo.exe /ports
com.qlogic-QLE2692-0, num: 1
-----------------------------------------------------------------------------
| Type State Speed WWN PortWWN |
-----------------------------------------------------------------------------
Unknown, linkdown, unkn, 20:00:34:80:0d:f2:8c:2c, 21:00:34:80:0d:f2:8c:2c
com.qlogic-QLE2692-1, num: 1
-----------------------------------------------------------------------------
| Type State Speed WWN PortWWN |
-----------------------------------------------------------------------------
Unknown, linkdown, unkn, 20:00:34:80:0d:f2:8c:2d, 21:00:34:80:0d:f2:8c:2d
com.qlogic-QLE2692-2, num: 1
-----------------------------------------------------------------------------
| Type State Speed WWN PortWWN |
-----------------------------------------------------------------------------
Unknown, linkdown, unkn, 20:00:34:80:0d:f2:8c:6e, 21:00:34:80:0d:f2:8c:6e
com.qlogic-QLE2692-3, num: 1
-----------------------------------------------------------------------------
| Type State Speed WWN PortWWN |
-----------------------------------------------------------------------------
Unknown, linkdown, unkn, 20:00:34:80:0d:f2:8c:6f, 21:00:34:80:0d:f2:8c:6f
Any other way to query the state of the HBA ports and could work in as many as possible PS Versions is welcomed, but then again installing FCInfo is not an option.
Upvotes: 0
Views: 4778