You paste a SharePoint script into PowerShell and it stops on line one with a red error about Connect-PnPOnline. The cmdlet worked yesterday, or on a colleague’s laptop, so the script itself usually isn’t the problem.
In this tutorial, we’ll fix Connect-PnPOnline is not recognized step by step. We reproduced every cause, so each fix shows the real output you should see.
Quick answer: The error means PowerShell can’t load the PnP.PowerShell module. Open PowerShell 7.4 or later (not Windows PowerShell 5.1 or the ISE), run Install-Module PnP.PowerShell -Scope CurrentUser, then connect with Connect-PnPOnline -Url <site> -Interactive -ClientId <your app ID>.
What You Need Before You Start
Here’s the full message from Windows PowerShell 5.1. PowerShell 7 words it slightly differently (“as a name of a cmdlet … or executable program”), but it means the same thing:
Connect-PnPOnline : The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
+ CategoryInfo : ObjectNotFound: (Connect-PnPOnline:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
- PowerShell 7.4 or later. Current PnP.PowerShell releases don’t load in Windows PowerShell 5.1.
- Your own Microsoft Entra ID app (client ID) for signing in. You’ll need it right after the error is gone.
- A SharePoint Online site you can open. PnP.PowerShell doesn’t work with SharePoint Server on premises; if you’re choosing between modules, see how to connect to SharePoint Online using PowerShell.
Step 1: Check Which PowerShell You’re Running
This is the cause we see most often. Here’s the error in Windows PowerShell 5.1, the blue console that ships with Windows:

The confusing part is that PnP.PowerShell was installed on this machine. Get-Module -ListAvailable returned 0 copies, and Import-Module showed the real reason:

Windows PowerShell hides modules built for PowerShell 7, so the cmdlet looks missing. Check your version and install PowerShell 7 if the major version is 5. A similar message for Get-SPWeb has a different cause; we cover it in the term Get-SPWeb is not recognized.
$PSVersionTable.PSVersion
# Not on 7.4 or later? Install PowerShell 7, then open "PowerShell 7" (pwsh), not "Windows PowerShell"
winget install --id Microsoft.PowerShell --source winget
Step 2: Install PnP.PowerShell for Your Account
PowerShell 7 alone isn’t enough if the module was installed for another user or only on your old PC. We simulated that by limiting the module path:

Install the module for your own account. -Scope CurrentUser doesn’t need admin rights. Our guide to install PnP PowerShell for SharePoint Online covers proxies and offline machines.
Install-Module -Name PnP.PowerShell -Scope CurrentUser
# Later, to get the newest release
Update-Module -Name PnP.PowerShell
PowerShell asks whether you trust PSGallery, because it’s untrusted by default; answer A (Yes to All). We previewed the install with -WhatIf, which showed version 3.4.1 on 10/23/2026:

Step 3: Import the Module and Remove the Old One
Next, list every copy PowerShell can see, confirm the retired SharePointPnPPowerShellOnline module is gone, and import the module. Import-Module prints the real load error instead of “not recognized”:

Multiple versions are fine; PowerShell loads the newest. If you still have the old SharePointPnPPowerShellOnline module from 2020 or earlier, remove it so old scripts don’t pick it up:
# Run in Windows PowerShell 5.1, where the old module lived
Get-Module -ListAvailable SharePointPnPPowerShellOnline
Uninstall-Module -Name SharePointPnPPowerShellOnline -AllVersions -Force
Step 4: Check the Execution Policy
A Restricted policy blocks the module’s formatting file (.ps1xml), so the module can’t load. We set Restricted for one session only and got a different variant: the command “was found in the module ‘PnP.PowerShell’, but the module could not be loaded”:

RemoteSigned is the usual fix for your account. Group Policy and Process settings override it, so check the list first:
Get-ExecutionPolicy -List
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Step 5: Connect with Your Own Client ID
Once the module loads, many people hit the next wall. Since September 9, 2024, Connect-PnPOnline needs your own Entra ID app. Without -ClientId, we got this warning:

Register an app once (it needs at least the Application Developer role), then pass its ID. The old Register-PnPManagementShellAccess route no longer works; see Register-PnPManagementShellAccess is not recognized.
Register-PnPEntraIDAppForInteractiveLogin -ApplicationName "PnP PowerShell" -Tenant spguides.onmicrosoft.com
Connect-PnPOnline -Url "https://spguides.sharepoint.com/sites/SPGuides" -Interactive -ClientId "<your-client-id>"
With the client ID in place, the connection to our SPGuides site worked and returned its lists:

Connect-PnPOnline Error Cheat Sheet
| What you see | Cause | Fix |
|---|---|---|
“not recognized” and $PSVersionTable shows 5.1 | Windows PowerShell 5.1 or the ISE | Open PowerShell 7.4+ (pwsh) |
| “not recognized” in PowerShell 7, 0 modules listed | Module not installed for this user | Install-Module PnP.PowerShell -Scope CurrentUser |
| “requires a minimum … version of ‘7.4.6’” | Module newer than your PowerShell | Update PowerShell 7 |
| “found in the module … could not be loaded” | Execution policy or a broken install | Import-Module PnP.PowerShell to see why |
| “Please specify a valid client id” | No Entra ID app | Register an app, pass -ClientId |
Common Mistakes to Avoid
- Installing as Administrator into the wrong PowerShell. Installing from 5.1 puts the module in the WindowsPowerShell folder, where we found three old copies.
- Following 2019-era answers. SharePointPnPPowerShellOnline is retired; install PnP.PowerShell instead.
- Using -Credentials with MFA. Use -Interactive or -DeviceLogin with your client ID.
Does Connect-PnPOnline Work in the PowerShell ISE?
No. The ISE only hosts Windows PowerShell 5.1, so it shows the same error. Use Visual Studio Code with the PowerShell extension and switch the session to PowerShell 7.
Next Steps
Now that you’re connected, try a read-only script first, like the one we use to get all lists and libraries from a SharePoint site.
We use PnP PowerShell daily; these guides are good next reads:
Frequently Asked Questions
Why is Connect-PnPOnline not recognized after I installed PnP.PowerShell?
You’re most likely in Windows PowerShell 5.1, which hides the module. The PnP PowerShell installation guide says you need PowerShell 7.4.0 or later.
How do I fix “The term ‘Connect-PnPOnline’ is not recognized as the name of a cmdlet”?
Open PowerShell 7.4 or later, run Install-Module PnP.PowerShell -Scope CurrentUser, then run Import-Module PnP.PowerShell to confirm it loads.
Should I install SharePointPnPPowerShellOnline instead?
No. That’s the retired module for Windows PowerShell. Install PnP.PowerShell and remove the old module.
Why does Connect-PnPOnline ask for a client ID?
Since September 9, 2024, you must register your own Entra ID app, as the PnP app registration guide explains, and pass its ID with -ClientId.

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.