diff --git a/src/Connection/Connect-To.ps1 b/src/Connection/Connect-To.ps1 index 95cb8c5..e709d7c 100644 --- a/src/Connection/Connect-To.ps1 +++ b/src/Connection/Connect-To.ps1 @@ -290,6 +290,33 @@ function Connect-To { return $handle } } + 'NetAppSGWS' { + # Construct the splatting for Connect-SgwServer + $params = @{ + Name = $RemoteHost + Credential = $creds + SkipCertificateCheck = $true + } + + # Check if -PassThru was passed. If so, a) do not set the default variable and b) return the + # session object to the caller. + if ($PSBoundParameters.ContainsKey('PassThru')) { + $params.Add('Transient', $true) + } + + try { + $SgwSession = Connect-SgwServer @params + } + + catch { + # Write a error message to the log. + Write-Error -Message ('Unable to connect to {0} using Type {1}.' -f $RemoteHost, $Type) + } + + if ($PSBoundParameters.ContainsKey('PassThru')) { + return $SgwSession + } + } 'SCP' { $WinSCPSessionParams = @{ Credential = $creds