White list Office 365 for Individual users from a Spreadsheet

This script will ask what the users UPN is, then set the addresses in the spreadsheet as white listed.

##Start Script

$r = Read-Host "What is the users email address"
$allU = @()
$file = get-content c:\temp\user.csv
Foreach ($usr in $file){
$allU += $usr
Set-MailboxJunkEmailConfiguration -Identity $r -TrustedSendersAndDomains $allU -Enabled $true

##End Script


You can add a block list by adding the –BlockedSendersAndDomains  or changing to it.


Set-MailboxJunkEmailConfiguration -Identity <MailboxIdParameter> [-BlockedSendersAndDomains <MultiValuedProperty>] [-Confirm [<SwitchParameter>]] [-ContactsTrusted <$true | $false>] [-DomainController <Fqdn>] [-Enabled <$true | $false>] [-IgnoreDefaultScope <SwitchParameter>] [-TrustedListsOnly <$true | $false>] [-TrustedRecipientsAndDomains <MultiValuedProperty>] [-TrustedSendersAndDomains <MultiValuedProperty>] [-WhatIf [<SwitchParameter>]]


The csv is just a list of email addresses, no header.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s