Exchange Online Key Powershell Commands

Due to frankly enormous demand for migration services, my company has setup a dedicated team for Office365 migrations. You can view their website . If you are looking for help please get in touch!



Connect to Exchange online


$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic -AllowRedirection

Import-PSSession $Session


Setup service account to impersonate all users

New-ManagementRoleAssignment –Name "Impersonation-MyApp" –Role "ApplicationImpersonation" –User

set-ExecutionPolicy unrestricted


If you are unable to run scripts and are getting the error message “cannot be loaded because the execution of scripts is disabled on this system”


Check on the status of a migration




Initiate a migration


$MigrationSettings = Test-MigrationServerAvailability -Exchange -Credentials (Get-Credential) -ExchangeServer <your-server-name.your-domain> -RPCProxyServer <your-servers-FQDN>

New-MigrationBatch -Exchange -Name <any-name> -ExchangeConnectionSettings $MigrationSettings.ConnectionSettings -MaxConcurrentMigrations 3 -TimeZone “GMT Standard Time”


Grant access to another mailbox


Add-MailboxPermission -User -AccessRights FullAccess


List mailbox info including email addresses (output to .txt)


List distribution groups (output to .txt)


get-mailbox| fl Name,displayname,RecipientType,EmailAddresses >aliases.txt




Get-distributiongroup | fl >distgroup.txt

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.