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 ...
+
Release : 4.3
Component : Process Automation
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.
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:
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