@@ -4266,7 +4266,7 @@ function global:Connect-SgwServer {
42664266 if (!$Profile.Name) {
42674267 Throw "Profile $ProfileName not found and no name specified."
42684268 }
4269- $Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.DisableAutomaticAccessKeyGeneration -TemporaryAccessKeyExpirationTime $Profile.TemporaryAccessKeyExpirationTime -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -UseSso:$Profile.UseSso - Transient:$Transient -UseSso:$Profile.UseSso
4269+ $Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.DisableAutomaticAccessKeyGeneration -TemporaryAccessKeyExpirationTime $Profile.TemporaryAccessKeyExpirationTime -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -Transient:$Transient -UseSso:$Profile.UseSso
42704270 return $Server
42714271 }
42724272
@@ -4278,7 +4278,7 @@ function global:Connect-SgwServer {
42784278 BaseUri = "https://$Name/api/v2";
42794279 Session = New-Object -TypeName Microsoft.PowerShell.Commands.WebRequestSession
42804280 Headers = New-Object -TypeName Hashtable
4281- ApiVersion = 0;
4281+ ApiVersion = 0.0 ;
42824282 SupportedApiVersions = @();
42834283 S3EndpointUrl = $null;
42844284 SwiftEndpointUrl = $null;
@@ -4315,13 +4315,15 @@ function global:Connect-SgwServer {
43154315
43164316 $Body = ConvertTo-Json -InputObject $Body
43174317
4318- $ApiVersion = (Get-SgwVersion -Server $Server -ErrorAction Stop | Sort-Object | Select-Object -Last 1) -replace "\..*", ""
4318+ $ApiVersion = Get-SgwVersion -Server $Server -ErrorAction Stop
4319+ $ApiMajorVersion = ($ApiVersion | Sort-Object | Select-Object -Last 1) -replace "\..*", ""
43194320
4320- if (!$APIVersion ) {
4321+ if (!$ApiMajorVersion ) {
43214322 Throw "API Version could not be retrieved via https://$Name/api/versions"
43224323 }
43234324 else {
4324- $Server.BaseUri = "https://$Name/api/v$ApiVersion"
4325+ $Server.BaseUri = "https://$Name/api/v$ApiMajorVersion"
4326+ $Server.ApiVersion = $ApiVersion
43254327 }
43264328
43274329 if ($UseSso.IsPresent) {
0 commit comments