Thursday, August 11, 2011

Collect WWN

Due to recent works on migrating a large number of servers and SAN LUNs, I threw together this small script to collect WWN numbers (see WWN on Wikipedia) from servers. Maybe it can be useful for someone else?

Save the lines below as wwn.ps1 :

## WWN version 1.1
## Script to determine HBA WWNs on remote servers (Win 2003+)
## Usage: .\wwn.ps1 servername.domain.com

Param ($servername)

$data = Get-WmiObject -namespace "root\wmi" -class MSFC_FibrePortNPIVAttributes -computer $servername

$data | select WWPN | foreach {[array]::Reverse($_.WWPN); [BitConverter]::ToUInt64($_.WWPN, 0).ToString("X") }

5 comments:

Azam said...

it says invalid class...
I am trying to run from win2k3 box

Jakob Bindslet said...

It says "invalid class", because the required class "MSFC_FibrePortNPIVAttributes" isn't available on the server. Most likely vause: no HBA (host adapter bus) is installed in the server.

Farooque Mohammad said...

Can you please let me know the same command using WMIC? Need to run for server where Powershell is not installed

lee woo said...

It's just better to be yourself than to try to be some version of what you think the other person wants. See the link below for more info.


#version
www.ufgop.org

Silvia Jacinto said...

I accidentally viewed your blog and I was so amazed with your work that it touched the deepness of my heart and it made me sentimental. Thanks for posting. Visit my site too.

n8fan.net

www.n8fan.net