PowerShell ยป PowerShell scripts for Microsoft 365 Health Monitoring Reports

PowerShell scripts for Microsoft 365 Health Monitoring Reports

Exchange Online Reports

Service health monitoring for cloud platforms is an integral part of IT admins' everyday routine. PowerShell scripts can help you fetch service health data without logging in to the portal, but the details fetched by these scripts may prove insufficient at times.

How to fetch Microsoft 365 service health status using PowerShell

1. Execute the following script in your PowerShell window.

$credential = Get-Credential $jsonPayload = (@{userName=$credential.username;password=$credential.GetNetworkCredential().password;} | convertto-json).tostring() $cookie = (invoke-restmethod -contenttype "application/json" -method Post -uri "https://api.admin.microsoftonline.com/shdtenantcommunications.svc/Register" -body $jsonPayload).RegistrationCookie $jsonPayload = (@{lastCookie=$cookie;locale="en-US";preferredEventTypes=@(0,1)} | convertto-json).tostring() $events = (invoke-restmethod -contenttype "application/json" -method Post -uri "https://api.admin.microsoftonline.com/shdtenantcommunications.svc/GetEvents" -body $jsonPayload) $Issues = $events.Events $RequiredDate = (Get-Date).AddDays(-1) $Issuess = $Issues | Where-Object {$_.LastUpdatedTime -ige $RequiredDate} function Get-Eventdetails { Param($issues) foreach($Issue in $Issuess) { $props = @{Service_Name = ($Issue.AffectedServiceHealthStatus).ServiceName Status = $Issue.Status Start_time = $Issue.StartTime Message =[String]($Issue.Messages).MessageText -replace "`n|`r""_" End_Time =$Issue.EndTime ID = $Issue.Id Last_Updated_Time = $Issue.LastUpdatedTime } [pscustomobject]$props } } $Issues;

2. Provide the credentials of the global admin account in the pop-up that appears.

Microsoft-365 Health Monitoring Steps

3. Once authenticated, the service health status of all the associated Microsoft 365 services will be displayed.

Microsoft-365 Health Monitoring Powershell

As you can see in the image, the results aren't very comprehensive; they only show the service health status, and list the services and features affected by incidents/advisories. There's no way of knowing the scope of the impact, the users and regions affected, the current status of the incident, or other crucial details. PowerShell scripts also won't return historical service health data. All data has to be saved manually for future reference.

Why M365 Manager Plus?

M365 Manager Plus monitors the health of Microsoft 365 services 24x7 and sends out email notifications immediately when a service outage is detected. With real-time service outage alerts, you'll know about outages the moment they happen, so you can quickly respond and keep your business processes running without any hiccups.

Granular incident report: The service health dashboard of M365 Manager Plus provides granular details such as the number of incidents in features and endpoints of a service, the number of users who will be affected by a particular incident, the current status of the incident, the start and end time of the incident, and other details which cannot be fetched using PowerShell scripts.
Centralized monitoring: Monitor the health of Exchange Online, Azure Active Directory, OneDrive for Business, Skype for Business, and nearly a dozen other Microsoft 365 services all from one central location.
Real-time alerts: M365 Manager Plus monitors your Exchange Online, Azure Active Directory, OneDrive for Business, Skype for Business, and other Microsoft 365 services 24x7. It also constantly monitors the health of your cloud setup and notifies you immediately about any service outages.
Historical data: Gain access to historical Microsoft 365 service health monitoring data that's older than 30 days.
In-depth graphs: View graphs illustrating the health status of Microsoft 365 services to facilitate quick decision-making.

Teams archiving with powershell

Learn more about how M365 Manager Plus simplifies complex PowerShell tasks.

Microsoft 365 Security Reports Microsoft 365 Health Monitoring Exchange Audit Logs Skype for Business Reports