Skip to content

Instantly share code, notes, and snippets.

@SamErde
Created June 17, 2025 00:51
Show Gist options
  • Save SamErde/15b12239c1d40f56e1cea4c2b7c14e86 to your computer and use it in GitHub Desktop.
Save SamErde/15b12239c1d40f56e1cea4c2b7c14e86 to your computer and use it in GitHub Desktop.
Connecting to M365 services to run Maester
# Open a new PowerShell session with none of the modules connected yet. PowerShell 7 is recommended.
$ModuleNames = @(
'Az.Accounts',
'ExchangeOnlineManagement',
'Microsoft.Graph.Authentication'
'MicrosoftTeams'
)
Update-Module $ModuleNames
Update-Module Maester -AllowPrerelease
<#
It is important to connect to these services in a specific order to avoid version conflicts with the
Microsoft.Identity.Client DLL that each of them includes. They must be connected in order from newest to
oldest versions. The order of importing these modules doesn't matter because the DLLs are lazy-loaded.
#>
Connect-MgGraph -NoWelcome
Connect-ExchangeOnline -ShowBanner:$false -BypassMailboxAnchoring
Connect-IPPSSession -BypassMailboxAnchoring -ShowBanner:$false
Connect-AzAccount
Connect-MicrosoftTeams
Invoke-Maester
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment