PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
484 stars 92 forks source link

Can't install #624

Open MeikelLP opened 2 years ago

MeikelLP commented 2 years ago

Prerequisites

Steps to reproduce

# non-elevated
Install-Module -Name PowerShellGet -RequiredVersion 3.0.11-beta -AllowPrerelease -Force -Scope CurrentUser

or

# elevated
Install-Module -Name PowerShellGet -RequiredVersion 3.0.11-beta -AllowPrerelease -Force

Expected behavior

# installed

Actual behavior

Install-Package: Administrator rights are required to install or update. Log on to the computer with an account that has Administrator
rights, and then try again, or install by adding "-Scope CurrentUser" to your command. You can also try running the
Windows PowerShell session with elevated rights (Run as Administrator).

Error details

Exception             :
    Type    : System.Exception
    Message : Administrator rights are required to install or update. Log on to the computer with an account that has
Administrator rights, and then try again, or install by adding "-Scope CurrentUser" to your command. You can also try
running the Windows PowerShell session with elevated rights (Run as Administrator).
    HResult : -2146233088
TargetObject          : System.Collections.ArrayList
CategoryInfo          : InvalidArgument: (System.Collections.ArrayList:String) [Install-Package], Exception
FullyQualifiedErrorId : AdministratorRightsNeededOrSpecifyCurrentUserScope,Copy-Module,Microsoft.PowerShell.Package
Management.Cmdlets.InstallPackage
InvocationInfo        :
    MyCommand        : Install-Package
    ScriptLineNumber : 9711
    OffsetInLine     : 34
    HistoryId        : 2
    ScriptName       : C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1
    Line             : $installedPackages = PackageManagement\Install-Package @PSBoundParameters

    PositionMessage  : At C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:9711 char:34
                       + … talledPackages = PackageManagement\Install-Package @PSBoundParameters
                       +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PSScriptRoot     : C:\program files\powershell\7\Modules\PowerShellGet
    PSCommandPath    : C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1
    InvocationName   : PackageManagement\Install-Package
    CommandOrigin    : Internal
ScriptStackTrace      : at Install-Module<Process>, C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:
line 9711
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.2.5                 PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Fin…

Key   : PSVersion
Value : 7.2.2
Name  : PSVersion

Key   : PSEdition
Value : Core
Name  : PSEdition

Key   : GitCommitId
Value : 7.2.2
Name  : GitCommitId

Key   : OS
Value : Microsoft Windows 10.0.19044
Name  : OS

Key   : Platform
Value : Win32NT
Name  : Platform

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

SydneyhSmith commented 2 years ago

@MeikelLP thanks for opening this issue, apologies for the delayed response-- we are having trouble reproducing this, could you please run this with the -debug and -verbose logs on? Thanks!

MeikelLP commented 2 years ago

Elevated

DEBUG: 00:00:00 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0000163 Force: True
DEBUG: 00:00:00.0000222 Name: PowerShellGet
DEBUG: 00:00:00.0000277 Debug: True
DEBUG: 00:00:00.0000328 RequiredVersion: 3.0.11-beta
DEBUG: 00:00:00.0000420 Verbose: True
DEBUG: 00:00:00.0005337 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0009114 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0015213 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0031675 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0031817 Force: True
DEBUG: 00:00:00.0031879 Name: PowerShellGet
DEBUG: 00:00:00.0032153 Debug: True
DEBUG: 00:00:00.0032207 RequiredVersion: 3.0.11-beta
DEBUG: 00:00:00.0032301 Verbose: True
DEBUG: 00:00:00.0047337 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0050601 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0058521 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0076775 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0076919 Force: True
DEBUG: 00:00:00.0076980 Name: PowerShellGet
DEBUG: 00:00:00.0077030 Debug: True
DEBUG: 00:00:00.0077083 RequiredVersion: 3.0.11-beta
DEBUG: 00:00:00.0077179 Verbose: True
DEBUG: 00:00:00.0080915 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
DEBUG: 00:00:00.0084654 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0115617 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0129649 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0129772 Force: True
DEBUG: 00:00:00.0129831 Name: PowerShellGet
DEBUG: 00:00:00.0129881 Debug: True
DEBUG: 00:00:00.0129934 RequiredVersion: 3.0.11-beta
DEBUG: 00:00:00.0130025 Verbose: True
DEBUG: 00:00:00.0132786 INVOKING PowerShell Fn Get-DynamicOptions with args Install that has length 1
DEBUG: 00:00:00.0135674 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0150580 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0217260 Calling SearchForPackages. Name='PowerShellGet'
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
DEBUG: 00:00:00.0222031 PackageProvider::FindPackage with name PowerShellGet
DEBUG: 00:00:00.0228178 Calling SearchForPackages After Select 1
DEBUG: 00:00:00.0238794 Calling New() : MethodName = 'FindPackage'
DEBUG: 00:00:00.0240660 ProviderName: PowerShellGet
DEBUG: 00:00:00.0243206 AllowPrereleaseVersions: True
DEBUG: 00:00:00.0245990 Type: Module
DEBUG: 00:00:00.0248389 RequiredVersion: 3.0.11-beta
DEBUG: 00:00:00.0251129 Debug: True
DEBUG: 00:00:00.0253793 Name: PowerShellGet
DEBUG: 00:00:00.0256405 Verbose: True
DEBUG: 00:00:00.0259367 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.0262091 Force: True
DEBUG: 00:00:00.0264497 Scope: CurrentUser
DEBUG: 00:00:00.0269266 INVOKING PowerShell Fn Find-Package with args System.String[], 3.0.11-beta, ,  that has length 4
DEBUG: 00:00:00.0274912 In PowerShellGet Provider - 'Find-Package'.
DEBUG: 00:00:00.0277506 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:00.0279377 OPTION: AllowPrereleaseVersions => True
DEBUG: 00:00:00.0282078 OPTION: Type => Module
DEBUG: 00:00:00.0284390 OPTION: RequiredVersion => 3.0.11-beta
DEBUG: 00:00:00.0286777 OPTION: Debug => True
DEBUG: 00:00:00.0288945 OPTION: Name => PowerShellGet
DEBUG: 00:00:00.0291504 OPTION: Verbose => True
DEBUG: 00:00:00.0294148 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.0297158 OPTION: Force => True
DEBUG: 00:00:00.0299807 OPTION: Scope => CurrentUser
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:00.0322667 PackageProvider::FindPackage with name PowerShellGet
DEBUG: 00:00:00.0337675 Calling 'NuGet'::'FindPackage' - name='PowerShellGet', requiredVersion='3.0.11-beta',minimumVersion='', maximumVersion='''.
DEBUG: 00:00:00.0352072 Iterating 'PowerShellGet'.
DEBUG: 00:00:00.0359344 There are '1' registered sources in 'NuGet' provider.
DEBUG: 00:00:00.0362595 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in 'NuGet' provider.
DEBUG: 00:00:00.9250655 Downloading 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:01.0313228 Completed downloading 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:01.0326373 Source 'https://www.powershellgallery.com/api/v2' is validated.
DEBUG: 00:00:01.0330480 Calling 'NuGetRequest'::'GetPackageById', 'PowerShellGet'.
DEBUG: 00:00:01.0344635 Calling 'NuGetPackageRepository'::'FindPackagesById', 'PowerShellGet'.
DEBUG: 00:00:01.0351189 Calling 'NuGetPackageFeed2'::'FindPackage', 'PowerShellGet'.
DEBUG: 00:00:01.0355923 Calling 'NuGetClient'::'FindPackage'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'' for ''.
DEBUG: 00:00:01.0401305 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=0&$top=40'.
DEBUG: 00:00:01.4708313 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=0&$top=40'.
DEBUG: 00:00:01.4868858 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
DEBUG: 00:00:01.4869363 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=40&$top=40'.
DEBUG: 00:00:01.4870069 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=120&$top=40'.
DEBUG: 00:00:01.4870927 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=160&$top=40'.
DEBUG: 00:00:01.6077055 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=40&$top=40'.
DEBUG: 00:00:01.6101730 '29' packages received in the last request.
DEBUG: 00:00:01.6118944 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=0&$top=40'.
DEBUG: 00:00:01.7689683 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
DEBUG: 00:00:01.9001997 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=160&$top=40'.
DEBUG: 00:00:01.9887056 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=120&$top=40'.
DEBUG: 00:00:02.1924583 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=0&$top=40'.
DEBUG: 00:00:02.2003633 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=40&$top=40'.
DEBUG: 00:00:02.2003985 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=160&$top=40'.
DEBUG: 00:00:02.2004664 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=120&$top=40'.
DEBUG: 00:00:02.2004907 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
DEBUG: 00:00:02.3136888 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
DEBUG: 00:00:02.3144834 '0' packages received in the last request.
DEBUG: 00:00:02.3803990 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=40&$top=40'.
DEBUG: 00:00:02.3825899 '29' packages received in the last request.
DEBUG: 00:00:02.3900694 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=120&$top=40'.
DEBUG: 00:00:02.3904630 '0' packages received in the last request.
DEBUG: 00:00:02.4442571 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=160&$top=40'.
DEBUG: 00:00:02.4449726 '0' packages received in the last request.
VERBOSE: Total package yield:'1' for the specified package 'PowerShellGet'.
DEBUG: 00:00:02.4463336 Completed iterating for 'PowerShellGet'.
DEBUG: 00:00:02.5206411 Done calling powershell «Find-Package» «PSModule»
DEBUG: 00:00:02.5294194 Calling New() : MethodName = 'GetInstalledPackages'
DEBUG: 00:00:02.5297222 ProviderName: PowerShellGet
DEBUG: 00:00:02.5303609 AllowPrereleaseVersions: True
DEBUG: 00:00:02.5307032 Type: Module
DEBUG: 00:00:02.5315906 RequiredVersion: 3.0.11-beta
DEBUG: 00:00:02.5320831 Debug: True
DEBUG: 00:00:02.5323276 Name: PowerShellGet
DEBUG: 00:00:02.5325826 Verbose: True
DEBUG: 00:00:02.5328687 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.5331258 Force: True
DEBUG: 00:00:02.5333665 Scope: CurrentUser
DEBUG: 00:00:02.5340375 INVOKING PowerShell Fn Get-InstalledPackage with args PowerShellGet, 3.0.11-beta, ,  that has length 4
DEBUG: 00:00:02.5359946 In PowerShellGet Provider - 'Get-InstalledPackage'.
DEBUG: 00:00:02.5362671 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:02.5366361 OPTION: AllowPrereleaseVersions => True
DEBUG: 00:00:02.5369391 OPTION: Type => Module
DEBUG: 00:00:02.5373155 OPTION: RequiredVersion => 3.0.11-beta
DEBUG: 00:00:02.5388103 OPTION: Debug => True
DEBUG: 00:00:02.5390610 OPTION: Name => PowerShellGet
DEBUG: 00:00:02.5395671 OPTION: Verbose => True
DEBUG: 00:00:02.5399374 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.5403595 OPTION: Force => True
DEBUG: 00:00:02.5405573 OPTION: Scope => CurrentUser
DEBUG: 00:00:02.6665903 PowerShell Script 'PSModule' Function 'Get-InstalledPackage' returns null.
DEBUG: 00:00:02.6674870 Done calling powershell «Get-InstalledPackage» «PSModule»

Confirm
Are you sure you want to perform this action?
Performing the operation "Install-Module" on target "Version '3.0.11-beta' of module 'PowerShellGet'".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): A
DEBUG: 00:00:10.7812125 Calling New() : MethodName = 'InstallPackage'
DEBUG: 00:00:10.7814790 ProviderName: PowerShellGet
DEBUG: 00:00:10.7818652 AllowPrereleaseVersions: True
DEBUG: 00:00:10.7820932 Type: Module
DEBUG: 00:00:10.7823501 RequiredVersion: 3.0.11-beta
DEBUG: 00:00:10.7826696 Debug: True
DEBUG: 00:00:10.7828324 Name: PowerShellGet
DEBUG: 00:00:10.7830558 Verbose: True
DEBUG: 00:00:10.7833382 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:10.7836134 Force: True
DEBUG: 00:00:10.7838652 Scope: CurrentUser
DEBUG: 00:00:10.7843569 INVOKING PowerShell Fn Install-Package with args NuGet|PowerShellGet|3.0.11-beta|https://www.powershellgallery.com/api/v2|Module that has length 1
DEBUG: 00:00:10.7851850 In PowerShellGet Provider - 'Install-Package'.
DEBUG: 00:00:10.7995030 In PowerShellGet Provider - 'Install-PackageUtility'.
DEBUG: 00:00:10.8003572 The FastPackageReference is 'NuGet|PowerShellGet|3.0.11-beta|https://www.powershellgallery.com/api/v2|Module'.
DEBUG: 00:00:10.8039942 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:10.8042214 OPTION: AllowPrereleaseVersions => True
DEBUG: 00:00:10.8046642 OPTION: Type => Module
DEBUG: 00:00:10.8050119 OPTION: RequiredVersion => 3.0.11-beta
DEBUG: 00:00:10.8053597 OPTION: Debug => True
DEBUG: 00:00:10.8055875 OPTION: Name => PowerShellGet
DEBUG: 00:00:10.8058294 OPTION: Verbose => True
DEBUG: 00:00:10.8062066 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:10.8066818 OPTION: Force => True
DEBUG: 00:00:10.8070025 OPTION: Scope => CurrentUser
VERBOSE: The installation scope is specified to be 'CurrentUser'.
VERBOSE: The specified module will be installed in 'C:\Users\m.philipp\Documents\PowerShell\Modules'.
DEBUG: 00:00:10.8183693 ArtifactType is Module
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'PowerShellGet' with version '3.0.11-beta' from the repository 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:11.0329415 Calling 'NuGet'::'InstallPackage', '$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\UG93ZXJTaGVsbEdldA==\My4wLjExLWJldGE=\aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='.
DEBUG: 00:00:11.0332576 Calling 'NuGetRequest'::'GetPackageByFastpath', '$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\UG93ZXJTaGVsbEdldA==\My4wLjExLWJldGE=\aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='.
DEBUG: 00:00:11.0346704 Calling 'NuGetRequest'::'ResolvePackageSource', 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:11.0349246 Calling 'NuGetRequest'::'FindRegisteredSource', 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:11.0351668 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in 'NuGet' provider.
DEBUG: 00:00:11.5814134 Calling 'NuGetPackageRepository'::'FindPackage', 'PowerShellGet'.
DEBUG: 00:00:11.5819882 Calling 'NuGetPackageFeed2'::'FindPackage', 'PowerShellGet'.
DEBUG: 00:00:11.5828139 Calling 'NuGetClient'::'FindPackage'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'' for ''.
DEBUG: 00:00:11.5836954 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=0&$top=40'.
DEBUG: 00:00:12.3104787 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=0&$top=40'.
DEBUG: 00:00:12.3141398 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
DEBUG: 00:00:12.3141749 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=120&$top=40'.
DEBUG: 00:00:12.3142147 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=40&$top=40'.
DEBUG: 00:00:12.3142503 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=160&$top=40'.
DEBUG: 00:00:12.8032321 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=40&$top=40'.
DEBUG: 00:00:12.8050318 '29' packages received in the last request.
DEBUG: 00:00:12.8059146 'Package version' is '3.0.11-beta'.
DEBUG: 00:00:12.8066327 'Request's Destination' is 'C:\Users\m.philipp\AppData\Local\Temp\1469127073'.
DEBUG: 00:00:12.8071522 Calling 'NuGetPackageRepository'::'InstallPackage'.
DEBUG: 00:00:12.8077232 Calling 'NuGetFilesFeed2'::'InstallPackage'.
DEBUG: 00:00:12.8080394 Calling 'NuGetFilesFeed2'::'InstallPackage', '$aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\UG93ZXJTaGVsbEdldA==\My4wLjExLWJldGE=\aHR0cHM6Ly93d3cucG93ZXJzaGVsbGdhbGxlcnkuY29tL2FwaS92Mg==\cG93ZXJzaGVsbGdldA=='.
DEBUG: 00:00:12.8098439 Calling 'NuGetClient'::'GetPackageDependencies'.
DEBUG: 00:00:12.8121025 Returning the call 'NuGetClient'::'GetPackageDependencies'.
DEBUG: 00:00:12.8148807 Calling 'NuGetClient'::'InstallPackage'.
VERBOSE: InstallPackage' - name='PowerShellGet', version='3.0.11-beta',destination='C:\Users\m.philipp\AppData\Local\Temp\1469127073'
DEBUG: 00:00:12.8218753 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=80&$top=40'.
VERBOSE: DownloadPackage' - name='PowerShellGet', version='3.0.11-beta',destination='C:\Users\m.philipp\AppData\Local\Temp\1469127073\PowerShellGet.3.0.11-beta\PowerShellGet.3.0.11-beta.nupkg', uri='https://www.powershellgallery.com/api/v2/package/PowerShellGet/3.0.11-beta'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PowerShellGet/3.0.11-beta'.
DEBUG: 00:00:12.9024149 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=120&$top=40'.
DEBUG: 00:00:13.3112626 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'&$skip=160&$top=40'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PowerShellGet/3.0.11-beta'.
VERBOSE: Completed downloading 'PowerShellGet'.
DEBUG: 00:00:13.7741196 Calling 'NuGetClient'::'InstallPackageLocal'.
VERBOSE: InstallPackageLocal' - name='PowerShellGet', version='3.0.11-beta',destination='C:\Users\m.philipp\AppData\Local\Temp\1469127073'
DEBUG: 00:00:13.7759625 C:\Users\m.philipp\AppData\Local\Temp\1469127073\PowerShellGet.3.0.11-beta\PowerShellGet.3.0.11-beta.nupkg
DEBUG: 00:00:14.0301727 Returning the call 'NuGetClient'::'InstallPackageLocal'.
DEBUG: 00:00:14.0496135 Returning the call 'NuGetClient'::'InstallSinglePackage'.
DEBUG: 00:00:14.0501543 Returning the call 'NuGetFilesFeed2'::'InstallPackage'.
VERBOSE: Validating the 'PowerShellGet' module contents under 'C:\Users\m.philipp\AppData\Local\Temp\1469127073\PowerShellGet.3.0.11-beta' path.
VERBOSE: Test-ModuleManifest successfully validated the module manifest file 'C:\Users\m.philipp\AppData\Local\Temp\1469127073\PowerShellGet.3.0.11-beta'.
VERBOSE: Validating the authenticode signature and publisher of the catalog file or module manifest file of the module 'PowerShellGet'.
DEBUG: 00:00:14.6981971 Catalog file 'PowerShellGet.cat' is not found in the contents of the previously-installed module 'PowerShellGet' with the same name.
DEBUG: 00:00:14.6994263 Using the previously-installed module 'PowerShellGet' with version '2.2.5' under 'C:\program files\powershell\7\Modules\PowerShellGet' for getting the publisher details.
DEBUG: 00:00:14.6998181 Using the 'C:\program files\powershell\7\Modules\PowerShellGet\PowerShellGet.psd1' file for getting the authenticode signature.
DEBUG: 00:00:15.0120516 For publisher validation, using the previously-installed module 'PowerShellGet' with version '2.2.5' under 'C:\program files\powershell\7\Modules\PowerShellGet' with publisher name 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' from root certificate authority 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'.
VERBOSE: Catalog file 'PowerShellGet.cat' is not found in the contents of the module 'PowerShellGet' being installed.
DEBUG: 00:00:15.0168526 Using the 'PowerShellGet.psd1' file for getting the authenticode signature.
VERBOSE: Valid authenticode signature found in the file 'PowerShellGet.psd1' for the module 'PowerShellGet'.
DEBUG: 00:00:15.2415983 For publisher validation, current module 'PowerShellGet' with version '3.0.11' with publisher name 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' from root certificate authority 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'.
VERBOSE: For publisher validation, current module 'PowerShellGet' with version '3.0.11' with publisher name 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' from root certificate authority 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'.
VERBOSE: For publisher validation, using the previously-installed module 'PowerShellGet' with version '2.2.5' under 'C:\program files\powershell\7\Modules\PowerShellGet' with publisher name 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' from root certificate authority 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'.
DEBUG: 00:00:15.2448269 Previously-installed module publisher: CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
DEBUG: 00:00:15.2451619 Current module publisher: CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
DEBUG: 00:00:15.2456768 Is previously-installed module signed by Microsoft: True
DEBUG: 00:00:15.2458813 Is current module signed by Microsoft: True
VERBOSE: Authenticode issuer 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' of the new module 'PowerShellGet' with version '3.0.11' matches with the authenticode issuer 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' of the previously-installed module 'PowerShellGet' with version '2.2.5'.
VERBOSE: Checking for possible command collisions for the module 'PowerShellGet' commands.
DEBUG: 00:00:16.6293883 PowerShell Script 'PSModule' Function 'Install-Package' returns null.
Install-Package: Administrator rights are required to install or update. Log on to the computer with an account that has Administrator
rights, and then try again, or install by adding "-Scope CurrentUser" to your command. You can also try running the
Windows PowerShell session with elevated rights (Run as Administrator).
alerickson commented 2 years ago

Thanks for that information! Can you try running the commands again with -SkipPublisherCheck and can you also share the output of Get-Module PowerShellGet -ListAvailable? If this doesn't work, we have some other ideas we can try out.

MeikelLP commented 2 years ago
Get-Module PowerShellGet -ListAvailable
    Directory: C:\program files\powershell\7\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.2.5                 PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-M…

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     1.0.0.1               PowerShellGet                       Desk      {Install-Module, Find-Module, Save-Modu…
Install-Module -Name PowerShellGet -RequiredVersion 3.0.11-beta -AllowPrerelease -Force -SkipPublisherCheck
Install-Package: Administrator rights are required to install or update. Log on to the computer with an account that has Administrator
rights, and then try again, or install by adding "-Scope CurrentUser" to your command. You can also try running the
Windows PowerShell session with elevated rights (Run as Administrator).
bmkaiser commented 2 years ago

I also cannot install. I have tried both with PowerShell 7.2.5 and Windows PowerShell 5.1 from an Administrator shell using these commands:

Import-Module -Name PowerShellGet -MinimumVersion 2.2.5
Install-Module -Name PowerShellGet -AllowPrerelease -Force -SkipPublisherCheck

PowerShell 7.2.5 Error:

Install-Package: Administrator rights are required to install or update. Log on to the computer with an account that 
has Administrator rights, and then try again, or install by adding "-Scope CurrentUser" to your command. You can 
also try running the Windows PowerShell session with elevated rights (Run as Administrator).

Windows PowerShell 5.1 Error:

Install-Package : A parameter cannot be found that matches parameter name 'AllowPrereleaseVersions'.
At C:\Program Files\WindowsPowerShell\Modules\powershellget\2.2.5\PSModule.psm1:9711 char:68
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+                                                        ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Package], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

This is what I have listed when running Get-Module -Name PowerShellGet -ListAvailable:

PowerShell 7.2.5:

PS C:\Windows\System32> get-module powershellget -ListAvailable

    Directory: C:\program files\powershell\7\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.2.5                 PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-M…

    Directory: C:\Program Files (x86)\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     1.0.0.1               PowerShellGet                       Desk      {Install-Module, Find-Module, Save-Modu…

Windows PowerShell 5.1:

PS C:\WINDOWS\system32> get-module powershellget -ListAvailable

    Directory: C:\Program Files (x86)\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.2.5      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
alerickson commented 1 year ago

Hi all, just getting back to this issue and wanted to suggest using Save-Module instead of install.

Open a fresh PS session as admin and run the following: Save-Module PowerShellGet -Repository PSGallery -Path "C:\program files\powershell\7\Modules"

Note, that the path should be the first path that appears after running: Get-Module PowerShellGet -ListAvailable

bmkaiser commented 1 year ago

Thank for the reply, @alerickson. I just tried again using Import-Module and didn't have any issue installing now. I'm now running PowerShell 7.3.4 whereas before I was running 7.2.5. Maybe something changed along the way to resolve this issue.

What's the logic behind using Save-Module instead of Install-Module? How do these differ?

Install-Module -Name PowerShellGet -AllowPrerelease -Scope AllUsers -Force

Get-Module -Name PowerShellGet -ListAvailable

    Directory: C:\Program Files\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Binary     3.0.21     beta21     PowerShellGet                       Desk      {Find-PSResource, Get-InstalledPSResour…
Binary     3.0.14     beta14     PowerShellGet                       Desk      {Find-PSResource, Get-PSResource, Get-P…

    Directory: C:\program files\powershell\7\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.2.5                 PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-M…

    Directory: C:\Program Files (x86)\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     1.0.0.1               PowerShellGet                       Desk      {Install-Module, Find-Module, Save-Modu…