Start a Conversation

Solved!

Go to Solution

1 Rookie

 • 

2 Posts

62

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
Just curious if anyone had seen this or had an idea before I opened a support call.
No Responses!
No Events found!

Top