Coder Social home page Coder Social logo

evotecit / pswindocumentation.o365healthservice Goto Github PK

View Code? Open in Web Editor NEW
24.0 6.0 13.0 211 KB

PSWinDocumentation.O365HealthService is a Powershell module that has a single goal of getting Office 365 Health Status

License: MIT License

PowerShell 100.00%
powershell office-365 hacktoberfest

pswindocumentation.o365healthservice's Introduction

PSWinDocumentation.O365HealthService - PowerShell Module

PSWinDocumentation.O365HealthService is a Powershell module that has a single goal of getting Office 365 Health Status

Overview

Required Permissions

Please not that Microsoft deprecates the old way of accessing Service Health API. Since version 1.0+ you need to modify permissions for it to work properly.

https://evotec.xyz/wp-content/uploads/2022/01/img_61f59e2b000c3.png

Install

Install-Module PSWinDocumentation.O365HealthService -Force

Example 1

Here's a live demo generated using Dashimo: https://evotec.xyz/wp-content/uploads/2019/05/Health.html

Import-Module PSWinDocumentation.O365HealthService -Force
Import-Module PSWriteHTML -Force

$ApplicationID = ''
$ApplicationKey = ''
$TenantDomain = 'evotec.pl' # CustomDomain (onmicrosoft.com won't work), alternatively you can use DirectoryID

$O365 = Get-Office365Health -ApplicationID $ApplicationID -ApplicationKey $ApplicationKey -TenantDomain $TenantDomain -Verbose

Dashboard -FilePath $PSScriptRoot\Health.html {
    TabOption -BorderRadius 0px -BackgroundColorActive DimGrey
    SectionOption -BorderRadius 0px -HeaderBackGroundColor DimGrey
    TableOption -DataStore JavaScript -ArrayJoinString "; " -ArrayJoin -BoolAsString
    Tab -Name 'Services' {
        Section -Name 'Service List' {
            Table -DataTable $O365.Services -Filtering
        }
    }
    Tab -Name 'Current Status' {
        Section -Invisible {
            Section -Name 'Current Status' {
                Table -DataTable $O365.CurrentStatus {
                    TableCondition -Name 'ServiceStatus' -Value 'serviceOperational' -BackgroundColor MintGreen -FailBackgroundColor Salmon
                } -Filtering
            }
            Section -Name 'Current Status Extended' {
                Table -DataTable $O365.CurrentStatusExtended {
                    TableCondition -Name 'ServiceStatus' -Value 'serviceOperational' -BackgroundColor MintGreen -FailBackgroundColor Salmon
                } -Filtering
            }
        }
    }
    Tab -Name 'Message Center Information' {
        #Section -Invisible {
        Section -Name 'Message Center' {
            Table -DataTable $O365.MessageCenterInformation -Filtering
        }
        Section -Name 'Message Center Extended' {
            Table -DataTable $O365.MessageCenterInformationExtended -InvokeHTMLTags -Filtering
        }
        #}
    }
    Tab -Name 'Incidents' {
        Section -Invisible {
            Section -Name 'Incidents' {
                Table -DataTable $O365.Incidents -Filtering {
                    TableCondition -Name 'IsResolved' -Value $true -BackgroundColor MintGreen -FailBackgroundColor Salmon -ComparisonType bool
                }
            }
            Section -Name 'Incidents Extended' {
                Table -DataTable $O365.IncidentsExtended -Filtering {
                    TableCondition -Name 'IsResolved' -Value $true -BackgroundColor MintGreen -FailBackgroundColor Salmon -ComparisonType bool
                }
            }
        }
        Section -Name 'Incidents Messages' {
            Table -DataTable $O365.IncidentsUpdates -InvokeHTMLTags -Filtering
        }
    }
} -Online -ShowHTML

Example 2

Import-Module PSWinDocumentation.O365HealthService -Force

$ApplicationID = ''
$ApplicationKey = ''
$TenantDomain = 'evotec.pl' # CustomDomain (onmicrosoft.com won't work), alternatively you can use DirectoryID

$O365 = Get-Office365Health -ApplicationID $ApplicationID -ApplicationKey $ApplicationKey -TenantDomain $TenantDomain -Verbose
$O365.CurrentStatus | Format-Table -AutoSize

Output:

Service                                 ServiceStatus       StatusTime          IncidentIds
-------                                 -------------       ----------          -----------
Exchange Online                         Restoring service   21.04.2019 16:54:19 EX177902
Microsoft Kaizala                       Normal service      21.04.2019 16:54:19
Skype for Business                      Service degradation 21.04.2019 16:54:19 LY177449
Microsoft Teams                         Normal service      21.04.2019 16:54:19
Mobile Device Management for Office 365 Normal service      21.04.2019 16:54:19
Office Online                           Normal service      21.04.2019 16:54:19
OneDrive for Business                   Normal service      21.04.2019 16:54:19
Identity Service                        Normal service      21.04.2019 16:54:19
Office 365 Portal                       Normal service      21.04.2019 16:54:19
Planner                                 Normal service      21.04.2019 16:54:19
SharePoint Online                       Normal service      21.04.2019 16:54:19
Microsoft StaffHub                      Normal service      21.04.2019 16:54:19
Sway                                    Normal service      21.04.2019 16:54:19
Yammer Enterprise                       Normal service      21.04.2019 16:54:19

Example 3

Import-Module PSWinDocumentation.O365HealthService -Force

$ApplicationID = ''
$ApplicationKey = ''
$TenantDomain = 'evotec.pl' # CustomDomain (onmicrosoft.com won't work), alternatively you can use DirectoryID

$O365 = Get-Office365Health -ApplicationID $ApplicationID -ApplicationKey $ApplicationKey -TenantDomain $TenantDomain -Verbose
$O365.CurrentStatus | Format-Table -AutoSize

Output:


ID                       Service                                   ServiceStatus      StatusTime          Incidents
--                       -------                                   -------------      ----------          ---------
Exchange                 Exchange Online                           serviceDegradation 29.01.2022 21:14:47 {EX316072, EX316697}
OrgLiveID                Identity Service                          serviceOperational 29.01.2022 21:14:47
OSDPPlatform             Microsoft 365 suite                       serviceOperational 29.01.2022 21:14:47
Lync                     Skype for Business                        serviceOperational 29.01.2022 21:14:47
SharePoint               SharePoint Online                         serviceOperational 29.01.2022 21:14:47
DynamicsCRM              Dynamics 365 Apps                         serviceOperational 29.01.2022 21:14:47
RMS                      Azure Information Protection              serviceOperational 29.01.2022 21:14:47
yammer                   Yammer Enterprise                         serviceOperational 29.01.2022 21:14:47
MobileDeviceManagement   Mobile Device Management for Office 365   serviceOperational 29.01.2022 21:14:47
Planner                  Planner                                   serviceOperational 29.01.2022 21:14:47
SwayEnterprise           Sway                                      serviceOperational 29.01.2022 21:14:47
PowerBIcom               Power BI                                  serviceOperational 29.01.2022 21:14:47
Intune                   Microsoft Intune                          serviceOperational 29.01.2022 21:14:47
OneDriveForBusiness      OneDrive for Business                     serviceOperational 29.01.2022 21:14:47
microsoftteams           Microsoft Teams                           serviceOperational 29.01.2022 21:14:47
StaffHub                 Microsoft StaffHub                        serviceOperational 29.01.2022 21:14:47
kaizalamessagingservices Microsoft Kaizala                         serviceOperational 29.01.2022 21:14:47
Bookings                 Microsoft Bookings                        serviceOperational 29.01.2022 21:14:47
officeonline             Office for the web                        serviceOperational 29.01.2022 21:14:47
O365Client               Microsoft 365 Apps                        serviceOperational 29.01.2022 21:14:47
PowerAppsM365            Power Apps in Microsoft 365               serviceOperational 29.01.2022 21:14:47
MicrosoftFlow            Microsoft Power Automate                  serviceOperational 29.01.2022 21:14:47
MicrosoftFlowM365        Microsoft Power Automate in Microsoft 365 serviceOperational 29.01.2022 21:14:47
Forms                    Microsoft Forms                           serviceOperational 29.01.2022 21:14:47
Microsoft365Defender     Microsoft 365 Defender                    serviceOperational 29.01.2022 21:14:47
Stream                   Microsoft Stream                          serviceOperational 29.01.2022 21:14:47
Viva                     Microsoft Viva                            serviceOperational 29.01.2022 21:14:47
cloudappsecurity         Microsoft Defender for Cloud Apps         serviceOperational 29.01.2022 21:14:47

pswindocumentation.o365healthservice's People

Contributors

przemyslawklys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pswindocumentation.o365healthservice's Issues

WARNING: Get-Office365ServiceHealthMessages - Error: The remote server returned an error: (403) Forbidden.

Getting below Error, I have verified that the secret has not expired also the "ServiceHealth.Read" permission is provided with admin consent in Azure Ad. Please help to get this fixed.

PS D:>Import-Module PSWinDocumentation.O365HealthService -Force
$ApplicationID = '725XXXXXXXXXXXXXXXXXX'
$ApplicationKey = 'bXXXXXXXXXXXXXXXXXX'
$TenantDomain = '92XXXXXXXXXXXXXXXXXX'
$O365 = Get-Office365Health -ApplicationID $ApplicationID -ApplicationKey $ApplicationKey -TenantDomain $TenantDomain
$O365.CurrentStatus | Format-Table -AutoSize

WARNING: Get-Office365ServiceHealthServices - Error: The remote server returned an error: (403) Forbidden.
WARNING: Get-Office365ServiceHealthCurrentStatus - Error: The remote server returned an error: (403) Forbidden.
WARNING: Get-Office365ServiceHealthHistoricalStatus - Error: The remote server returned an error: (403) Forbidden.
WARNING: Get-Office365ServiceHealthMessages - Error: The remote server returned an error: (403) Forbidden.

An unexpected error occurred on a send

I use O365HealthService for two weeks and it worked correctly, but yesterday started to have error executing the module.
Any idea what it might be?

Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.
At C:\Program Files\WindowsPowerShell\Modules\PSWinDocumentation.O365HealthService\0.2.2\PSWinDocumentation.O365HealthService.psm1:307 char:18

  • ... Services = (Invoke-RestMethod -Uri "https://manage.office.com/api/v1. ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
      API

4o1 unauthorized

when i try to run it i got 4o1 unauthorized. i tried to connect with MSOnline and AzureAD first but didn't help. how does it authorize?

Get-CimInstance : The specified service does not exist as an installed service.

I'm getting the below error when try to run this script as an Azure runbook:

Get-CimInstance : The specified service does not exist as an installed service. At C:\Modules\User\PSWinDocumentation.O365HealthService\PSWinDocumentation.O365HealthService.psm1:638 char:29 + ... ZoneBias = (Get-CimInstance -ClassName Win32_TimeZone -Verbose:$false ... +

DateTime issue

PS C:\> $O365 = Get-Office365Health -ApplicationID $ApplicationID -ApplicationKey $ApplicationKey -TenantDomain $TenantDomain
Exception calling "Parse" with "1" argument(s): "String was not recognized as a valid DateTime because the day of week was incorrect."
At C:\Program Files\WindowsPowerShell\Modules\PSWinDocumentation.O365HealthService\0.1\PSWinDocumentation.O365HealthService.psm1:25 char:13
+             [DateTime] $ConvertedTime = [DateTime]::Parse($Time)
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException

Exception calling "Parse" with "1" argument(s): "The string was not recognized as a valid DateTime. There is an unknown word starting at index 23."
At C:\Program Files\WindowsPowerShell\Modules\PSWinDocumentation.O365HealthService\0.1\PSWinDocumentation.O365HealthService.psm1:25 char:13
+             [DateTime] $ConvertedTime = [DateTime]::Parse($Time)
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException

StartTime & EndTime are missing

Hello,

since the version 1.0.0 (from 29.01.2022) the output from StartTime & EndTime is missing.

Is there a change go get them back?

Many greetings,

Thorsten

Error: The remote server returned an error: (400) Bad Request

Hi,

I just tried the module, I started with your tutorial here : https://evotec.xyz/preparing-azure-app-registrations-permissions-for-office-365-health-service/

But I only get a 400 error code.
I tried to create a new key but nothing helps

Get-Office365Health -ApplicationID $app -ApplicationKey $key -TenantDomain 'MyDomain' -Verbose
VERBOSE: Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_TimeZone'.
VERBOSE: Operation 'Enumerate CimInstances' complete.
VERBOSE: POST https://login.microsoftonline.com/MyDomain/oauth2/token?api-version=1.0 with -1-byte payload
WARNING: Connect-O365ServiceHealth - Error: The remote server returned an error: (400) Bad Request. ```

ConvertFrom-UTCTime - couldn't convert time. [...] Thursday, January 26, 2023 by 1:30 AM UTC.

$AllMessages = Get-Office365Health -ApplicationID $ClientID -ApplicationKey $ClientSecret -TenantDomain $TenantName

WARNING: ConvertFrom-UTCTime - couldn't convert time. Please report on GitHub - Thursday, January 26, 2023 by 1:30 AM UTC.
Skipping conversion...
WARNING: ConvertFrom-UTCTime - couldn't convert time. Please report on GitHub - Thursday, January 26, 2023 by 2:30 AM UTC.
Skipping conversion...
WARNING: ConvertFrom-UTCTime - couldn't convert time. Please report on GitHub - Thursday, January 26, 2023 by 3:30 AM UTC.
Skipping conversion...
WARNING: ConvertFrom-UTCTime - couldn't convert time. Please report on GitHub - Wednesday, January 25, 2023, by 11:40 PM UTC.
Skipping conversion...
WARNING: ConvertFrom-UTCTime - couldn't convert time. Please report on GitHub - Tuesday November 29, 2022, at 1:00 AM UTC.

"Extended" misspelled

The object returned from the Get-Office365Health cmdlet should return ServicesExtended, not ServicesExteneded.

(By the way, awesome module. Thanks for posting.)

WARNING: ConvertFrom-UTCTime

PS C:\WINDOWS\system32> $O365 = Get-Office365Health -ApplicationID $ApplicationID -ApplicationKey $ApplicationKey -TenantDomain $TenantDomain -ToLocalTime #-Verbose

returned warnings
WARNING: ConvertFrom-UTCTime - couldn't convert time. Please report on GitHub - We will update the communication pending additional information by either Tenable or Microsoft.. Skipping conversion...
WARNING: ConvertFrom-UTCTime - couldn't convert time. Please report on GitHub - We will update the communication pending additional information by either Tenable or Microsoft.. Skipping conversion...

v 1.0.3

Parse exception: String '10/23/2023 07:00:00' was not recognized as a valid DateTime (v1.0.4)

Input:
$Obj = Get-Office365Health -ApplicationID "..." -ApplicationKey "..." -TenantDomain "..." -Verbose # Command 1
$Obj = Get-Office365Health -ApplicationID "..." -ApplicationKey "..." -TenantDomain "..." -ToLocalTime -Verbose # Command 2

  • Exception (below) is thrown over and over again on lines 862, 890 and 896 of the PSM1 file:
System.Management.Automation.MethodInvocationException: Exception calling "Parse" with "1" argument(s): "String '10/23/2023 07:00:00' was not recognized as a valid DateTime."
                         ---> System.FormatException: String '10/23/2023 07:00:00' was not recognized as a valid DateTime.
                           at CallSite.Target(Closure, CallSite, Type, Object)
                           --- End of inner exception stack trace ---
                           at System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String methodName, Int32 numArgs, MemberInfo memberInfo)
                           at CallSite.Target(Closure, CallSite, Type, Object)
                           at lambda_method680(Closure, Object[], StrongBox`1[], InterpretedFrame)
  • A single warning is also issued once by the ConvertFrom-UTCTime function at line 634 of the PSM1 file
    WARNING: ConvertFrom-UTCTime - couldn't convert time Next update by: Wednesday, Feb 22, 2023, at 11:00 AM UTC (after conversion Next update:  Feb 22, 2023 11:00 AM ). Exception: Exception calling "Parse" with "1" argument(s): "The string 'Next update:  Feb 22, 2023 11:00 AM ' was not recognized as a valid DateTime. There is an unknown word starting at index '0'.". Skipping conversion...

Cmdlet result:

PS C:\Users\xyz> $?
True
PS C:\Users\xyz> $LASTEXITCODE
PS C:\Users\xyz> $LASTEXITCODE -eq $null
True

Tested: v1.0.4

Modules loaded:

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…}
Manifest   7.0.0.0               Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature…}
Manifest   7.0.0.0               Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object…}
Manifest   7.0.0.0               Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP…}
Script     2.2.6                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler…}
Script     1.0.4                 PSWinDocumentation.O365HealthServi… Get-Office365Health

Command-Output mapping:
Command 1 => output1.txt
Command 2 => output2.txt
The ApplicationID shown in the files attached has been changed for anonymity.

PSM1 code file (renamed):
PSWinDocumentation.O365HealthService.psm1.txt

Locale:

Get-WinSystemLocale | FL

Parent                         : en
LCID                           : 2057
KeyboardLayoutId               : 2057
Name                           : en-GB
IetfLanguageTag                : en-GB
DisplayName                    : English (United Kingdom)
NativeName                     : English (United Kingdom)
EnglishName                    : English (United Kingdom)
TwoLetterISOLanguageName       : en
ThreeLetterISOLanguageName     : eng
ThreeLetterWindowsLanguageName : ENG
CompareInfo                    : CompareInfo - en-GB
TextInfo                       : TextInfo - en-GB
IsNeutralCulture               : False
CultureTypes                   : SpecificCultures, InstalledWin32Cultures
NumberFormat                   : System.Globalization.NumberFormatInfo
DateTimeFormat                 : System.Globalization.DateTimeFormatInfo
Calendar                       : System.Globalization.GregorianCalendar
OptionalCalendars              : {System.Globalization.GregorianCalendar}
UseUserOverride                : True
IsReadOnly                     : False

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.