OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

Unable to install/update modules - packagemanagement #492

Open powershellpr0mpt opened 4 years ago

powershellpr0mpt commented 4 years ago

Steps to reproduce

Was redirected here from the PowerShell Github

Having problems doing anything related to installing or updating modules in PS7. Same machines as where I ran PS6 and PS7-preview PS5.1 working as intended

First I try to

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force

Expected behavior

The PackageProvider gets installed

Actual behavior

Install-PackageProvider: Unable to find repository with SourceLocation ''. Use Get-PSRepository to see all available repositories.

alt text

Then I try

C:\>Get-PSRepository
Get-PackageSource: C:\Program Files\PowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1:9144
Line |
9144 |  … ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters
     |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find module providers (PowerShellGet).

alt text

Followed by

C:\>Register-PSRepository -Default

NuGet provider is required to continue
This version of PowerShellGet requires minimum version '2.8.5.201' of NuGet provider to publish an item to NuGet-based
repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\RobertPrüst\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
Install-PackageProvider: C:\Program Files\PowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1:3104
Line |
3104 |  …     $null = PackageManagement\Install-PackageProvider -Name $script:N …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find repository with SourceLocation ''. Use Get-PSRepository to see all available
     | repositories.

Import-PackageProvider: C:\Program Files\PowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1:3110
Line |
3110 |  …     $null = PackageManagement\Import-PackageProvider -Name $script:Nu …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No match was found for the specified search criteria and provider name 'NuGet'. Try
     | 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.

Get-PackageProvider: C:\Program Files\PowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1:3114
Line |
3114 |  … tProvider = PackageManagement\Get-PackageProvider -Name $script:NuGet …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find package provider 'NuGet'. It may not be imported yet. Try 'Get-PackageProvider
     | -ListAvailable'.

Register-PSRepository: NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed.

alt text

I have this on 2 machines at the moment, I've tried uninstalling/reinstalling, but no luck. I've searched for people experiencing similar issues, but no luck. FIPS not enabled on both machines Tried the steps here, but also no luck

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Someone mentioned it might be related to OneDrive known-folder-move, this is configured on both machines through Intune [corporate policies pushed to device]

Not sure if this is actually it, but perhaps it is of any help troubleshooting?

powershellpr0mpt commented 4 years ago

I've also tried manually copying the Nuget packageprovider .dll as mentioned here, but no luck. The .dll was originally located under C:\Program Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208 , copied to AppData folder, but no luck.

2020-05-14 08_50_42-2 8 5 208

jahedges-tp commented 4 years ago

I am now facing this exact same issue, and have also moved to OneDrive backup recently. Did you find any fix?

papymaj5 commented 4 years ago

Having the same problem and only with PS7 not with 5.1 desktop. FIPS not enabled.

davesbrown commented 4 years ago

same problem with 5.1 and windows server 2016

franklesniak commented 4 years ago

Try updating PackageManagement. If I recall correctly, it updates NuGet as a prerequisite and works-around this problem.

Install-Module -Name "PackageManagement" -Force

powershellpr0mpt commented 4 years ago

image Unfortunately no luck.

Also running newer version and new machine [but same account], but no luck: image

franklesniak commented 4 years ago

Robert, the fact that your PowerShell window shows "Administrator" in the title bar, yet PowerShell is reporting that you do not have administrative rights tells me that something on the computer is restricting your admin rights. Any relevant GPOs or security software in place?

If you do a whoami /all do you get this list of privileges?:

PRIVILEGES INFORMATION
----------------------

Privilege Name                            Description                                                        State
========================================= ================================================================== ========
SeIncreaseQuotaPrivilege                  Adjust memory quotas for a process                                 Disabled
SeSecurityPrivilege                       Manage auditing and security log                                   Disabled
SeTakeOwnershipPrivilege                  Take ownership of files or other objects                           Disabled
SeLoadDriverPrivilege                     Load and unload device drivers                                     Disabled
SeSystemProfilePrivilege                  Profile system performance                                         Disabled
SeSystemtimePrivilege                     Change the system time                                             Disabled
SeProfileSingleProcessPrivilege           Profile single process                                             Disabled
SeIncreaseBasePriorityPrivilege           Increase scheduling priority                                       Disabled
SeCreatePagefilePrivilege                 Create a pagefile                                                  Disabled
SeBackupPrivilege                         Back up files and directories                                      Disabled
SeRestorePrivilege                        Restore files and directories                                      Disabled
SeShutdownPrivilege                       Shut down the system                                               Disabled
SeDebugPrivilege                          Debug programs                                                     Disabled
SeSystemEnvironmentPrivilege              Modify firmware environment values                                 Disabled
SeChangeNotifyPrivilege                   Bypass traverse checking                                           Enabled
SeRemoteShutdownPrivilege                 Force shutdown from a remote system                                Disabled
SeUndockPrivilege                         Remove computer from docking station                               Disabled
SeManageVolumePrivilege                   Perform volume maintenance tasks                                   Disabled
SeImpersonatePrivilege                    Impersonate a client after authentication                          Enabled
SeCreateGlobalPrivilege                   Create global objects                                              Enabled
SeIncreaseWorkingSetPrivilege             Increase a process working set                                     Disabled
SeTimeZonePrivilege                       Change the time zone                                               Disabled
SeCreateSymbolicLinkPrivilege             Create symbolic links                                              Disabled
SeDelegateSessionUserImpersonatePrivilege Obtain an impersonation token for another user in the same session Disabled