Here's a quick example for creating a scheduled task to run a .ps1 script in exchange powershell, it is not as simple as you might think…
The parameters to be passed are:
Program or script: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe
Arguments: -NonInteractive -WindowStyle Hidden -command “. ‘C:Program FilesMicrosoftExchange ServerV15binRemoteExchange.ps1’; Connect-ExchangeServer -auto; c:ScriptsExchangescript_name.ps1”
If you have an easier method post it in the comments, Thank you!!