?
Solved

Powershell Scripts for Office 365 Migartion

Posted on 2014-10-09
3
Medium Priority
?
591 Views
Last Modified: 2014-10-15
I am migrating 18 domains from one office365 Tenancy to another.
Let's call them T1 [source] and T2 [destination]. I have migrated smaller domains first to test and have ran into some changes which are fine with only 3-4 users per domain, but when i have 200 user domain migration i will need some automation and good Powershell scripts to help. To date I have gathered a lot of useful scripts, but am not sorely missing the following... Any ideas where or what i can do to get them ?

Remove Vanity domain from any user with it as an alias or Primary domain.#

Bulk Purge all "deleted contacts" or at least bulk delete from CSV.

Assign Vanity domain from CSV, ideally setting as either Primary or Alias.
0
Comment
Question by:paologiorgio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 42

Accepted Solution

by:
Vasil Michev (MVP) earned 2000 total points
ID: 40370945
I think it's better if you do the first part manually, as there are probably too many factors you need to account for. For example, does the user have more than one address, are the secondary aliases in usable format (i.e. will he end up with something like tfdsfhsd@domain.onmicrosoft.com), which one to set up as primary if the primary is removed, etc. You can easily get a list of all the objects that have such aliases, the removal part is what worries me.

 Get-Recipient -Filter {EmailAddresses -like "*domain.com"}

Open in new window


Contacts are 'special case' with WAAD, you can only list them by using objectId or searchstring. If you remove them, they dont go to the recycle bin, so can you clarify what you mean by "deleted contacts"? Perhaps the objects in your case are mailusers?

For adding the new alias, probably the easiest way is to run:
Set-Mailbox user@domain.com -WindowsEmailAddress new@newdomain.com

Open in new window


This will add new@newdomain.com alias, make it primary and preserve user@domain.com as secondary. So you can just pass the CSV imported objects to it.
0
 

Author Comment

by:paologiorgio
ID: 40370988
Vasil,

Thanks for Reply.

By deleted contacts i mean, i deleted the contact asmith@contoso.com in T2 and they were no longer present in contacts in exchange admin. I thought that it was gone for good.

I then went to add the vanity domain contoso.com (recently verified on T2) to the user asmith (a user with a license) and it threw up the error about the name already exists.

I presumed the contacts had not flushed and went about purging contacts. When i searched for mailcontact containing "asmith" i found my culprit, using the unique ID i forced deletion.

I was then able to add domain and turn my contact essentially into a mailbox.
0
 
LVL 42

Expert Comment

by:Vasil Michev (MVP)
ID: 40371001
Hm, maybe you can try deleting it from WAAD instead of EO, using the Remove-MSOLContact cmdlet. Probably when you remove it from Exchange first it waits for replication, thus the delay you experienced.

Edit: just deleted a test contact from WAAD and immediately created another one with the same email address, no issues.

Repeated the same procedure by deleting the contact from EO instead, again no issues after I recreated it. Strange...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question