Entra / Microsoft 365 · Exchange Online
Find updated Microsoft 365 notifications
Download Message Center service notifications from the Microsoft 365 admin center and process them with PowerShell.
Connect & set up
Run these once per session. All scopes are read-only unless the script makes changes.
Set $TenantId, $AppId, and $AppSecret for the app registered to access the Office 365 Management API.
Run it
The main script. Copy it, or download the .ps1 and run it from your console.
param([string] $TenantId = "b662313f-14fc-43a2-9a7a-d2e27f4f347a",[string] $AppId = "d716b32c-0edb-48be-9385-30a9cfd96155")$AppSecret = 's_rkvIn1oZ1cNceUBvJ2or1lrrIsb*:=' # App Secret for the registered app$body = @{grant_type="client_credentials";resource="https://manage.office.com";client_id=$AppId;client_secret=$AppSecret }$oauth = Invoke-RestMethod -Method Post -Uri "https://login.microsoftonline.com/$($tenantId)/oauth2/token?api-version=1.0" -Body $body$token = @{'Authorization' = "$($oauth.token_type) $($oauth.access_token)" }$Uri = "https://manage.office.com/api/v1.0/b662313f-14fc-43a2-9a7a-d2e27f4f3478/ServiceComms/Messages?`$filter=MessageType eq 'MessageCenter'"$Messages = Invoke-RestMethod -Uri $uri -Headers $token -Method Get$Report = [System.Collections.Generic.List[Object]]::new()ForEach ($M in $Messages.Value) {If ($M.LastUpdateTime -eq $Null) {$LastUpdate = "None" }Else { $LastUpdate = et-Date ($M.LastUpdateTime) -format g }# Set flags to indicate affected workloads$Dynamics = $False; $Exchange = $False; $EOP = $False; $Forms = $False; $Intune = $False; $Lync = $False; $ATP = $False; $Flow = $False; $Teams = $False$PowerApps = $False; $OfficeOnline = $False; $OneDrive = $False; $Platform = $False; $Client = $False; $Planner = $False; $SharePoint = $False$Stream = $False; $Yammer = $False; $Office365 = $FalseForeach ($Wl in $M.AffectedWorkloadnames) {Switch ($Wl) {"DynamicsCRM" { $Dynamics = $True }"Exchange" { $Exchange = $True }"Fope" { $EOP = $True }"Forms" { $Forms = $True }"Intune" { $Intune = $True }"Lync" { $Lync = $True }"MDATP" { $ATP = $True }"MicrosoftFlow" { $Flow = $True }"MicrosoftFlowM365" { $Flow = $True}"MicrosoftTeams" { $Teams = $True }"MobileDeviceManagement" { $Intune = $True }"PowerApps" { $PowerApps = $True }"PowerAppsM365" { $PowerApps = $True }"OfficeOnline" { $OfficeOnline = $True }"OneDriveForBusiness" { $OneDrive = $True }"OrgLiveId" { $Platform = $True }"OSDPPlatform" { $Platform = $True }"O365Client" { $Client = $True }"Planner" { $Planner = $True }"SharePoint" { $SharePoint = $True }"Stream" { $Stream = $True }"Yammer" { $Yammer = $True }default { $Office365 = $True }} #End Switch} #End Foreach# For notifications issued as updates, grab the update date from the text of the notification; otherwise just get the first 200 characters of the textIf ($M.Messages.MessageText -Like "Updated*") {$UpdateText = $M.Messages.MessageText.SubString(0,200)$UpdateDate = $UpdateText.Substring(0,$Updatetext.IndexOf(":"))$UpdateDate = $UpdateDate.SubString(8,($UpdateDate.length-8))[datetime]$StartPeriod = $M.StartTime[datetime]$EndPeriod = $UpdateDate$DaysUpdate = (New-TimeSpan -Start $StartPeriod -End $EndPeriod).Days }Else {$UpdateText = $M.Messages.MessageText.SubString(3,203)$UpdateDate = $Null$DaysUpdate = "N/A" }# Generate output report line for the notification$ReportLine = [PSCustomObject]@{Id = $M.IdTitle = $M.TitleCategory = $M.CategoryActionType = $M.ActionTypeText = $UpdateTextUpdated = $UpdateDateDaysUpdate = $DaysUpdateLink = $M.ExternalLinkHelpLink = $M.HelpLinkWorkloads = $M.AffectedWorkloadDisplayNamesStartDate = Get-Date ($M.StartTime) -format gLastUpdate = $LastUpdateEndDate = Get-Date($M.Endtime) -format gDynamics = $DynamicsExchange = $ExchangeEOP = $EOPForms = $FormsIntune = $IntuneLync = $LyncATP = $ATPFlow = $FlowTeams = $TeamsPowerApps = $PowerAppsOfficeOnline = $OfficeOnlineOneDrive = $OneDrivePlatform = $PlatformClient = $ClientPlanner = $PlannerSharePoint = $SharePointStream = $StreamYammer = $YammerOffice365 = $Office365}$Report.Add($ReportLine)} # End ForEach# Generate array of updated notifications[array]$Updates = $Report | ?{$_.Title -Like "*(Updated)*"}
Parameters
ParameterDefaultNotes
-TenantId""Microsoft Entra tenant ID for app-only authentication to the Office 365 Management API.-AppId""Application (client) ID for the app registration used to connect.Attribution
Author
Office365itpros