{"id":259,"date":"2018-03-08T09:32:28","date_gmt":"2018-03-08T08:32:28","guid":{"rendered":"https:\/\/blog.van-daag.nl\/?p=259"},"modified":"2018-03-08T09:33:00","modified_gmt":"2018-03-08T08:33:00","slug":"259","status":"publish","type":"post","link":"https:\/\/van-daag.nl\/?p=259","title":{"rendered":"Finding WWN\u2019s on Windows Server 2012 Using PowerShell"},"content":{"rendered":"
With a single command you can retrieve WWN\u2019s on Windows Server 2012 R2 using PowerShell.<\/p>\n
Open the PowerShell command and type:<\/p>\n
Get-WmiObject -class MSFC_FCAdapterHBAAttributes -namespace \u201croot\\WMI\u201d | ForEach-Object {(($_.NodeWWN) | ForEach-Object {\u201c{0:x}\u201d -f $_}) -join \u201c:\u201d}<\/strong><\/p>\n And that is all there is to it. Simple and fast using PowerShell.<\/p>\n Update:<\/strong>\u00a0I have been been made aware of another way to get the WWN on Windows 2012 R2 with a cmdlet called\u00a0get-initiatorport<\/strong>\u00a0which was added to Windows Server 2012 R2. This is a much cleaner way of retrieving the WWN\u00a0information<\/span><\/span>\u00a0instead of the WMI call.<\/p>\n <\/p>\n You can also filter the\u00a0display<\/span><\/span>\u00a0and just get the PortAddress<\/p>\n More information on get-initiatorport and many other\u00a0storage<\/span><\/span>\u00a0related cmdlets can be found\u00a0here<\/a>!<\/p>\n <\/p>\nPS C:\\> Get-InitiatorPort\r\n\r\nInstanceName NodeAddress PortAddress ConnectionType\r\n------------ ----------- ----------- --------------\r\nPCI\\VEN_10DF&DEV_F100&SUBS... 20000090fa56b930 10000090fa56b930 Fibre Channel\r\nPCI\\VEN_10DF&DEV_F100&SUBS... 20000090fa56b931 10000090fa56b931 Fibre Channel<\/pre>\n
PS C:\\> Get-InitiatorPort | Select-Object -Property PortAddress | Format-Table -AutoSize\r\n\r\nPortAddress\r\n-----------\r\n10000090fa56b930\r\n10000090fa56b931<\/pre>\n