Connect Exchange Online using PowerShell

Connect Exchange Online using PowerShell

Managing Exchange online with PowerShell requires you to connect with Exchange Online. Few months ago i was working on automating the process of connecting with Exchange online rather then writing the cmdlets every time i connect with Exchange online and you know what i come up with ? Powershell Function which makes it so easy for me to connect to Exchange Online anytime i want to and i don’t have to write cmdlets every time. The function is as below.

# PowerShell Function to connect with Exchange Online

Function Connect-ExchOnline {
$ExchOnlineCred = Get-Credential

Write-Output “You are Connecting to Exchange Online. After successful authentication PowerShell will load Exchange Online Cmdlets”

#Create remote Powershell session with Exchange Online
$ExchOnlineSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $ExchOnlineCred -Authentication Basic -AllowRedirection

#Import the remote PowerShell session

Import-PSSession $ExchOnlineSession -AllowClobber | Out-Null



You can download this PowerShell function script from Technet Gallery. This script is basically a function and I didn’t “call” the function in the script self. Try dot-sourcing the script first and then running it using Connect-ExchOnline and enter your Office 365 admin credentials to connect.

1 17 18 19