Exchange scripts stop working with Powershell v4.0

2017-12-07T10:12:41+00:00 June 9th, 2014|Exchange, PowerShell|

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 ( 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!