I am trying to execute powershell command
Get-Mailbox
from C# code.
When my C# project is complied in .NET 3.5 then no exceptions are thrown
But when same project is compiled in .NET 4.0 this error message getting thrown.
This C# application is executed on exchange server itself not from remote machine. Exchange server has all .NET version installed from 1.1 to 4.0.
I thought i have to add app.config file so i have updated project config file with these 2 lines
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0"/></startup>
But no luck.
Any one know why .NET 4.0 is causing problem for Exchange 2010 cmdlets ?
.Net 4.0 is installed after installing Exchange.
Exchange 2010 has SP3 installed.