Hi,
I am trying to integrate with the Manage Engine Password Manager PRO Rest API.. I have some code working on my desktop where I currently use PowerGUI this was all seemingly working correctly.. I have then gone to execute the code from a window on the same machine and it doesn't work. I have also tried it in ISE with the same error...
Now the odd thing is if I choose "run in external window" from powergui and then run the script it works fine..
What the hell is going on for this window and the powergui console to be different?
the error I am getting is:
Invoke-RestMethod : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
which I would expect if I was running the code on a machine where the Auth Code isn't registered, as you link an API user to a hostname..
code:
$inputData = @"
INPUT_DATA={"operation":{"Details":{"RESOURCENAME":"PLdwdwd999","ACCOUNTNAME":"fefefeL999-Wallis-SQLSV","RESOURCETYPE":"Windows","PASSWORD":"fefefefef","NOTES":"fefefwerhthrtbrbr","RESOURCEURL":"http://192.168.0.1",
}
}
}"@
$uri = "https://xxxwintspmp001:7272/restapi/json/v1/resources?AUTHTOKEN=a111111-1111-411B95E-0B6DFE643CE3"
$resp = Invoke-RestMethod -uri $uri -Body $InputData -Method PostSystem.Threading.Thread]::CurrentThread.GetApartmentState()
returns STA in both windows too..
please help, I'm now stumped.
Regards
David