User Tools

Site Tools


internet:mail:exchange:exchange_o365_powershell

This is an old revision of the document!


Connect to Office 365 Exchange via PowerShell

  • On the machine you are connecting from install the Microsoft Online Services Sign-in Assistant module.

https://www.microsoft.com/en-us/download/details.aspx?id=41950

  • Open PowerShell run as administrator.
  • Allow remote signing.
Set-ExecutionPolicy RemoteSigned
  • Set cached credentials. You need the global admin account credentials
$LiveCred = Get-Credential
  • Setup parameters for the session.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
  • Open a session.
Import-PSSession $Session
  • Close a session.
Remove-PSSession $Session

PowerShell rules commands

https://www.codetwo.com/admins-blog/managing-outlook-rules-powershell/

  • Get Inbox Rule
Get-InboxRule -Mailbox <mailbox_name>
Get-InboxRule –Mailbox <mailbox_user> | Select Name, Description | FL
  • Remove Inbox rule
Remove-InboxRule -Identity <rule_name> -Mailbox <mailbox_name>
  • Remove all Inbox rules
Get-InboxRule -Mailbox "Joe@Contoso.com" | Remove-InboxRule
internet/mail/exchange/exchange_o365_powershell.1547585250.txt.gz · Last modified: 2019/01/15 13:47 by jcooper