set-executionpolicy RemoteSigned set-executionpolicy default $cred = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection Set-ExecutionPolicy -ExecutionPolicy unrestricted $importresults = Import-PSSession $session Set-ExecutionPolicy -ExecutionPolicy restricted