Friday, June 7, 2019

Get all Outlook rules for all users in Microsoft 365

Full guide/description at : http://www.bwya77.com/powershell/get-users-outlookinbox-rules-office-365/

Connect to M365

$Credential = Get-Credential
Import-Module MsOnline
Connect-MsolService -Credential $credential
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession -DisableNameChecking

Export the list to .csv

1
2
3
4
5
$users = (get-mailbox -resultsize unlimited).UserPrincipalName
foreach ($user in $users)
{
Get-InboxRule -Mailbox $user | Select-Object MailboxOwnerID,Name,Description,Enabled,RedirectTo, MoveToFolder,ForwardTo | Export-CSV C:\Scripts\testing.csv -NoTypeInformation -Append
}

Full guide/description at : http://www.bwya77.com/powershell/get-users-outlookinbox-rules-office-365/


No comments:

Post a Comment