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.

Microsoft 365 and Office | SharePoint | Development
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,181 Reputation points Microsoft External Staff
    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. Dave Dave 0 Reputation points
    2024-10-14T08:59:07.2+00:00

    Hi @Xyza Xue_MSFT

    I had already tried to create my EntraID via that link. I tried the the intial version (1) then i went on created my my own manually (2).

    This is what i get, PnP cmdlets are not reconised.

    PS C:\WINDOWS\system32> Register-PnPEntraIDAppForInteractiveLogin -ApplicationName "PnP Rocks" -Tenant $WMS -Interactive Register-PnPEntraIDAppForInteractiveLogin : The term 'Register-PnPEntraIDAppForInteractiveLogin' 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

    • Register-PnPEntraIDAppForInteractiveLogin -ApplicationName "PnP Rocks ...
    •     + CategoryInfo          : ObjectNotFound: (Register-PnPEnt...nteractiveLogin:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
      

    PnP.PowerShell for some reason is not working


  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
      

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.