$User = "utente@dominio.tld" $PWord = Get-Content C:\pshell\password.txt | ConvertTo-SecureString $Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Credential -Authentication Basic -AllowRedirection Import-PSSession $Session