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