?
Solved

Powershell Scripts for Office 365 Migartion

Posted on 2014-10-09
3
Medium Priority
?
604 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 45

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 45

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

Problems using Powershell and Active Directory?

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

Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
Just after setting up Cloud PBX connectivity and migrated Skype users to SFBO, we noticed inbound calls not working but outbound calls would work.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

589 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