Recently a customer updated to Powershell 4.0 on a server running some exchange 2010 scripts on a scheduled task. These failed as Exchange 2010 does not currently support Powershell v4.0 (http://blogs.msdn.com/b/powershell/archive/2013/10/25/windows-management-framework-4-0-is-now-available.aspx) so in order to get these to work we added a switch to the powershell.exe call:
Powershell.exe –version 2.0
As above this will open the powershell window as a version 2.0 window then with another switch addition you can call the exchange Remote script and call the script you wish to run:
-command “. ‘C:Program FilesMicrosoftExchange ServerV14binRemoteExchange.ps1’; Connect-ExchangeServer -auto; “& ‘C:Program FilesMicrosoftExchange ServerV14ScriptsRedistributeActiveDatabases.ps1”
This time the script should run as expected.
Hope it helps!