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 here:-www.migrateoffice365.co.uk . If you are looking for help please get in touch!

 

Description
Command
 

Connect to Exchange online

 

$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

Import-PSSession $Session

 

Setup service account to impersonate all users



New-ManagementRoleAssignment –Name "Impersonation-MyApp" –Role "ApplicationImpersonation" –User serviceaccount@contoso.com
 

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

 

Get-MigrationStatusGet-Migrationbatch

 

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 mailboxtoaccess@yourdomain.co.uk -User mailboxtoaccessfrom@yourdomain.co.uk -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 *