I am attempting to test a very simple powershell script to get/post data from an internal ticketing site. I am running into an issue that appears to be related to the SSL certificate needed. Can someone please help me understand what code I need to add to make this work?
Thanks
Error returned: Exception calling "GetResponse" with "0" argument(s): "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
Current Code:
$url = "https://username:password@IPADDRESS/ticket"
$command = get-content jsonfile.json
$bytes = [System.Text.Encoding]::ASCII.GetBytes($command)
$web = [System.Net.WebRequest]::Create($url)
$web.Method = "POST"
$web.ContentLength = $bytes.Length
$web.ContentType = "application/json"
$stream = $web.GetRequestStream()
$stream.Write($bytes,0,$bytes.Length)
$stream.close()
$reader = New-Object System.IO.Streamreader -ArgumentList
$web.GetResponse().GetResponseStream()
$reader.ReadToEnd()
$reader.Close()