Subscribe

Powershell connectivity issue to Cdot

I have a problem with connecting to a CDot enviroment,

 

I am using the following command: Connect-NcController - Name clustername -Credential domain\dwes , after this command i got the following error:

 

 

Connect-NcController : Object reference not set to an instance of an object.
At line:1 char:21
+ Connect-NcController <<<<  -Name clustername  -Credential domain\dwes
    + CategoryInfo          : InvalidResult: (clustername:NcController) [Connect-NcController], NullReferenceExceptio
   n
    + FullyQualifiedErrorId : HttpConnectionFailed,DataONTAP.C.PowerShell.SDK.ConnectNcController

 

I can connect to the cluster using port 443, i have tested that with a telnet session and a browser session

 

Does anyone have a idea to solve this issue 

Re: Powershell connectivity issue to Cdot

Hi DWes,

 

Have you tried the '-HTTPS' switch to force a HTTPS connection? May be your cluster allows only secure connection, not HTTP?

    The command would be ''Connect-NcController -Name clusterController -Credential domain\dwes -HTTPS'.

 

Other than this, I can only think of the usual suspect - a name resolution failure.

 

Hope this helps,

Aparajita

 

Re: Powershell connectivity issue to Cdot

Can you please provide the output of the following commands :

1)      PowerShell version:

Example:

PS C:\> $host.version

 

Major  Minor  Build  Revision

-----  -----  -----  --------

4      0      -1     -1

 

2)      NetApp Toolkit Version:

PS C:\> Get-NaToolkitVersion

 

Major  Minor  Build  Revision

-----  -----  -----  --------

3      2      1      68

 

Thank you

Re: Powershell connectivity issue to Cdot

Hi DWes,

Have you tried connecting with the -Credential admin instead of your domain account?

Example:
Connect-NcController - Name clustername -Credential Admin

Also, what version of cDOT are you running?

I hope this helps,
Jason

Re: Powershell connectivity issue to Cdot

I think the "-Credential" must be given a Powershell Credential object, not just a username

 

Maybe try the following:

 

Connect-NcController -Name <IP or name> -Credential (Get-Credential)

 

That might solve it...?

Re: Powershell connectivity issue to Cdot

Forget it, sorry I didn't read enough and just saw the cmdlet also works with a username instead of full credential object.

 

I'd also reommend using -HTTPS parameter, since the error says "cannot connect"...

 

Re: Powershell connectivity issue to Cdot

Hi Lorenzo,

 

My versions,

 

$Host.version

 

Major Minor Build revision

2        0       -1     -1 

 

Get-Natoolkitversion

 

Major  MInor  Build  Revision

3         2        0        65

 

 

 

Re: Powershell connectivity issue to Cdot

Have you check that you have the required build of .NET 3.5 installed?

Re: Powershell connectivity issue to Cdot

[ Edited ]

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.