Scripts - Migration and Migration Prep

The vast majority of these scripts are from the Microsoft TechNet Gallery and neither myself or Microsoft guarantee the validity of these scripts and you use them at your own risk.

=================================================================

Migration

=================================================================

Office 365 & Exchange migration runbook template
Author - Ivo Maas
Download - Link
Website - Link

Info -
This template will help you to set up your own migration runbook.
Includes chapters like:
- Project background
- Prerequisites
- Migration plan
- Roll/fallback
- Troubleshooting

=================================================================

Office 365 Hybrid Mailbox Migration Management
Author - Michael Hall
Download - Link
Article - Link

Info -
The aim of this was to allow me to: Migrate batches of On-premise mailboxes to Exchange online in a Hybrid deployment by using a centralized location. Get some idea of how long the moves will take, keep track of the mailbox moves, License the mailboxes, Suspend moves if required

=================================================================

Auto licensing Office 365 migration users prior to completing the migration.
Author - Brad Wyatt
Blog - The Lazy Administrator - http://thelazyadministrator.com
Blog Post - https://goo.gl/dLUeuu
Download - https://goo.gl/dLUeuu

Info
- Get all migration batches
- Get all the users in all the migration batches
- Find their Office 365 counter-part 
- Set their location code to the one you specify 
- Check to see if there is an available license to give from the license you specified users will get
- If there is a license, it will license the user
- Go onto the next user and repeat
- Give end script stats 

=================================================================

PowerShell Script to Move Exchange Distribution Groups to the Cloud
Author - Joseph Palarchio
Download - Link
Website - Link
Article Link - Link

Info -
Script to recreate distribution groups in the cloud so they can be self-managed by users via Outlook.
This script helps automate the process of moving the groups.

=================================================================

Migrate Mailbox Permissions to Office 365
Author - Roman Zarka
Download - Link
Website - Link

Info -
Mailbox permissions are typically translated to Office 365 during properly batched hybrid MRS moves, however there are several scenarios (e.g. third-party migration tools) where permissions must be audited on-premises and re-applied after migration.

Two Scripts -
- Export-MailboxPermissions.ps1
- Import-MailboxPermissions.ps1

=================================================================

Migration preparation scripts to update UPNs to match primary SMTP addresses
Author - Terry Munro
Download - Link
Support Article - Link
Website - Link

Info -
This pack of scripts to update UPN to match the user's Primary SMTP email address consists of five scripts which perform the following.

=================================================================

Microsoft Office 365: Add Exchange Online routing SMTP address
Author - Ilan Lantz
Download - Link
Website - Link

Info -
This script will find mailboxes that are configured with EmailAddressPolicyEnabled:$false and have no "@tenant.mail.onmicrosoft.com" address and will add the SMTP routing address required for an Exchange Online Hybrid deployment.It will try to add the proxy address prefix@tenant.

=================================================================

Migration Preparation - Report non-inherited Send-As permissions
Author - Ilan Lantz
Download - Link
Website - Link
Article - Link

Info -
The script creates a report for recipients which have non-inherited Send-As permissions assigned and export the results to a CSV report.

=================================================================

Migration Preparation - Fix-ProxyAddress.ps1 - Missing .onmicrosoft proxy address
Author - Chris Goosen
Download - Link
Website - Link
Article - Link


Info -
A small script with a GUI that simplifies the process of adding an SMTP proxy address to mailboxes that are not being updated by Exchange email address policies.

Once launched, the script will prompt for your tenant routing domain in the format 'company.mail.onmicrosoft.com' and will search for all mailboxes in the organization that do not have an email address policy applied.

=================================================================

Migration Preparation - Export Mailbox Rules for Bulk Users
Author - Aditya Mediratta
Download - Link

Info -
The Script allows us to export mailbox / inbox rules for bulk users in CSV files.

=================================================================

Convert an Exchange distribution group to an Office 365 Group
Author - Tony Redmond MVP
Download - Link
Website - Link

Info -
This script is intended to demonstrate how an Exchange Online distribution group can be converted to an Office 365 Group. Only mailboxes are supported in Office 365 Groups, so these are the only recipients moved across. The settings of the distribution group are moved as is its email address (you might not like to do this).

=================================================================

Migration Prep - Script to Create Cloud Contacts for Dynamic Groups in Exchange Hybrid
Author - Joseph Palarchio
Download - Link
Website - Link

Info -
When configured in an Exchange Hybrid configuration, Dynamic Distribution Groups are not synchronized by DirSync.  For cloud users to see these objects in their GAL, a contact object must be created in the cloud with the SMTP address of the on-premises Dynamic Distribution Group.
This script creates the necessary contact objects in the cloud and restricts them to authenticated users.

=================================================================

Migration Prep - Identify Email Addresses Non-Compliant with Their Policy
Author - Joseph Palarchio
Download - Link
Website - Link

Info -
This script helps identify users that have primary SMTP addresses that are not compliant with the email address policy that is assigned to them.

=================================================================

Migration Prep - Fix Duplicate Email Addresses for On-premises Mail-Enabled Objects
Author - OneScript Team
Download - Link

Info -
This script can fix duplicate email addresses for mail-enabled objects. This script allows you to export mail-enabled objects that duplicate email addresses. After you correct the email addresses for these groups, you can use this script to import them to the Active Directory.

=================================================================

Migration Troubleshooting - 
PowerShell Script to Complete Conversion of On-Prem Mailbox to Remote Mailbox
Author - Joseph Palarchio
Website - Link

Info -
When migrating a mailbox to Exchange Online via a remote move request, you’ll occasionally encounter an issue where the mailbox has moved successfully but the on-premises mailbox object has not changed to a remote mailbox.  If you’re using migration batches, you’ll see a status of "Completed with Errors" for the batch and "Completed with Warning" for the mailbox

=================================================================

Migration-Prep - Locate messages larger than 150 MB
Author - Sandeep Manjrekar
Download - Link

Info -
This Powershell script will help you to locate messages that are larger than 150 MB from user's on-premise mailbox and export to CSV.

=================================================================

Migration Prep - Find Objects with Duplicate UPN or SMTP values in Active Directory
Author - Aaron Guilmette
Download - Link
Blog Article - Link
Website - Link

Info -
Using the duplicate value referenced from the AADSync or DirSync Connector (or from running csexport), run this script to locate the errant objects.  Depending on your search parameters, this will query the default AD attributes, Exchange attributes, or SIP attributes that can cause sync to report a conflict.

=================================================================

Migration Prep - Merge User and Contact Object
Author - Aaron Guilmette
Download - Link
Website - Link

Info -
If you've been faced with duplicate objects identified by IDFix, then this may be the tool for you.  Frequently, customers are faced with mutliple objects that have the same attributes, causing errors during synchronization to Azure Active directory.  In the event that one of those objects is a contact and one of them is a user, you can use this tool to merge the contact object into the user and carry along all of the group membership and proxy addresses.

This script requires the Quest ActiveRoles PowerShell, in addition to access to an on-premises Exchange server and Active Directory domain controllers

=================================================================

Migration Prep - IDFix for Public Folders
Author - Aaron Guilmette
Download - Link
Website - Link

Info -
When migrating public folders to Office 365, basic checks need to be performed against the mail-enabled public folder objects to ensure they follow the same rules as the mailboxes (invalid characters or duplication in alias/mailnickname and SMTP attributes).  This script will allow you to generate a report of objects to review where the alias contained invalid characters or the SMTP address didn't pass validation, as well as suggestions to fix.

=================================================================

Export and Import Unified Groups Settings - Tenant to Tenant Migration
Author - Aaron Guilmette
Download - Link
Website - Link

Info -
Use this script to export / import Unified Groups and their settings as part of a tenant-to-tenant migration.This script supports multiple modes of operation:- Export (Backup)- Import (1 stage or 2 stage)- SetAs well as a method of transformation (address rewrite for importing/exporting).

=================================================================

Migration Prep - Get Mailbox Statistics for All Mailboxes
Author - Aaron Guilmette
Download - Link
Website - Link

Info -
This easily-modifiable example script will allow you to gather statistics and output the details that your boss wants.

=================================================================

Migration Preparation - Forwarding Address Export and Import
Author - Aaron Guilmette
Download - Link
Website - Link

Info -
When transitioning to Office 365 (or any other sort of cross-forest move), Forwarding Address information does not get preserved.  This script will allow you to back up both types of forwards (ForwardingAddress, which is a mail-enabled Exchange object and ForwardingSmtpAddress, which is a standard SMTP address), and then later restore or import them to target objects as standard SMTP forwards.

=================================================================

Migrate EOP Settings Between Tenants
Author - Aaron Guilmette
Download - Link
Website - Link

Info -
Based on the TN instructions for moving EOP between organizations, this script aims to help break it into various modes and functions (import and export all settings, DNS, domain confirmation), simplify the process, as well as give an operational order.  This script supports both the legacy standalone EOP as well as the Office 365 Exchange Online Protection SKU, as well as configuring IRM for Azure AD/ExchangeOnline.

=================================================================

Migration Prep - Audit - Transport Rules to External Recipients
Author - Aaron Guilmette
Download - Link
Website - Link

Info -
Your organization's security protocol may require you to peridiocally audit your environment to ensure data exfiltration via transport rules is not configured.  This script will report on transport rules with the following actions configured to send to external recipients:
- AddToRecipients
- AddCcRecipients
- AddBccRecipients
- RedirectMessageTo

=================================================================

Disconnect PSTs from Outlook Profile
Author - Aaron Guilmette
Download - Link
Website - Link
Blog Article - Link

Info -
This script will disconnect PSTs from the default Outlook profile using the Outlook COM object via PowerShell. You must have Outlook 2010, 2013, or 2016 installed in order to use this script.

One potential way to use this script is via the logon process:
powershell \\server\share\Disconnect-OutlookPSTs.ps1

=================================================================