Param (
[String]$AlertName,
[String]$AlertDescription,
[String]$AlertSource,
[String]$AlertTime,
[String]$ResolutionStateName
)
#Замена кавычек
$AlertName = $AlertName.Replace("'",'"')
#Нормальный перенос строк
$AlertDescription = $AlertDescription.Replace("\n","`n")
#Удаление двойных процентов
#$AlertDescription = $AlertDescription.Replace("%%","")
#Удаление знака &
#$AlertDescription = $AlertDescription.Replace("&","")
#Собираем переменные в одну и переносим строки
$Message = $AlertName + "`n" + "`n" + "Status: " + $ResolutionStateName + "`n" + "Alert Time: " + $AlertTime + "`n" + "`n" + $AlertDescription + "`n" + "`n" + $AlertSource
$URL = "мой урл"
$payload = @{"Title"=$AlertName;"Text"=$Message}
#[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$request = Invoke-RestMethod -Method Post -Uri $URL -ContentType "application/json; charset=utf-16" -Body (ConvertTo-Json -Compress -InputObject $payload)