Exchange Online / Office 365 : Connect mit der Powershell
Wenn man Exchange Online mit der Powershell administrieren will muss zuvor ein connect aufgebaut werden. Dieser wird mit diesem Schnipsel aufgebaut.
<# Connect To Exchange Online #>
if (-not ($ExoCreds)) {
$ExoCreds = Get-Credential -Message 'Global Admin please' -UserName 'ADMINUSER'
}
$ProxyOptions = New-PSSessionOption -ProxyAccessType None
$ExoSession = $null
Get-PSSession -ErrorAction SilentlyContinue | Where-Object {$_.ComputerName -eq 'outlook.office365.com'} | Remove-PSSession -ErrorAction SilentlyContinue -Confirm:$false
$ExoSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $ExoCreds -Authentication Basic -AllowRedirection -SessionOption $ProxyOptions
Import-PSSession $ExoSession -DisableNameChecking -AllowClobber