User Tools

Site Tools


internet:mail:exchange:exchange_o365_powershell

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/

https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/remove-inboxrule?view=exchange-ps

  • Get Inbox Rule

:!: To get the entire RuleIdentity you may need to widen the PowerShell window. Properties, Layout, window size, width.

Get-InboxRule -Mailbox <mailbox_name>
  • Get Inbox Rule and show what it does
Get-InboxRule –Mailbox <mailbox_user> | Select Name, Description | FL
  • Get Inbox Rule and show details
Get-InboxRule -Identity <RuleIdentity> -Mailbox <mailbox_user> | FL
  • Remove Inbox rule
Remove-InboxRule -Identity <rule_name> -Mailbox <mailbox_name>
  • Remove all Inbox rules
Get-InboxRule -Mailbox <mailbox_name> | Remove-InboxRule
internet/mail/exchange/exchange_o365_powershell.txt · Last modified: 2019/01/30 10:57 by jcooper