How to Connect Office 365 with PowerShell


Remote PowerShell allows you to manage your Exchange Online (office 365) settings from
the command line. You use Windo ws PowerShell on your local computer to create a remote
PowerShell session to Exchange Online. Azure AD connect is the application which gain
access from on premises to online by just putting local AD Credential s and O365 C redentials
you will sync with office 365 It’s a simple process where you enter your Office 3 65 credentials,
provide the required connection settings, and then import the Exchange Online cmdlets into
your local Windows PowerShell session so that you can use them

Install Latest .NET Framework

Download Azure AD Connect

After downloading install it
32bit – 64bit –

Configuring Azure AD

Open Azure AD connect and configure it by giving local AD username and password and
then office 365 username and password. It will sync AD to office 365.

Connect o365 with cmdlets

Once you have finished the above you’re ready to actually connect to your Office365 domain. Here is the syntax that you will need to run
Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $O365Cred -A uthentication Basic -AllowRedirection

Import-PSSession $O365Session AllowClobber
Connect-MsolService Credential $O365Cred

Execute Cmdlet for Displaying

After connecting 0365 execute this
command for finding all user who were forwarder

Get-Mailbox | select

Hope this will help you to connect with O365.

Leave a Reply