PowerShell / PowerShell/PSResourceGet

Can't install

Open
#624 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs-Attention :wave:
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Install-Module in PSModule.psm1 at line 9711, then trace the PackageManagement\Install-Package call shown in the error. Reproduce both the non-elevated CurrentUser and elevated commands on the reported environment, and identify why the requested PowerShellGet version does not install. Done means the command succeeds with the appropriate scope or elevation.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.