On the windows 2012 server, if I launch the powershell script with "import-module ActiveDirectory" first, followed by "Add-PsSnapin Microsoft.Exchange.Management.PowerShell.E2010", I got an exception:
Add-PsSnapin : Cannot load Windows PowerShell Snap-In Microsoft.Exchange.Management.PowerShell.E2010 because of thefollowing error: The type initializer for 'Microsoft.Exchange.Data.Directory.Globals' threw an exception.
At line:1 char:1
+ Add-PsSnapin Microsoft.Exchange.Management.PowerShell.E2010
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Excha...owerShell.E2010:String) [Add-PSSnapin], PSSnapInException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
If I load the "Add-PsSnapin Microsoft.Exchange.Management.PowerShell.E2010" before "import-module ActiveDirectory", it seems fine, no exception.