search
top

Finding WWN’s on Windows Server 2012 Using PowerShell

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 “:”}

2012wwn

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!

 

6 Responses to “Finding WWN’s on Windows Server 2012 Using PowerShell”

  1. pham says:

    how did you get the MSFC_FCAdapterHBAAttributes on windows 2012 server.
    running
    gwmi -list -namespace root\wmi | Sort-Object Name
    does not give me the class you defined
    OS Windows 2012 R2 Datacenter

  2. thedeamon says:

    why not just go simpler with

    get-initiaotorport

    • newlife007 says:

      Awesome, didn’t know that cmdlet existed in 2012 R2. Thanks for the tip I have added it to the post. Would be cooler if Microsoft added the ability to upgrade PowerShell on 2008 R2 and get the new cmdlet. Tried updating to PowerShell 4 with .NET 4.51 and didn’y appear.

  3. ALi says:

    Its works very well on windows server 2012 R2 Standard. Many thanks

  4. Ivan says:

    it’s work. thx.

Leave a Reply

Your email address will not be published. Required fields are marked *

top