Subscribe

cmdlet to set wwpn-alias in cdot

[ Edited ]

Looking for a way to use WFA to set wwpn-alias in cDOT 8.2

Re: cmdlet to set wwpn-alias in cdot

Does this Cmdlet meet the requirement?

 

PS C:\Users\administrator.SMIS-RTP1> Get-Help Set-NcFcpPortNameAlias

NAME
    Set-NcFcpPortNameAlias

SYNOPSIS
    Set an alias for a World Wide Port Name of an initiator that might login to the target.


SYNTAX
    Set-NcFcpPortNameAlias [-Wwpn] <String> [-Alias] <String> [-Force] [-VserverContext <String>] [-Controller <NcController[]>]
    [<CommonParameters>]


DESCRIPTION
    Set an alias for a World Wide Port Name of an initiator that might login to the target.


RELATED LINKS
    Get-NcFcpPortNameAlias
    Clear-NcFcpPortNameAlias

REMARKS
    To see the examples, type: "get-help Set-NcFcpPortNameAlias -examples".
    For more information, type: "get-help Set-NcFcpPortNameAlias -detailed".
    For technical information, type: "get-help Set-NcFcpPortNameAlias -full".
    For online help, type: "get-help Set-NcFcpPortNameAlias -online"

Re: cmdlet to set wwpn-alias in cdot

Here is code for the cmdlet

 

param (
[parameter(Mandatory=$true, HelpMessage="Cluster name or IP address")]
[string]$Cluster,
[parameter(Mandatory=$true, HelpMessage="Storage Virtual Machine name")]
[string]$VserverName,
[parameter(Mandatory=$true, HelpMessage="FCP Alias Name wwpn alias")]
[string]$Alias,
[parameter(Mandatory=$true, HelpMessage="wwpn address")]
[string]$wwpn,
[parameter(Mandatory=$false, HelpMessage="forecelly")]
[bool]$Force
)
# connect to cluster
Connect-WfaCluster $Cluster

try
{
$expression = "Set-NcFcpPortNameAlias -VserverContext "+ $VserverName +" -wwpn " + $wwpn + " -alias "+ $Alias
if ($Force)
{
$expression = $expression + " -Force "

}
Get-WFALogger -Info -message $("Setting up FCP WWPN Alias : " + $VserverName + " belonging to Cluster: "+ $Cluster + " using the expression: "+ $expression)
Invoke-Expression $expression -ErrorAction Stop
}
catch
{
$msg = "Setting up FCP WWPN Alias: " + $VserverName + ". Message: " + $_.Exception.Message
throw $msg
}