Unable to connect to the remote server

book

Article ID: 225168

calendar_today

Updated On:

Products

CA Process Automation Base

Issue/Introduction

We are executing a rest call while using the "Run Script" operator. The inline script of the .ps1 uses the powershell cmdlets: invoke-restmethod or invoke-webrequest

However, when executing the operator it returns the following error:

 

SYSTEM

Invoke-RestMethod: Unable to connect to the remote server

At C:\Temp\.c2otmp\dc200559-aa2c-4795-b49a-5508be322cb7\c2ouscript.ps1:23

char:1

+ Invoke-RestMethod -Uri $uri -Credential $cred -Method Get -ContentType ...

+

Environment

Release : 4.3

Component : Process Automation

 

Resolution

The problem was solved after adding the URL to the trusted sites. The issue was with trusted zones and worked once the site was added to the trusted site list to execute api calls. This is an operator system / browser setting. Not an ITPAM setting. 

Additional Information

If you are experiencing this type of issue than executing the following powershell statements may help you isolate the cause. It is recommended to execute these statements:

  • Across several machines. With the same version of powershell as the problematic server. If the same operator works on a different machine, compare powershell versions on the two systems. 
  • Through itpam and also manually executing it on the servers

 

Powershell statements: 

  • Get-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

  • [System.Net.WebProxy]::GetDefaultProxy() | select address

  • [System.Net.WebProxy]::GetDefaultProxy()

     

  • $IESettings = Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'

  • $Proxy = "http://$(($IESettings.ProxyServer.Split(';') | ? {$_ -match 'ttp='}) -replace '.*=')"

  • $Proxy

  • $(get-item "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey").property

  • $(get-item "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey").property