Link to home
Start Free TrialLog in
Avatar of bflannery
bflannery

asked on

PowerShell Commanlet set-mailboxjunkemailconfiguration "all users" -TrustedSendersAndDomains @{add="contorso.com"}

Is there a way to add bulk AD accounts to this commandlet? I can foresee the potential problems with this depending on how your AD Organization units are grouped. But couldn't find much online in my brief search.
Do I just apply the FQDN instead of individual users?

set-mailboxjunkemailconfiguration "all users"  -TrustedSendersAndDomains @{add="contorso.com"}

Thanks for your help.
ASKER CERTIFIED SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Bad style, Will. If a commandlet has advanced features like the ADD syntax we should use it.
get-mailbox -ResultSize "unlimited" | % {
  Set-MailboxJunkEmailConfiguration -Identity $_ -TrustedSendersAndDomains @{add="contorso.com"}
}

Open in new window

:-P either way will work. But I get you.

Will.
Avatar of bflannery
bflannery

ASKER

Thanks Will -  We had some outside help that committed to this. But I know this will be utilized again soon, looking forward to testing this out.
Thanks Everyone.
Again, this is bad style for many reasons. One more: Get-Mailbox should always be used in a pipe, not as shown above.
@Qlemo - I do get you regarding the Form of how to write scripts, however there are SEVERAL ways to accomplish this. I think it is good to note different ways to accomplish this, but ultimately the script works and gets the results the user is looking for, which is the most important part of EE.

Will.