Hi,
The Credential Parameter for the "Connect-NcController" CmdLet accepts a Credential object of type "System.Management.Automation.PSCredential" so you can't use a string containing the username.
See "Get-Help Connect-NcController -full | more" and browse through the parameter help documentation for the -Credential paramater.
-Credential <PSCredential>
A System.Management.Automation.PSCredential object containing the credentials needed to log into the storage controller.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
Here is an example for you demonstrating how to connect to the cluster using the credential object:
#'------------------------------------------------------------------------------
#'Connect to the cluster
#'------------------------------------------------------------------------------
Import-Module DataONTAP
$clusterName = "cluster1"
$userName = "admin"
$credentials = $host.ui.PromptForCredential("Connect to cluster ""$ClusterName""", "Please enter the user name and password", $userName, "")
Try{
Connect-NcController -Name $ClusterName -Credential $credentials -HTTPS -ErrorAction Stop
}Catch{
Write-Warning -Message $("Failed Connecting to ""$ClusterName"". Error " + $_.Exception.Message)
Break;
}
#'------------------------------------------------------------------------------
Change the variable "$username" as required. EG from "admin" to "domain\dwes".
Hope that helps.
/matt
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.