Home » Cloud » Azure » Connect Office365 Using PowerShell

Connect Office365 Using PowerShell

Install the .Net Framework for supporting Azure AD connect

Download Azure AD Connect After downloading install it.
http://go.microsoft.com/fwlink/p/?linkid=236298
http://go.microsoft.com/fwlink/p/?linkid=236297

Configure the Azure AD Connect
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 Office365 Using cmdlets
Once you have finished the above you’re ready to actually connect to your Office365
domain. Here is the below syntax that you will need to run

Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri
https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic –
AllowRedirection
Import-PSSession $O365Session -AllowClobber
Connect-MsolService –Credential $O365Cred

 

Execute cmdlets for displaying email forwarder

After connecting 0365 execute this command for finding all user who was forwarder
enabled.

“Get-Mailbox | select UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward”