-
-
Save anonymous/59d6826c026b9c1750309817db594cf3 to your computer and use it in GitHub Desktop.
Office365
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gather events from the Service Communications API | |
$MySession = New-SCSession -Credential $Credential | |
$Events = Get-SCEvent -EventTypes Incident -PastDays 1 -SCSession $MySession | | |
Select-Object Id, Status, StartTime, | |
@{n='ServiceName'; e={$_.AffectedServiceHealthStatus.servicename}}, | |
@{n='Message';e={$_.messages[0].messagetext}} | |
$a = "<style>BODY{background-color:peachpuff;}</style>" | |
$event | Out-GridView # ConvertTo-Html -Head $a | Out-File N:\health.html | |
if ($Events) | |
{ | |
$Tables = foreach ($Event in $Events) | |
{ | |
@" | |
<table> | |
<tr> | |
<th>Id</th> | |
<th>ServiceName</th> | |
<th>Status</th> | |
<th>StartTime</th> | |
</tr> | |
<tr> | |
<td>$($Event.Id)</td> | |
<td>$($Event.ServiceName)</td> | |
<td>$($Event.Status)</td> | |
<td>$($Event.StartTime)</td> | |
</tr> | |
</table> | |
<table> | |
<tr> | |
<td>$($Event.Message)</td> | |
</tr> | |
</table> | |
"@ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment