PhoneGet Quote
US Sales: +1 888 720 9500
US Support: +1 844 245 1108
Intl: +1 925 924 9500
Aus: +1 800 631 268
UK: 0800 028 6590
CN: +86 400 660 8680

Direct Inward Dialing: +1 408 916 9890


PowerShell scripts for Office 365 health monitoring

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.
  2. $credential = Get-Credential
    $jsonPayload = (@{userName=$credential.username;password=$credential.GetNetworkCredential().password;} | convertto-json).tostring()

    $cookie = (invoke-restmethod -contenttype "application/json" -method Post -uri "" -body $jsonPayload).RegistrationCookie
    $jsonPayload = (@{lastCookie=$cookie;locale="en-US";preferredEventTypes=@(0,1)} | convertto-json).tostring()
    $events = (invoke-restmethod -contenttype "application/json" -method Post -uri "" -body $jsonPayload)
    $Issues = $events.Events

    $RequiredDate = (Get-Date).AddDays(-1)
    $Issuess = $Issues | Where-Object {$_.LastUpdatedTime -ige $RequiredDate}
    function Get-Eventdetails
    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

  3. Provide the credentials of the global admin account in the pop-up that appears.
  4. office365-health-monitoring-steps

  5. Once authenticated, the service health status of all the associated Office 365 services will be displayed.
  6. 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.

A holistic Office 365 administration solution