Connect-PnPOnline : The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet. Cant get around this

Dave Dave 0 Reputation points
2024-10-14T03:10:46.93+00:00

Hi All

i have been going over this for the last few days but i cant get PnP.PowerShell to work on my SharePoint site.

BTW: i am the owner and administrator of the SP site.

I can install PnP.PowerShell (as an administrator) but when i

Connect-PnPOnline -Url https://xxx-admin.sharepoint.com -Interactive

i get the following response

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. At line:1 char:1

  • Connect-PnPOnline -Url https://xxx-admin.sharepoint.com -Interact ...
  •     + CategoryInfo          : ObjectNotFound: (Connect-PnPOnline:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    

I can see that PnP.PowerShell is installed in my directory

C:\Program Files\WindowsPowerShell\Modules

When i Get-Module i cannot see the module as my path is pointing to Windows\system32

PS C:\program Files> get-module -ListAvailable pnp Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules ModuleType Version Name ExportedCommands


Manifest 1.0.0.0 PnpDevice {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, Disable-PnpDevice}

Is this a path issue?

Is it a credential issue?

Please help as i am loosing hair and sleep over this.

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,987 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,528 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Xyza Xue_MSFT 24,801 Reputation points Microsoft Vendor
    2024-10-14T08:08:49.73+00:00

    Hi @Dave Dave ,

    As of September 9th, 2024 the option to use the PnP Management Shell app registration for authentication is not available anymore. Refer to https://pnp.github.io/powershell/articles/registerapplication.html on how to register your own application.

    You need to register our own Entra ID Application to use with PnP PowerShell instead.

    Connect-PnPOnline -Url $AdminCenterURL -ClientId $ClientID -ClientSecret $ClientSecret
    

    Here are my test results:

    User's image

    Note: The new PnP PowerShell module requires at least PowerShell 7.x.

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Dave Dave 0 Reputation points
    2024-10-14T12:09:33.23+00:00

    Thanks for getting back to me.

    I did read the linked page you sent me before and I had attempted to register with IntraID using both the methods described.

    My problem is my power shell doesn't recognize any PnP.PowerShell cmdlets, see below

    PS C:\WINDOWS\system32> Connect-PnPOnline -Url $MyURL -ClientId $ClientID 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. At line:1 char:1

    • Connect-PnPOnline -Url $MyURL -ClientId $ClientID
    •     + CategoryInfo          : ObjectNotFound: (Connect-PnPOnline:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
      
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.