iainbrighton/PScribo

Can't Install-Module even with elevated prompt

Opened this issue · 2 comments

image

With -scope set to CurrentUser or AllUsers, the install-module PScribo command fails with:

Install-Package: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:9685
Line |
9685 |  … talledPackages = PackageManagement\Install-Package @PSBoundParameters
     |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 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).

I have administrator permissions on the machine, but it is a company laptop.

PowerShell Version:

PS C:\Users\username\Documents\WindowsPowerShell\Modules> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      0      0

The install is successful for -Scope AllUsers when using the PowerShell version 5.1

@devopsmyth Sorry - I appear to have completely missed this one.

I think this is a PowerShell 7/PackageManagement issue - nothing to do with PScribo. Are you running your PowerShell 7 session elevated?

I was using Administrator elevated PWSH session. I'll test again since it's been a while. If you don't hear back from me in the next few days. Feel free to close this or I'll do it the next time I think about it.