How to connect to Exchange Online PowerShell

To execute PowerShell cmdlets to perform the required operations in Exchange Online environment, it is imperative to connect Exchange Online PowerShell. Mentioned below is a sample script to connect to your Exchange Online organization using PowerShell; username and password of an account with relevant permissions must be entered for successful connection.

Powershell script

$password = ConvertTo-SecureString "********" -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential
("", $password)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session -AllowClobber
#Always make sure to remove PSSession
Remove-PSSession $Session

The need to connect Exchange Online PowerShell to your session arises only to manage and report on Exchange Online environment using PowerShell. But there's an option to manage not just Exchange Online organizations but also AD, Office 365, Exchange Server, and more without having to download Microsoft Exchange Online PowerShell module - ADManager Plus.

The efficient and effective alternative to PowerShell

ADManager Plus, a unified AD, Office 365 and Exchange management and reporting solution, enables you to manage and report on multiple platforms from a single console, with completely GUI-based, scripting free actions. It also offers purpose-built management features and reports to cater to every important aspect of AD, Office 365 and Exchange management and reporting. There is absolutely no need to import Exchange Online PowerShell module, connect Exchange Online PowerShell or connect to Office 365 PowerShell from your machine to manage Exchange Online organizations.

Advantages of ADManager Plus over PowerShell

  • All-inclusive scripting-free, unified console: ADManager Plus, unlike PowerShell makes it possible to manage and report on AD, Office 365, Exchange Server, Google Workspace, Skype for Business, and more, all from an all-in-one web-based console, with point and click actions. . No more struggling with scripting, multiple consoles, CLIs, tools, etc.
  • Purpose-built management features: Be it AD, Office 365 or Exchange, ADManager Plus offers predefined task templates which allow you to:
    • Provision AD accounts, and modifying them; cleanup stale accounts, manage GPOs and more
    • Create Exchange mailboxes, assign mailbox policies, manage Exchange features such as OWA, OMA or ActiveSync, etc.
    • Create Office 365 users, manage licenses, and more.

    In fact, these built-in management features allow you to manage objects and accounts in multiple platforms, in bulk, with purely GUI-based actions.

  • Built-in reports library with over 200 reports: Reporting on AD, Office 365, Exchange and Google Workspace is turned into a simple point and click activity. Generate reports on AD users, groups, computers, GPO, and more; Office 365 users, licenses, distribution and dynamic distribution groups and their members, etc.; Exchange mailbox enabled users, mail-enabled groups, etc.; NTFS and share permissions reports; compliance based reports, and more, instantly.
  • Privileged access management: Manage security group membership, and file server permissions in bulk. Analyze users' and groups' privileges and permissions with detailed nested group membership reports, and file server permissions reports to identify excessive and inappropriate permissions and remove them. Control access to critical data easily.
  • OU-based granular and secure delegation: Create and assign custom help desk roles, with appropriate tasks or operations, to delegate AD management and reporting operations to help desk, non-admin or even non-IT users such as HRs . As these permissions are specific to the product--users' permissions will not be elevated in AD--and the users will be able to perform only the delegated operations, in the delegated domains, OUs and groups, also, this delegation is completely secure.
  • Customizable approval-based workflow: Monitor, and streamline operations in AD, Office 365, Exchange and more, with multi-level review-approve based workflow, and real-time notifications.
  • Automation: Be it a standalone task like creating user identities, assigning Office 365 licenses, or stale account cleanup, or even managing the complete life cycle of user accounts, ADManager Plus. allows you to automate any operation quickly and easily.
  • Out-of-the-box integrations: ADManager Plus integrates with help desk software such as ServiceDesk Plus, ServiceNow, and Zendesk; databases such as Oracle and MS SQL, HRMS applications like Workday, BambooHR, UKG Pro, and Zoho People; Syslog and Splunk; and more, for a holistic and integrated approach to IAM.

Simultaneously provision mailboxes in both Exchange and Office 365 with ADManager Plus.

  Get 30-day free trial.
  • Embark on your script-free AD management, reporting, and automation journey with ADManager Plus.
  • By clicking 'Start your free trial now', you agree to processing of personal data according to the Privacy Policy.
  • Thanks
  • Your download should begin automatically in 15 seconds. If not, click here to download manually.

Related Powershell How-to Guides:

The one-stop solution toActive Directory Management and Reporting

Email Download Link