$Tenant = Read-Host -Prompt 'Input the tenant admin account'
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName $Tenant
Set-ExecutionPolicy RemoteSigned
Install-PackageProvider -Name NuGet -Force
Install-Module -Name PowerShellGet -Force
Update-Module -Name PowerShellGet
Install-Module -Name ExchangeOnlineManagement
New:
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName admin@tenant.onmicrosoft.com
Old:
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection
Import-PSSession $Session -DisableNameChecking