This works in Exchange 2013; probably similar for others.

program to start:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

arguments:

 -command ". 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\path\to\custom_script.ps1"