PowerShell advanced function (cmdlet) to get WWN (PWWN) of all cluster nodes

I wrote a very simple PowerShell script (Advanced Function) that will simplify process to add a new disk to any failover cluster (Hyper-V, SQL) that is connected to SAN via Fibre Channel.

If you need WWN (PWWN) of all nodes in the cluster then you need to know only a name of a single node or name of the cluster.


Enter node name

Get-ClusterNodeInitiatorPort -Cluster OneOfMyNode |
    Export-Csv -Path 'C:\Temp\data.csv'

Enter cluster Name

Get-ClusterNodeInitiatorPort -Cluster MyCluster |
    Format-Table -AutoSize


Function Get-ClusterNodeInitiatorPort
        Enter name of the cluster or any node and get all node names and their WWN (PWWN)

            Developer: Rudolf Vesely, http://rudolfvesely.com/
            Copyright (c) Rudolf Vesely. All rights reserved
            License: Free for private use only

            "RV" are initials of the developer's name Rudolf Vesely and distingue names of Rudolf Vesely's cmdlets from the other cmdlets.

            Enter name of the cluster or any node and get all node names and their WWN (PWWN).

            Developed and tested using PowerShell 4.0.

    .PARAMETER Cluster
        Name of cluster or node.

        'EXAMPLE: Enter name of the cluster or any node'
        Get-ClusterNodeInitiatorPort -Cluster MyCluster |
            Format-Table -AutoSize




        DefaultParametersetName = 'Cluster',
        SupportsShouldProcess = $true,
        PositionalBinding = $false,
        HelpURI = 'https://techstronghold.com/',
        ConfirmImpact = 'Medium'

            Mandatory = $true,
            Position = 0,
            ParameterSetName = 'Cluster',
            ValueFromPipelineByPropertyName = $true
        [ValidateLength(1, 255)]

        # Configurations
        $ErrorActionPreference = 'Stop'
        if ($PSBoundParameters['Debug']) { $DebugPreference = 'Continue' }
        Set-PSDebug -Strict
        Set-StrictMode -Version Latest

        foreach ($clusterItem in $Cluster)
            $clusterNodeItems = Get-ClusterNode -Cluster $clusterItem |
                Select-Object -ExpandProperty Name

            foreach ($clusterNodeItem in $clusterNodeItems)
                $items = Invoke-Command -ComputerName $clusterNodeItem -ScriptBlock { Get-InitiatorPort }

                foreach ($item in $items)
                        Computername    = $clusterNodeItem
                        NodeAddress     = $item.NodeAddress
                        PortAddress     = $item.PortAddress


Leave a Reply

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

Active Directory Advanced function AlwaysOn Availability Groups AlwaysOn Failover Cluster Instances Building Cloud Cloud Cluster Cmdlet Database Deployment Design DFS Domain Controller DSC Fabric Failover Clustering File Server Group Policy Hardware Profile Host Hyper-V Installation Library Library Asset Library Server Network Operations Manager Orchestrator PowerShell PowerShell User Group PowerShell Workflow Security Service Manager SQL Server Storage System Center Template Time Time Synchronization Tips Virtual Machine Virtual Machine Manager VM Network VM Template Windows Server 2012 R2