Quantcast
Channel: All Data Protection posts
Viewing all articles
Browse latest Browse all 3480

Re: SnapCreator Powerhell cannot connect to snapcreator 4.3.0P3 Server

$
0
0

Hi,

 

Did the port number change during the upgrade? I had a look at the source code, it will default to 8443 if the port number is not provided.

Here is a sample of the source code, it fails with error "httpsConnectionFailed"before it fails it calls "ConnectHTTPS" which sets the port to 8443 (if it is not specified) (this.port.value : 8443)

 

 

		protected override void ProcessRecord()
		{
			if (string.IsNullOrEmpty(this.Name))
			{
				this.Name = "localhost";
			}
			ScServer server = new ScServer(this.Name);
			if (this.Credential == null)
			{
				base.ThrowTerminatingError(new ErrorRecord(new ArgumentNullException("Credentials not provided."), "CredentialsNotSpecified", ErrorCategory.InvalidArgument, null));
			}
			else
			{
				try
				{
					ConnectScServer.logger.Debug("Trying HTTPS");
					base.WriteVerbose("Trying HTTPS");
					this.ConnectHTTPS(server, this.Credential);
				}
				catch (Exception ex)
				{
					base.WriteError(new ErrorRecord(ex, "HttpsConnectionFailed", ErrorCategory.InvalidResult, server));
				}
			}
			if (server.EngineVersion == null)
			{
				ConnectScServer.logger.DebugFormat("Failed to connect to {0}", server.Hostname);
				base.WriteVerbose(string.Format("Failed to connect to {0}", server.Hostname));
				server = null;
			}
			else
			{
				ConnectScServer.logger.DebugFormat("Connected to {0} using {1}", server.Hostname, server.Protocol);
				base.WriteVerbose(string.Format("Connected to {0} using {1}", server.Hostname, server.Protocol));
			}
			if (!this.Transient)
			{
				this.SetSessionVariable(server);
			}
			base.WriteObject(server);
		}

		protected void ConnectHTTPS(ScServer server, PSCredential credentials)
		{
			server.Credentials = credentials.GetNetworkCredential();
			server.Port = (int)(this.Port.HasValue ? this.Port.Value : 8443);
			server.Protocol = ServerProtocol.HTTPS;
			ConnectScServer.logger.DebugFormat("Connecting to {0} via HTTPS", server.Hostname);
			this.GetEngineVersion(server);
			this.GetRbacVersion(server);
			this.GetRepositoryVersion(server);
			this.GetSchedulerVersion(server);
			this.GetStorageVersion(server);
		}

See the documentation here for checking\changing the port number

 

https://library.netapp.com/ecm/ecm_download_file/ECMLP2604630 (Page 15)

 

You could try specifying the port number when connecting. IE:

 

Param(
   [Parameter(Mandatory=$True, HelpMessage="The hostname or IP Address of the SnapCenter server")]
   [String]$HostName,
   [Parameter(Mandatory=$True, HelpMessage="The SnapCenter Port Number")]
   [Int]$PortNumber,
   [Parameter(Mandatory=$True, HelpMessage="The credentials to authenticate the to SnapCreator server")]   
   [System.Management.Automation.PSCredential]$Credentials
)
#'------------------------------------------------------------------------------
Import-Module SnapCreator -ErrorAction SilentlyContinue
Try{
   Connect-ScServer -Name $HostName -Port $PortNumber -Credential $credentials -ErrorAction Stop | Out-Null
   Write-Host "Connected to SnapCenter ""$HostName"" on port number ""$PortNumber"""
}Catch{
   Write-Warning -Message $("Failed connecting to SnapCenter ""$HostName"" on port number ""$PortNumber"". Error " + $_.Exception.Message)
   Break;
}
#'------------------------------------------------------------------------------

Then try connecting (assuming you save the above code as "C:\scripts\snapcreator\testconnect.ps1"). IE

 

 

PS C:\scripts\snapcreator>$credentials = Get-Credential -Credential admin
PS C:\scripts\snapcreator>.\testconnect.ps1 -HostName localhost -PortNumber 8443 -Credentials $credentials

I suspect it's more likely to be related to SSL\TLS security rather than an issue with the port number though.

Just trying to help eliminate the obvious first before troubleshooting further.

 

/Matt


Viewing all articles
Browse latest Browse all 3480

Trending Articles