Exchange online PS connection

PS:

#(Refer to post regarding encrypting credentials)

#Modify accordingly and save in PSProfile

[string]$ExchOnline = "outlook.office365.com"
$exolusername = "######@######.onmicrosoft.com"
$exolpassword = Get-Content "C:\TEMP\EncryptedPasswords\######.txt" | ConvertTo-SecureString  
$Excredential = new-object -typename System.Management.Automation.PSCredential -argumentlist $exolusername, $exolpassword

#Called via a function:

Function EOL-Connect($Prefix){
$EXOnlineSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://$ExchOnline/powershell-liveid/ -Credential $Excredential -Authentication Basic -AllowRedirection -ErrorAction Stop
$warningPreference = "SilentlyContinue"
if($Prefix){Import-PSSession $EXOnlineSession -prefix $Prefix -warningaction silentlycontinue  -erroraction silentlycontinue | Out-Null
write-host -backgroundcolor red -foregroundcolor yellow "Use command prefix: $Prefix"
}
else{Import-PSSession $EXOnlineSession -warningaction silentlycontinue  -erroraction silentlycontinue | Out-Null}
$warningPreference = "Continue"
}