Symptom
When running the following command
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -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.
Resolution
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.
Click to rate this post!
[Total: 5 Average: 4.2]
Try this one
Set-ExecutionPolicy Unrestricted
I solved the issue by:
1) Changing directly ExecutionPolicy value to “Bypass” under ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell”
2) Assigning Full Access permissions to the running account over the key ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” by right-clicking it and selecting Permissions
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine