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.

 

image

Advertisements

How to connect Powershell to an Office 365 Tenant

Step 1: Install required software

These steps are only required once on each computer you will be running powershell from, not every time you connect.

Run this to connect:

$LiveCred = Get-Credential$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

Import-PSSession $Session

Then to remove it:

Remove-PSSession $Session

If you close the Windows PowerShell window without disconnecting from the server-side session, your connection will remain open for 15 minutes. Your account can have only three connections to the server-side session at one time.

 

Hope it helps

dw

Mail Routing During a Dell-Quest Migration Manager Migration to O365

This describes mail routing during a Dell Quest Migration Manager Migration from On-Prem Exchange to Microsoft Office 365

Co-existence routing during the migration.

Step 1, add the user to the Dell Active directory Migration tool (DMA).

This step creates the GAL and sets initial mail routing.

When a user is added to the Dell Active directory Migration tool (DMA). A mailuser (similar to a contact) is added to Office 365 and the ExternalEmailAddress attribute set. This tells Office 365 to send the mail externally (back to on-prem) through a connector in O365 scoped to on-prem.

 

image

Step 2 Add the user to a Quest Mail or Calendar Sync

In office 365

Once the user is put into a Dell Migration Manager mail or calendar sync, they become licensed in O365 (licensing creates a mailbox).The Exchange Migration Manager (EMM) then adds an address using the users GUID to the ForwardingSmtpAddress in office 365. This forwards all mail back to on-prem from users in Office 365. (No outside mail is arriving in O365 yet)

The DeliverToMailboxAndForward attribute is left at “False” (default).

image

On-prem

On-prem the Exchange Migration Manager (EMM) adds a proxy address using the users GUID on-prem (same address that is stamped in the ForwardingSmtpAddress attribute in Office 365)

Note: if routing is not working for a user, verify these addresses match. This is mail from Office 365 to on-prem.

This can be set by running the following command in an Office 365 shell.

image

Mail from on-prem to office 365 is handled by the Dell Exchange Migration Manager. This allows for more than just mail forwarding, but also deletes, moves etc and keeps the mailbox in sync.

Step 3 Flip the user

In Office 365

When a user is “flipped” or switched as it is referred to in the tool, Dell Exchange Migration Manager removes the forwarding address in Office 365. All mail now remains in Office 365.

image

On-Prem

Once a user is flipped EMM sets the targetAddress attribute to the USI user account. This can be the GUID@mydomain.onmicrosoft.com or the username@mydomain.onmicrosoft.com, but the address in the targetAddress must be in the proxy list in O365. If routing for this user is an issue, make sure the addresses match. Check this with adsiedit.msc in USI.

Or

Get-QADUser username -IncludeAllProperties | select name,targetaddress

 

 

image

image