Forum Discussion
Cannot install PnP.Powershell
Something has changed recently I can no longer execute scripts that I had. So I decided to re-install various bits and pieces.
When I come to install PnP.Powershell I get an error:
'WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
4 Replies
- jimvhCopper Contributor
Hi akkers,
The old API v2 URL is deprecated. Microsoft moved to https://www.powershellgallery.com/api/v3.
You could try the following:
Unregister the old PSGallery:
Unregister-PSRepository -Name "PSGallery"Register the new one (v3):
Register-PSRepository -Name "PSGallery" `
-SourceLocation "https://www.powershellgallery.com/api/v3" `
-InstallationPolicy TrustedVerify it's updated:
Get-PSRepositoryTry installing the module again:
Install-Module -Name PnP.PowerShellAlso check the TLS. (Some systems may not default to TLS 1.2, which is required)
Run below code before installing the module.
This will only affect your current Powershell session, so it wont change it permanently.[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- jimvhCopper Contributor
Hi akkers,
The old API v2 URL is deprecated. Microsoft moved to https://www.powershellgallery.com/api/v3.
You could try the following:
Unregister the old PSGallery:
Unregister-PSRepository -Name "PSGallery"Register the new one (v3):
Register-PSRepository -Name "PSGallery" `
-SourceLocation "https://www.powershellgallery.com/api/v3" `
-InstallationPolicy TrustedVerify it's updated:
Get-PSRepositoryTry installing the module again:
Install-Module -Name PnP.PowerShellAlso check the TLS. (Some systems may not default to TLS 1.2, which is required)
Run below code before installing the module.
This will only affect your current Powershell session, so it wont change it permanently.[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- akkersCopper Contributor
The command will not execute:
- Timo-HHCopper Contributor
Did you find a solution? I seem to have the same issue.
Interestingly, it works when I connect my laptop to a hotspot on my phone, rather than to my FTTH connection. So it seems to be network related (at least, in my case).