1 Rookie
•
2 Posts
0
72
November 7th, 2024 22:39
Powerscale API Not Returning Invoke-RestMethod
Hey all, got a question if anyone has seen this before. I'm writing some custom powershell to parse some information from our isilons. Last night when I was working on it, everything was returning 100% fine, but when I came in this morning I was unable to parse anything from an Invoke-RestMethod call. Even when taking the commands out of the script and running them individually it fails.
So here's the function I'm calling in powershell:
functionGet-AccessZones {
param (
[string]$IsilonIP
)
try {
# Access zone endpoint
$accessZoneEndpoint="https://${IsilonIP}:8080/platform/1/zones"
$zoneResponse=Invoke-RestMethod-Uri $accessZoneEndpoint-Headers $AuthHeader-Method Get -UseBasicParsing
return$zoneResponse.zones.name# Return array of zone names
}
catch {
Write-Host"Failed to retrieve access zones from $IsilonIP"-ForegroundColor Red
return@() # Return empty array on failure
}
}
and then the call in my code:
$accessZones=Get-AccessZones-IsilonIP $CurrentIP
if ($accessZones.Count-eq0) {
Write-Host"No access zones found for $CurrentSite at IP $CurrentIP"-ForegroundColor Red
continue
}
Even if I hit the URL'https://${IsilonIP}:8080/platform/1/zones' in my browser, it authenticates properly and displays the info properly. But even if I come straight to a shell outside my script and run:
Invoke-RestMethod -Uri https://${IsilonIP}:8080/platform/1/zones -Headers $AuthHeader -Method Get -UseBasicParsing
It returns:
Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.
At line:1 char:1
+ Invoke-RestMethod -Uri $snapshotsEndpoint -Headers $AuthHeader -Metho ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
At line:1 char:1
+ Invoke-RestMethod -Uri $snapshotsEndpoint -Headers $AuthHeader -Metho ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Just curious if anyone had seen this or had an idea before I opened a support call.
No Events found!



BerkleyStarks
1 Rookie
•
2 Posts
0
November 11th, 2024 17:44
Just for the answer. I thought I had SSL right on my server, but the self signed certs and everything weren't right. Was able to bypass the error by adding
To my script, and fix permanently by importing our wildcard SSL cert to the HTTPS site.