With a single command you can retrieve WWN’s on Windows Server 2012 R2 using PowerShell.

Open the PowerShell command and type:

Get-WmiObject -class MSFC_FCAdapterHBAAttributes -namespace “root\WMI” | ForEach-Object {(($_.NodeWWN) | ForEach-Object {“{0:x}” -f $_}) -join “:”}

And that is all there is to it. Simple and fast using PowerShell.

Update: I have been been made aware of another way to get the WWN on Windows 2012 R2 with a cmdlet called get-initiatorport which was added to Windows Server 2012 R2. This is a much cleaner way of retrieving the WWN information instead of the WMI call.

 

PS C:\> Get-InitiatorPort

InstanceName NodeAddress PortAddress ConnectionType
------------ ----------- ----------- --------------
PCI\VEN_10DF&DEV_F100&SUBS... 20000090fa56b930 10000090fa56b930 Fibre Channel
PCI\VEN_10DF&DEV_F100&SUBS... 20000090fa56b931 10000090fa56b931 Fibre Channel

You can also filter the display and just get the PortAddress

PS C:\> Get-InitiatorPort | Select-Object -Property PortAddress | Format-Table -AutoSize

PortAddress
-----------
10000090fa56b930
10000090fa56b931

More information on get-initiatorport and many other storage related cmdlets can be found here!

 

Site