During my AD migration, I noticed an issue, there is no way to move contacts from one AD domain to another and even moving from one exchange server to another is difficult. This script gathers all the contact information, then deletes them, waits 5 minutes for replication, and then recreates them on the new domain and new exchange server. You need to be logged into the new domain as it uses the current one as the destination. Also please change the line in the code which refers to $newmailserver to your own exchange server. It will associate the new contacts with this server and use this server to update the GAL.
The 1st time you run it you will notice it will show you what it is going to do, but doesn't actually do it. I highly recommend you test it first like that, when your comfortable with it, remove the "-whatif" code on some of the lines to actually have it perform the task.
I've updated the code, and now have it setup so that it will hunt through the forwarding setup in your mailboxes and re-direct them back to the correct contact. This is required as the contacts will no longer be where they were originally.
Please do be careful this script, will delete your existing contacts and make new ones. It does not write any of the information to a file, so everything is kept in memory. If something goes wrong you could have big problems, so please backup, and make sure you understand how the code works before running.
Looking for any comments/suggestions, just contact me email@example.com or at least give me a rating.