All Posts
Exchange Online 11 Views 9 min read

How to Install and Configure PowerShell 7.x to Manage Microsoft 365 Workloads

Last Updated July 19, 2026

PowerShell 7.x is the modern, cross-platform automation tool from Microsoft, built on the latest .NET framework. Unlike the legacy Windows PowerShell 5.1 which is locked to the Windows operating system, PowerShell 7 runs natively on Windows, macOS, and Linux, giving administrators a consistent scripting environment across their entire infrastructure. This guide walks through the complete installation and configuration process for using PowerShell 7 to manage Microsoft 365.

Why Upgrade to PowerShell 7 for Microsoft 365 Management?

Modernizing to PowerShell 7 provides critical advantages for Microsoft 365 administrators:

  • Cross-Platform Support. Run the same management scripts on Windows, macOS, and Linux without modification, enabling consistent automation across heterogeneous environments.
  • Performance Improvements. PowerShell 7 is built on modern .NET versions (PowerShell 7.6 on .NET 10.0 LTS), delivering faster execution and better memory efficiency compared to Windows PowerShell 5.1.
  • Native Module Compatibility. The ExchangeOnlineManagement module (EXO V2+), Microsoft Graph PowerShell SDK, and other modern M365 modules are fully supported in PowerShell 7, making it a first-class choice for cloud administration.
  • Future-Proof Automation. Microsoft continues active development on PowerShell 7, while Windows PowerShell 5.1 receives only security updates. PowerShell 7 is the platform where new features and modules will land.
  • Side-by-Side Installation. PowerShell 7 installs alongside Windows PowerShell 5.1, allowing you to test scripts safely without removing the legacy version.

What You’ll Configure

You will install PowerShell 7.x on your operating system of choice, install the necessary Microsoft 365 management modules, and configure secure authentication to your tenant. To perform these actions, you will need:

  • Windows 10, Windows 11, Windows Server 2016 or later (for Windows).
  • An administrative account on your local machine (for module installation).
  • Microsoft 365 Global Administrator or appropriate delegated admin account (for connecting to services).
  • Internet access to the PowerShell Gallery (PSGallery) and Microsoft authentication endpoints.

Step 1: Install PowerShell 7.x

The installation method depends on your operating system. Choose the section that matches your environment.

Important Version Note for M365 Management
If you plan to manage Exchange Online, note that ExchangeOnlineManagement module versions 3.5.0 or later require PowerShell 7.4.0 or later due to .NET 8.0 dependencies. Version 3.0.0 through 3.4.0 require PowerShell 7.2.x (.NET 6.0). Installing the latest PowerShell 7.x (currently 7.6) is strongly recommended for best compatibility.

Windows Installation

On Windows 10, Windows 11, or Windows Server 2025, the recommended method is using WinGet, the Windows Package Manager:

  1. Open an elevated PowerShell 7 or Windows PowerShell prompt.
  2. Run the following command to install PowerShell 7:
PowerShell
winget install --id Microsoft.PowerShell --source winget
  1. Once installed, launch PowerShell 7 by typing pwsh in your terminal or finding it in the Start Menu.

For Windows Server 2022 or earlier (where WinGet is not available), or for enterprise deployment scenarios, download and run the MSI package from the official GitHub releases page.

Note: PowerShell 7 does not replace Windows PowerShell 5.1. It installs to a new directory and runs side-by-side with the legacy version, allowing safe script testing.

Step 2: Verify PowerShell 7 Installation

Once installed, open a new terminal (or Command Prompt) and launch PowerShell 7 by typing pwsh. Run the following command to confirm your version:

powershell

PowerShell
$PSVersionTable.PSVersion

For Microsoft 365 management, you should see 7.4 or higher (ideally 7.6 or the latest LTS release). Example output:

PowerShell
Major  Minor  Patch  PreReleaseLabel BuildLabel

-----  -----  -----  ---------------- ----------

7      6      2

Step 3: Install Required Microsoft 365 PowerShell Modules

With PowerShell 7 installed, you can now install the modules required to manage specific Microsoft 365 workloads. Run all installation commands from an elevated (administrator) PowerShell 7 session (“Run as administrator” on Windows).

Exchange Online Management (EXO V2+)

The ExchangeOnlineManagement module (commonly called EXO V2+) is required for managing mailboxes, transport rules, and other Exchange Online settings:

PowerShell
Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber

This module is supported in PowerShell 7 on Windows, macOS, and Linux, making it truly cross-platform.

Microsoft Graph PowerShell SDK

The Microsoft Graph PowerShell SDK is the modern, recommended way to manage Entra ID (Azure AD), users, groups, licenses, and any resource exposed through the Microsoft Graph API:

PowerShell
Install-Module Microsoft.Graph

For large tenants, you can install only the sub-modules you actually use (e.g., Microsoft.Graph.Users, Microsoft.Graph.Groups) to reduce memory footprint.

SharePoint Online Management

For SharePoint Online administration (site collections, sharing settings, storage quotas), install the dedicated SharePoint Online Management Shell:

PowerShell
Install-Module -Name Microsoft.Online.SharePoint.PowerShell

Important: While Microsoft Graph PowerShell has some SharePoint-related beta cmdlets, they are not yet considered production-ready for SharePoint administration. The Microsoft.Online.SharePoint.PowerShell module remains the recommended and fully supported option.

Teams PowerShell Module

If you manage Microsoft Teams, install the Teams PowerShell module:

PowerShell
Install-Module -Name MicrosoftTeams

(Legacy) MSOnline Module for Older Scripts

The older MSOnline module (Azure Active Directory module for PowerShell) is still used by some legacy scripts, but Microsoft Graph PowerShell SDK is the recommended replacement for all new development. To install the legacy module if absolutely necessary:

PowerShell
Install-Module -Name MSOnline

Step 4: Configure Execution Policy (Windows Only)

On Windows, PowerShell’s execution policy may block script execution. To allow local scripts to run while maintaining security, set the execution policy for the CurrentUser scope:

PowerShell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

This setting allows locally created scripts to run without signing, while requiring remote scripts to be signed by a trusted publisher.

Step 5: Connect to Your Microsoft 365 Services

Once the required modules are installed, you can connect to individual services using their dedicated Connect-* cmdlets.

Connect to Exchange Online

PowerShell
Connect-ExchangeOnline

A browser window will open for authentication. Enter your Microsoft 365 admin credentials and complete any Multi-Factor Authentication (MFA) prompts. After successful authentication, your session is connected.

Connect to Microsoft Graph (Entra ID / Users / Groups)

PowerShell
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All", "Directory.Read.All"

The -Scopes parameter specifies the permissions your session requests. You can add or remove scopes based on your administrative needs. After connecting, you can run commands like Get-MgUser -Top 10 to verify access.

Connect to SharePoint Online

PowerShell
Connect-SPOService -Url https://<yourtenant>-admin.sharepoint.com

Replace <yourtenant> with your Microsoft 365 tenant name. Note the -admin portion in the URL – this is mandatory and a common mistake is using the regular SharePoint URL instead.

Connect to Microsoft Teams

PowerShell
Connect-MicrosoftTeams

Step 6: Verify Your Connections

Run simple cmdlets to confirm that each connection is working correctly:

ServiceVerification Command
Exchange OnlineGet-Mailbox -ResultSize 5
Microsoft GraphGet-MgUser -Top 5 -Property DisplayName,UserPrincipalName
SharePoint OnlineGet-SPOSite -Limit 5
TeamsGet-Team -Limit 5

Wrap-up

You can install and configure PowerShell 7.x for Microsoft 365 management by downloading and installing the cross-platform shell on Windows, macOS, or Linux, then adding the specific modules required for your workloads (ExchangeOnlineManagement, Microsoft Graph, SharePoint Online, Teams). Ensure your PowerShell 7 version is 7.4 or later for full compatibility with the latest module versions. Use this configuration to centralize your administrative tasks, automate bulk operations, and maintain consistent management across your entire Microsoft 365 tenant from any operating system.

A Note on Version Compatibility: If you encounter errors connecting to Exchange Online, verify that your PowerShell 7 version matches the requirements of your installed ExchangeOnlineManagement module. Module versions 3.5.0 and later require PowerShell 7.4+, while versions 3.0.0-3.4.0 require PowerShell 7.2+. Downgrading the module or upgrading PowerShell 7 will resolve most compatibility issues.

Share this article:
Fast-Track Your Compliance

Need help with Aramco CCC Certification?

Get a Free Expert Consultation.

Aramco Kit

Ali Aljubaily

Cybersecurity Consultant

I am Ali Yousef, a certified engineer from Microsoft, holding the Microsoft Certified System Associate certification as well as the CompTIA Network+ certification. I work as the Group IT Manager.

Latest

Explore Our Blog Posts

Discover insightful articles on cybersecurity and more.

Aramco Third-Party Cybersecurity (TPCS) 2026 Assessment Questionnaire
Aramco Cybersecurity Compliance 100 Views 4 min read

Aramco TPCS 2026: Is Your Organization Ready for Third-Party Cybersecurity Compliance?

Evaluate your Aramco Third-Party Cybersecurity compliance with our free 2026 TPCS questionnaire. Get instant remediation steps. No commitment. Saudi-focused.
Read more
Aramco Cybersecurity Compliance - Email Compliance Guide
Aramco Cybersecurity Compliance 92 Views 11 min read

Pass the TPCS Email Audit with Exchange Online and Defender for Office 365

Achieve TPCS email security compliance using Exchange Online and Defender for Office 365. A step-by-step guide for Vendors seeking Aramco...
Read more
Access Control SACS-210 compliance guide for IT Managers TPC1.9 TPC1.12
Aramco Cybersecurity Compliance 113 Views 8 min read

What Is Access Control in SACS-210? An IT Manager’s Guide

Wondering what is access control for SACS-210? Eliminate guesswork and get auditor-ready templates to enforce MFA, RBAC, and secure corporate...
Read more

Our Certified Expertise and Technology Partnerships

We are certified partners with the world's leading cybersecurity vendors to deliver best-in-class solutions.

Microsoft
Microsoft
Certified Partner
Bitdefender
Bitdefender
Gold Partner
Fortinet
Fortinet
Authorized Partner
Acronis
Acronis
Certified Partner

Ready to Secure Your Business?

Our cybersecurity experts are here to help you achieve compliance and protect your digital assets with our 100% remote implementation model. Achieving compliance requires zero on-site field visits or internal IT hours. Contact us for a free, no-obligation assessment of your cybersecurity needs. We are committed to a 2-hour response time for all inquiries during business hours.

2-hour response time
Free consultation
Certified experts