When running the following command

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection

you receive the following error in Remote Powershell for Exchange Online (Office 365)

Files cannot be loaded because running scripts is disabled on this system.  Provide a valid certificate with which to sign the files.




Run the following command

Set-ExecutionPolicy RemoteSigned

and then run the original command again.

Note: You’ll only need to run this command once from the computer you are using to connect to Remote Powershell, not every time you connect.