How to create a script for Exchange Powershell to modify settings for all shared mailboxes?

To get all the shared mailboxes in your environment, use:

Get-Mailbox -RecipientTypeDetails SharedMailbox

Running those commands against the results from this command should be trivial.


Use Get-Mailbox, pass the result to Set-Mailbox. Here's a oneliner

Get-Mailbox -Filter { <put your filter here> } | % { Set-Mailbox -MessageCopyForSentAsEnabled $True -MessageCopyForSendOnBehalfEnabled $True }

Or put it in a script.

$Mailboxes = Get-Mailbox -Filter { <put your filter here> }

Foreach ($Mailbox in $Mailboxes) {
    Set-Mailbox $Mailbox -MessageCopyForSentAsEnabled $True -MessageCopyForSendOnBehalfEnabled $True
}

The key is filtering the Get-Mailbox portion.