Some times it can be very usefull to automate things by creating a script. Of course you will first have to think if it is usefull to automate it or just decide to do it manually. Which option you chose is really hard to say but let’s say if you have to modify more then 50 items becomes very interested to use a script.
Exchange 2010 contains a few scripts, for example a script which let’s you configure Public Folder replica’s during a migration. All scripts can be found in the scripts directory. This directory can be found in the Exchange installation directory, for example c:\Program Files\Microsoft\Exchange Server\V14\Scripts.
When you have opened the Exchange Management Shell (EMS) you can browse to it by typing cd $exscripts.
Here you will find a lot of scripts among them:
Script to add replica's of Public Folders
Add PF replica's to an Exchange 2010 Server:
.\AddReplicaToPFRecursive.ps1 -server "Exchange 2003 Server" -TopPublicFolder "\" -ServerToAdd "Exchange 2010 Server"
Replicate the System Folders to an Exchange 2010 Server:
.\AddReplicaToPFRecursive.ps1 -TopPublicFolder "\NON_IPM_Subtree" -ServerToAdd "exchange2010
Checks the environment for recipients with invalid characters
Moves all replicas away from a server. Necessary to remove a PF database
Moves all replica's from the PF of Exchange 2003 to Exchange 2010:
.\MoveAllReplicas.ps1 -Server "Exchange Server 2003" -NewServer "Exchange Server 2010"
Besides these scripts a lot of ready-to-use scripts are offered by Microsoft and other bloggers. Personally I like the following two scripts:
The first script can be used to fix aliases of mailboxes, mailcontacts and Public Folders. In some cases you will find that users might have an alias which contains incorrect characters. Starting from Exchange 2007 this isn’t allowed anymore. When you ignore this error you may see strange issues such as users dissapearing fromt the addresslist.
To prevent this kind of issues Microsoft has published a script. The script will give you the ability to search for specific characters and replace them. For example assume all aliasses will end with domain.com. By usinfg the fix-alias script using the following parameters domaim.com will be replaced by nothing:
The script has one limitation it can’t fix two errors. So if an allias contains an @ and a space the script will generate an error.
The second script is really usefull when you are migrating address lists or recipient policies. Normally you will have to manually rebuild both and convert the LDAP filter to an OPATH filter. When you will do this on a regular basis this will not be an issue but in most cases this is not what you do daily. In that case we can migrate them automatically by using the ConvertFrom-LdapFilter script. For example let’s say we have a recipient filter which is called support. This recipient policy will be applied to all employees of the support department and will add an e-mail address using the following domain support.domain.com. To convert this policy we can use the script as follows:
Set-EmailAddresspolicy Support -RecipientFilter (.\ConvertFrom-LdapFilter.ps1 $.LdapRecipientFilter)
As you can see there are enough scripts which can help you during a migration. The scripts mentioned above can be downloaded from the sites below: