====== 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
* Get Inbox Rule and show what it does
Get-InboxRule –Mailbox | Select Name, Description | FL
* Get Inbox Rule and show details
Get-InboxRule -Identity -Mailbox | FL
* Remove Inbox rule
Remove-InboxRule -Identity -Mailbox
* Remove all Inbox rules
Get-InboxRule -Mailbox | Remove-InboxRule