Мне нужно извлечь оповещения из остальных API и отправить их в файл с powershell
Мне удалось извлечь выходы оповещений, зацикливая XML-файл:
foreach ($c in $temp){$c.timeOfAlertFormatted,$c.parent,$c.child,$c.category,$c.servicePlanDisplayName,$c.message}
Thu 09/19/2019 12:00:19 AM
IL
Servername
Phase Failure
Gold
One or more source luns do not have a remote target specified/mapped.
Wed 09/18/2019 02:18:25 PM
IL
Server2
Phase Failure
Gold
One or more source luns do not have a remote target specified/mapped
Яновичок в PS, чего я хочу добиться, это добавить описательную строку
к каждому полю, то есть:
Time: Thu 09/19/2019 12:00:19 AM
Country: IL
Server: servername
и т. д., остальные поля.
iпробовал:
foreach ($c in $temp){Write-Host "Time : $($c.timeOfAlertFormatted)"}
Time :
Time :
Time :
Time :
Time :
Time :
Time :
Time :
Time :
Time :
Time :
Time :
Time : Thu 09/19/2019 12:00:19 AM
печать пустых полей "Время"
вот пример xml: