Christian Hans
asked on
Powershell Command To Display All User Mailbox InboxRules
Trying to run a Powershell Command To Display All User Mailbox InboxRules by running;
Get-Mailbox -ResultSize unlimited | Get-InboxRule -ErrorAction:SilentlyConti nue | Select MailboxOwnerID, name, from, redirectto, ForwardTo | Export-Csv c:\output\InboxRules_Forwa rds.csv -NoTypeInformation
...exports no information at all.
How can I run this via powershell to export ALL mailbox rules,
fields required/desired:
Enabled,Name,Priority,From ,SentTo,Co pyToFolder ,DeleteMes sage,Forwa rdTo,MarkA sRead,Move ToFolder,R edirectTo, SendTextMe ssageNotif icationTo, MailboxOwn erId
Get-Mailbox -ResultSize unlimited | Get-InboxRule -ErrorAction:SilentlyConti
...exports no information at all.
How can I run this via powershell to export ALL mailbox rules,
fields required/desired:
Enabled,Name,Priority,From
ASKER
Thanks Todd, running your suggestion now.
I have confirmed that we do have mailboxes with rules, plenty of them... which is why its so strange that the results didn't pull anything back.
Get-InboxRule -Mailbox First.Last@contoso.com pulls back rules...
I have confirmed that we do have mailboxes with rules, plenty of them... which is why its so strange that the results didn't pull anything back.
Get-InboxRule -Mailbox First.Last@contoso.com pulls back rules...
ASKER
Results = blank (no output)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Huh? I got output.
What Vasil provides will not work on premises because you have to pass a name or alias--not an email address.
But the following does (for both on premises Exchange and EXO), just like the previous command I provided (in on premises Exchange)...
And so does this...
The following will output to a CSV file...
What Vasil provides will not work on premises because you have to pass a name or alias--not an email address.
Get-Mailbox -ResultSize Unlimited | % { Get-InboxRule -Mailbox $_.PrimarySmtpAddress }
But the following does (for both on premises Exchange and EXO), just like the previous command I provided (in on premises Exchange)...
Get-Mailbox -ResultSize Unlimited | % { Get-InboxRule -Mailbox $_.Alias }
And so does this...
Get-Mailbox -ResultSize Unlimited | % { Get-InboxRule -Mailbox $_.Name }
The following will output to a CSV file...
Get-Mailbox -ResultSize Unlimited | % { Get-InboxRule -Mailbox $_.Alias | Select Enabled,Name,Priority,From,SentTo,CopyToFolder,DeleteMessage,ForwardTo,MarkAsRead,MoveToFolder,RedirectTo,@{Expression={$_.SendTextMessageNotificationTo};Label="SendTextMessageNotificationTo"},MailboxOwnerId } | Export-Csv C:\Output\InboxRules_Forwards.csv -NoTypeInformation
Also, if there are on premises and EXO mailboxes, you will need get info from EMS and also connected to EXO via PowerShell.
This command should work for both environments. Just change the output location if running on the same machine.
Open in new window