This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using invoke-restmethod from a remote machine

I am trying to get invoke-restmethod working from a remote machine.

I started experimenting with a very simple command to return all the agents.

invoke-restmethod -uri 'https://[server ip]:8006/apprecovery/api/core/agents/' -method "Get" -Credential $cred

The credential is generated with Get-Credential and I have [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} to address the self-signed cert.

I am getting a generic error:

invoke-restmethod : The underlying connection was closed: An unexpected error occurred on a send.
At line:1 char:1
+ invoke-restmethod -uri 'https://[server ip]:8006/apprecovery/api/cor ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Any ideas where to go from here or were I may find more logs on the RR server?

It does load just fine from the same machine using a browser after the authentication prompt.