PowerShell ยป Office 365 Health Monitoring

PowerShell scripts for Office 365

Exchange Online Reports Office 365 Security Reports Office 365 Health Monitoring

PowerShell scripts for Office 365 Health Monitoring 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 Office 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.

Office365 Health Monitoring Steps

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

Office365 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 O365 Manager Plus?

O365 Manager Plus monitors the health of Office 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 O365 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 Office 365 services all from one central location.
Real-time alerts: O365 Manager Plus monitors your Exchange Online, Azure Active Directory, OneDrive for Business, Skype for Business, and other Office 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 Office 365 service health monitoring data that's older than 30 days.
In-depth graphs: View graphs illustrating the health status of Office 365 services to facilitate quick decision-making.
Exchange Audit Logs Skype for Business Reports