Hi Barinder,
As this is a Windows consumer only forum, you can get better help by posting it on Technet Powershell forums:
Technet forums - Windows PowerShell - Microsoft
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
i Guys,
I am using one script . it was working fine before 6 days but now giving error. I am using the Labtech software to monitor machines. when monito fails then this script runs on machine and send the result to opsGenis email. then ops genie sends the alert on phone via SMS or voice call.
this is the error when script run on server . FYI, server is exchange server.
Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure
channel.
At C:\Windows\system32\config\systemprofile\AppData\Local\9e1cd5b9f46d4e17b9179
fbe197f1909.ps1:36 char:11
$bo ...
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
pWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
ll.Commands.InvokeRestMethodCommand
This is the script :-
param (
[string]$eu = "False",
[string]$apiKey = "apiKey",
[string]$status = "status",
[string]$clientname = "client",
[string]$computername = "computer",
[string]$locationname = "location",
[string]$fieldname = "field",
[string]$result = "result",
[string]$when = "when",
[string]$contactName = "contact",
[string]$monitorName = "monitor"
)
if($eu -eq "True") {
$uri = "https://api.eu.opsgenie.com/v1/json/integrations/webhooks/connectwiseautomate?apiKey=" + $apiKey;
}
else {
$uri = "https://api.opsgenie.com/v1/json/integrations/webhooks/connectwiseautomate?apiKey=" + $apiKey;
}
$body = ConvertTo-Json @{
status = $status
clientName = $clientname
computerName = $computername
locationName = $locationname
fieldName = $fieldname
result = $result
when = $when
contactName = $contactName
monitorName = $monitorName
}
$headers = [Hashtable] @{
Type = 'application/json'
};
$result = Invoke-RestMethod -Method "Post" -Uri $uri -Headers $headers -Body $body -ContentType 'application/json'
Write-Output $result
Thanks
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Hi Barinder,
As this is a Windows consumer only forum, you can get better help by posting it on Technet Powershell forums:
Technet forums - Windows PowerShell - Microsoft