Solved

Powershell Scripts for Office 365 Migartion

Posted on 2014-10-09
3
565 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
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Vasil Michev (MVP) earned 500 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 40

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

This is my first article on Expert Exchange on the Manual Method of Exporting Office 365 Mailboxes to PST format by using the eDiscovery mechanism of Office. Hope you will enjoy the article.
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 …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

792 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