Office 365 - can I change default Junk Email behaviour for all users?

Hi all,

We recently configured hybrid exchange and I am currently testing O365 with a few users.

I would like to change the Junk Email folder settings for all our of our users.  Is this possible?

This is the setting in Settings >> Mail >> Accounts >> Block or Allow

O365 junk email settings

I would like the default to be "Dont move email to my Junk Email folder".  It seems for the majority of users the default is "Automatically filter junk email".

I cannot seem to find anywhere in any of the admin consoles where I can pre-set this for our users.

Thanks
fieldjAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vasil Michev (MVP)Commented:
You can use Set-MailboxJunkEmailConfiguration to configure this per-user.
0
fieldjAuthor Commented:
Is there a way I can specify this for all users?  What about if I create a new user, would I have to remember to do this everytime?
0
Saif ShaikhServer engineer Commented:
For all mailboxes you can connect to O365 powershell and run command: get-mailbox | set-MailboxJunkEmailConfiguration
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Saif ShaikhServer engineer Commented:
$UserCredential = Get-Credential
 
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
 
Import-PSSession $Session

You can then test your connection by typing the command below. It will display mailbox information if you are connected:

Get-Mailbox

Now you are ready to make the change. The command below will turn off Junk Mail filtering for all users in the company. If there are service mailboxes in use that have never been logged into, you will see errors for those accounts when the change is attempted to be applied there. The script will then move on the the next mailbox until completion.

Get-Mailbox | Set-MailboxJunkEmailConfiguration –Enabled $False
0
fieldjAuthor Commented:
Would I have to periodically repeat this task if I added new mailboxes?
0
Saif ShaikhServer engineer Commented:
Yes you have to...
0
fieldjAuthor Commented:
Ok, thanks.  I will give this a try and get back with my results.  Thanks for the help so far.
0
fieldjAuthor Commented:
Thanks, I gave it a try and that seems to be working perfectly.

If I were to run this on a weekly scheduled task, is there a way I can (securely) store the O365 user credentials in the script?
0
Saif ShaikhServer engineer Commented:
The below should work for all users..

$Domains = "contoso.com"
$users = get-mailbox -ResultSize "unlimited"

ForEach ($user in $users) {

$SetDomain = Get-MailboxJunkEmailConfiguration -Identity $user
$SetDomain.TrustedSendersAndDomains += $Domains
Set-MailboxJunkEmailConfiguration -Identity $user -TrustedSendersAndDomains $SetDomain.TrustedSendersAndDomains

}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MichelangeloConsultantCommented:
There arr Different ways to store credentials in a Script.
Have a look there for instance:
https://practical365.com/blog/saving-credentials-for-office-365-powershell-scripts-and-scheduled-tasks/
0
fieldjAuthor Commented:
Thanks for the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.