$ExcludeUsers = @("Administrator", "user1") Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 # Get all valid recipients, excludes DiscoverySearchMailbox and every user alias included in ExcludeUsers $ValidRecipients = Get-Mailbox | where {$_.Alias -NotLike "DiscoverySearchMailbox*"} | where {$_.Alias -NotIn $ExcludeUsers} foreach ($Address in $ValidRecipients.EmailAddresses) {[string]::Format("{0}`tOK", $Address.AddressString)}
./script.ps > output.txt
relay_recipient_maps = hash:/etc/postfix/relay_recipients show_user_unknown_table_name = no