Forum Discussion
Cannot install PnP.Powershell
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 Trusted
Verify it's updated:
Get-PSRepository
Try installing the module again:
Install-Module -Name PnP.PowerShell
Also 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
The command will not execute:
- Timo-HHJun 13, 2025Copper 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).