SOLVED

WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/.....' is not valid

Copper Contributor

Hello,

 

I was trying install the PowerShell Module to a server and getting error message with not valid url.

 

Debug log attached.

 

PS C:\windows\system32> Install-Module SharePointPnPPowerShellOnline -Force -Debug
DEBUG: 00:00:00.0000002 Calling New() : MethodName = 'GetDynamicOptions'

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a
DEBUG: 00:00:00.0000300 Force: True
DEBUG: 00:00:00.0000445 Debug: True
DEBUG: 00:00:00.0000573 Name: SharePointPnPPowerShellOnline
DEBUG: 00:00:00.0011177 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0019006 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0039875 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0100688 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0100914 Force: True
DEBUG: 00:00:00.0101568 Debug: True
DEBUG: 00:00:00.0101735 Name: SharePointPnPPowerShellOnline
DEBUG: 00:00:00.0109507 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0115616 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0144311 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0181073 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0181315 Force: True
DEBUG: 00:00:00.0181464 Debug: True
DEBUG: 00:00:00.0181607 Name: SharePointPnPPowerShellOnline
DEBUG: 00:00:00.0188111 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
DEBUG: 00:00:00.0194829 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0243662 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0276450 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0276668 Force: True
DEBUG: 00:00:00.0276801 Debug: True
DEBUG: 00:00:00.0276931 Name: SharePointPnPPowerShellOnline
DEBUG: 00:00:00.0284428 INVOKING PowerShell Fn Get-DynamicOptions with args Install that has length 1
DEBUG: 00:00:00.0290814 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0338093 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:02.4736146 Calling SearchForPackages. Name='SharePointPnPPowerShellOnline'
VERBOSE: Using the provider 'PowerShellGet' for searching packages.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a
DEBUG: 00:00:02.4747220 PackageProvider::FindPackage with name SharePointPnPPowerShellOnline
DEBUG: 00:00:02.4749508 Calling SearchForPackages After Select 1
DEBUG: 00:00:07.4799484 Calling New() : MethodName = 'FindPackage'
DEBUG: 00:00:07.4800187 ProviderName: PowerShellGet
DEBUG: 00:00:07.4800527 Type: Module
DEBUG: 00:00:07.4800683 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:07.4801181 Force: True
DEBUG: 00:00:07.4801320 Debug: True
DEBUG: 00:00:07.4801456 Scope: AllUsers
DEBUG: 00:00:07.4801619 Name: SharePointPnPPowerShellOnline
DEBUG: 00:00:07.4810098 INVOKING PowerShell Fn Find-Package with args System.String[], , , that has length 4
DEBUG: 00:00:07.4832297 In PowerShellGet Provider - 'Find-Package'.
DEBUG: 00:00:07.4839335 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:07.4841374 OPTION: Type => Module
DEBUG: 00:00:07.4843299 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:07.4848048 OPTION: Force => True
DEBUG: 00:00:07.4849908 OPTION: Debug => True
DEBUG: 00:00:07.4851678 OPTION: Scope => AllUsers
DEBUG: 00:00:07.4853432 OPTION: Name => SharePointPnPPowerShellOnline
VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
DEBUG: 00:00:07.4907353 PackageProvider::FindPackage with name SharePointPnPPowerShellOnline
DEBUG: 00:00:07.4932458 Calling 'NuGet'::'FindPackage' - name='SharePointPnPPowerShellOnline',
requiredVersion='',minimumVersion='', maximumVersion='''.
DEBUG: 00:00:07.4932826 Iterating 'SharePointPnPPowerShellOnline'.
DEBUG: 00:00:07.4935582 There are '0' registered sources in 'NuGet' provider.
DEBUG: 00:00:07.4936600 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in
'NuGet' provider.
DEBUG: 00:00:09.6490403 Source 'https://www.powershellgallery.com/api/v2' is validated.
DEBUG: 00:00:09.6491100 Calling 'NuGetRequest'::'GetPackageById', 'SharePointPnPPowerShellOnline'.
DEBUG: 00:00:10.9249696 Calling 'HttpClientPackageRepository'::'FindPackagesById', 'SharePointPnPPowerShellOnline'.
DEBUG: 00:00:10.9250551 Calling 'NuGetClient'::'FindPackage'.
VERBOSE: Searching repository
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'' for ''.
DEBUG: 00:00:10.9253313 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:12.6410092 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:12.6506047 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:12.6506065 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:12.6506379 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:12.6508283 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:13.9261883 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:13.9265741 '0' packages received in the last request.
DEBUG: 00:00:14.6035386 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:14.6036603 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:14.6038273 '0' packages received in the last request.
DEBUG: 00:00:14.6039490 '0' packages received in the last request.
DEBUG: 00:00:15.6130985 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:15.6178721 '30' packages received in the last request.
VERBOSE: Total package yield:'1' for the specified package 'SharePointPnPPowerShellOnline'.
DEBUG: 00:00:15.6207643 Completed iterating for 'SharePointPnPPowerShellOnline'.
DEBUG: 00:00:15.6470655 Done calling powershell «Find-Package» «PSModule»
DEBUG: 00:00:15.6537227 Calling New() : MethodName = 'GetInstalledPackages'
DEBUG: 00:00:15.6537527 ProviderName: PowerShellGet
DEBUG: 00:00:15.6537681 Type: Module
DEBUG: 00:00:15.6537823 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:15.6537965 Force: True
DEBUG: 00:00:15.6538090 Debug: True
DEBUG: 00:00:15.6538215 Scope: AllUsers
DEBUG: 00:00:15.6538346 Name: SharePointPnPPowerShellOnline
DEBUG: 00:00:15.6543655 INVOKING PowerShell Fn Get-InstalledPackage with args SharePointPnPPowerShellOnline,
3.19.2003.0, , that has length 4
DEBUG: 00:00:15.6550981 In PowerShellGet Provider - 'Get-InstalledPackage'.
DEBUG: 00:00:15.6553113 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:15.6554848 OPTION: Type => Module
DEBUG: 00:00:15.6556921 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:15.6558915 OPTION: Force => True
DEBUG: 00:00:15.6560733 OPTION: Debug => True
DEBUG: 00:00:15.6562478 OPTION: Scope => AllUsers
DEBUG: 00:00:15.6564270 OPTION: Name => SharePointPnPPowerShellOnline
DEBUG: 00:00:17.6364439 PowerShell Script 'PSModule' Function 'Get-InstalledPackage' returns null.
DEBUG: 00:00:17.6372045 Done calling powershell «Get-InstalledPackage» «PSModule»

Confirm
Are you sure you want to perform this action?
Performing the operation "Install Package" on target "Package 'SharePointPnPPowerShellOnline' version '3.19.2003.0'
from 'PSGallery'.".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): a
DEBUG: 00:00:42.9836594 Calling New() : MethodName = 'InstallPackage'
DEBUG: 00:00:42.9836941 ProviderName: PowerShellGet
DEBUG: 00:00:42.9837229 Type: Module
DEBUG: 00:00:42.9837425 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:42.9837575 Force: True
DEBUG: 00:00:42.9837714 Debug: True
DEBUG: 00:00:42.9837853 Scope: AllUsers
DEBUG: 00:00:42.9837996 Name: SharePointPnPPowerShellOnline
DEBUG: 00:00:42.9845292 INVOKING PowerShell Fn Install-Package with args
NuGet|SharePointPnPPowerShellOnline|3.19.2003.0|https://www.powershellgallery.com/api/v2|Module that has length 1
DEBUG: 00:00:42.9862372 In PowerShellGet Provider - 'Install-Package'.
DEBUG: 00:00:42.9869454 In PowerShellGet Provider - 'Install-PackageUtility'.
DEBUG: 00:00:42.9871604 The FastPackageReference is
'NuGet|SharePointPnPPowerShellOnline|3.19.2003.0|https://www.powershellgallery.com/api/v2|Module'.
DEBUG: 00:00:42.9875296 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:42.9878200 OPTION: Type => Module
DEBUG: 00:00:42.9880217 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:42.9882389 OPTION: Force => True
DEBUG: 00:00:42.9884634 OPTION: Debug => True
DEBUG: 00:00:42.9887816 OPTION: Scope => AllUsers
DEBUG: 00:00:42.9889883 OPTION: Name => SharePointPnPPowerShellOnline
VERBOSE: The installation scope is specified to be 'AllUsers'.
VERBOSE: The specified module will be installed in 'C:\Program Files\WindowsPowerShell\Modules'.
DEBUG: 00:00:42.9903760 ArtfactType is Module
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'SharePointPnPPowerShellOnline' with version '3.19.2003.0' from the repository
'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:44.6681094 Calling 'NuGet'::'InstallPackage',
'$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\U2hhcmVQb2ludFBuUFBvd2VyU2hlbGxPbmxpbmU=\My4xOS4yMDAzLjA=\aH
R0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='.
DEBUG: 00:00:44.6683081 Calling 'NuGetRequest'::'GetPackageByFastpath',
'$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\U2hhcmVQb2ludFBuUFBvd2VyU2hlbGxPbmxpbmU=\My4xOS4yMDAzLjA=\aH
R0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='.
DEBUG: 00:00:44.6684489 Calling 'NuGetRequest'::'ResolvePackageSource', 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:44.6684779 Calling 'NuGetRequest'::'FindRegisteredSource', 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:44.6685047 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in
'NuGet' provider.
DEBUG: 00:00:48.8501172 Calling 'HttpClientPackageRepository'::'FindPackage', 'SharePointPnPPowerShellOnline'.
DEBUG: 00:00:48.8501805 Calling 'NuGetClient'::'FindPackage'.
VERBOSE: Searching repository
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'' for ''.
DEBUG: 00:00:48.8502893 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:52.1960762 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:52.2099144 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:52.2100909 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:52.2100942 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:52.2101002 Downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:53.6597300 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:53.6599788 '0' packages received in the last request.
DEBUG: 00:00:54.1614418 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:54.1614464 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:54.1616464 '0' packages received in the last request.
DEBUG: 00:00:54.1618585 '0' packages received in the last request.
DEBUG: 00:00:55.6163522 Completed downloading
'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='SharePointPnPPowerShellOnline'&$skip...'.
DEBUG: 00:00:55.6251832 '30' packages received in the last request.
DEBUG: 00:00:55.6271792 'Package version' is '3.19.2003.0'.
DEBUG: 00:00:55.6272337 'Request's Destination' is 'C:\Users\kvanoop\AppData\Local\Temp\398316225'.
DEBUG: 00:00:55.6272632 Calling 'NuGetClient'::'GetPackageDependencies'.
DEBUG: 00:00:55.6273996 Returning the call 'NuGetClient'::'GetPackageDependencies'.
DEBUG: 00:00:55.6275763 Calling 'NuGetClient'::'InstallPackage'.
VERBOSE: InstallPackage' - name='SharePointPnPPowerShellOnline',
version='3.19.2003.0',destination='C:\Users\kvanoop\AppData\Local\Temp\398316225'
VERBOSE: DownloadPackage' - name='SharePointPnPPowerShellOnline',
version='3.19.2003.0',destination='C:\Users\kvanoop\AppData\Local\Temp\398316225\SharePointPnPPowerShellOnline\SharePoi
ntPnPPowerShellOnline.nupkg',
uri='https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003'.
VERBOSE: An error occurred while sending the request.
DEBUG: 00:00:57.0212206 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PackageManagement.NuGetProvider.NuGetClient.<DownloadDataToFileAsync>d__15.MoveNext()
VERBOSE: Retry downloading 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003'
for '2' more times
VERBOSE: An error occurred while sending the request.
DEBUG: 00:00:57.8874097 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PackageManagement.NuGetProvider.NuGetClient.<DownloadDataToFileAsync>d__15.MoveNext()
VERBOSE: Retry downloading 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003'
for '1' more times
VERBOSE: An error occurred while sending the request.
DEBUG: 00:00:58.7402606 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PackageManagement.NuGetProvider.NuGetClient.<DownloadDataToFileAsync>d__15.MoveNext()
VERBOSE: Retry downloading 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003'
for '0' more times
VERBOSE: Downloading package 'SharePointPnPPowerShellOnline' failed, please make sure
'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003' is accessable.
WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/SharePointPnPPowerShellOnline/3.19.2003' is
not valid.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a
PS C:\windows\system32>

13 Replies
best response confirmed by Anoop Kv (Copper Contributor)
Solution

@Anoop Kv, using TLS 1.2 fixed the issue for me. please reference this:

 

https://community.spiceworks.com/topic/2265662-powershell-get-download-problem

 

Also worked for me, had to just run the 1 liner in that very long and detailed answer!

Didn't work for me, I needed to add repo to nuget pm...

 

This fixed it:

Register-PackageSource -Name PSNuGet -Location https://www.powershellgallery.com/api/v2 -ProviderName NuGet

 

@Anoop Kv 

TLS 1.2 fixed the issue for me. please find reference site

 

To Fix TLS issue: run below command...

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

 

https://www.powershellcenter.com/2020/08/27/powershell-fix-warning-unable-to-resolve-package-source-...

 

thanks, this works for me.

 

Register-PackageSource -Name PSNuGet -Location "https://www.powershellgallery.com/api/v2" -ProviderName NuGet

@shoyheim Thanks. it worked for me..have been searching for a solution more than 2 days.Finally found it.

1 best response

Accepted Solutions
best response confirmed by Anoop Kv (Copper Contributor)