Not able to install SharePoint PNP module

sns 9,246 Reputation points
2022-12-15T15:45:28.547+00:00

Hi ,

I am seeing following attached errors while installing PNP module sharepoint online. Please suggest.

271113-screenshot1.png271142-screenshot2.png271049-screenshot3.png

Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

Accepted answer
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2022-12-16T08:17:18.287+00:00

    Hi @sns ,
    If you want to Install the PnP PowerShell Module for SharePoint Online, please refer to this link: https://www.sharepointdiary.com/2021/02/how-to-install-pnp-powershell-module-for-sharepoint-online.html
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

    Install the PnP PowerShell Module code: Install-Module PnP.PowerShell
    Install the SharePoint Online Management Shell code: Install-Module -Name Microsoft.Online.SharePoint.PowerShell
    Reference: https://learn.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online


    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 additional answers

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2022-12-20T08:07:54.89+00:00

    Hi @sns ,
    What version of Powershell are you using? You need to be on PS version 7.0 or above so that it is using the cross platform version of the powershell core.
    We need to narrow down the problem and try some things.
    1.Run powershell as an administrator to try the code again.
    272344-image.png
    2.To enable the TLS1.2 (which is the latest version while writing this article) in PS scripts, you need to add the below line at the very start

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12  
    

    3.Try to install PowerShellGet first

    Install-Module -Name PowerShellGet -Force  
    

    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. Sebastian Cerazy 321 Reputation points
    2025-02-04T16:15:04.0366667+00:00
    PS C:\Users\me> Install-Module PnP.PowerShell -Scope AllUsers -Repository PSGallery
    
    WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
    
    Install-Package: No match was found for the specified search criteria and module name 'PnP.PowerShell'. Try Get-PSRepository to see all
    
    available registered module repositories.
    
    
    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.