Install the Exchange Online PowerShell Module
https://lazyadmin.nl/powershell/install-exchange-online-powershell-module/
- Set the Execution Policy for your computer to allow running RemoteSigned modules
Set-ExecutionPolicy RemoteSigned
- Check if you already have the PowerShell NuGet module installed
Get-Module PowerShellGet -ListAvailable
- Install the latest version of the PowerShell NuGet module
Install-Module PowerShellGet -Force -AllowClobber
- Install the Exchange Online PowerShell Module
Install-Module -Name ExchangeOnlineManagement
- If you can't (or don't want to) open your PowerShell/Terminal with elevated permissions, you can install it for the Current User
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser
- Connect to Exchange Online
Connect-ExchangeOnline -UserPrincipalName admin@contoso.com -ShowBanner:$false
- Disconnect from Exchange Online when done
Disconnect-ExchangeOnline -Confirm:$false