Useful Powershell Commands for O365

Useful Powershell Commands for O365

  • Ben
  • February 13, 2021
  • 0 comments

Useful powershell commands for Office 365 and Azure AD:

Connecting to O365 from Powershell Command

//Azure Portal Shell SSO - Connect in session
Connect-EXOPSSession
//Will prompt for user login, information will be stored in session.

Legal Hold Commands

-- From Exchange Online Powershell Module
Set-Mailbox "user@domain.com" -LitigationHoldEnabled $true

DKIM / DMARC / SPF

//Check if domains are dkim signed
Get-DkimSigningConfig

Get-DkimSigningConfig -Identity domain.com | Format-List Selector1CNAME, Selector2CNAME


//Add Domain for DKIM Signing
New-DkimSigningConfig -DomainName domain.com -Enabled $True

Email Management

Set an auto reply to all messages on a mailbox.

Set-MailboxAutoReplyConfiguration -Identity user.mailbox@domain.com -AutoReplyState Scheduled -StartTime "01/01/2021 08:00:00" -EndTime "01/15/2022 17:00:00" -InternalMessage "This mailbox is no longer active, please email alice.toderi@hello-nature.com for any assistance."

Leave a Reply