Open jzabroski opened 6 years ago
Hi.
I have the same issue when I try to install PowerShellGet
Install-Module -Name PowerShellGet -Repository PSGallery -Force -SkipPublisherCheck
WARNING: The version '1.4.7' of module 'PackageManagement' is currently in use. Retry the operation after closing the applications.
So I decided to uninstall the PackageManagement and I get this message error:
Uninstall-Package: C:\Users\<my_user>\Documents\PowerShell\Modules\PowerShellGet\2.2.4.1\PSModule.psm1:12731
Line |
12731 | … $null = PackageManagement\Uninstall-Package @PSBoundParameters
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| No match was found for the specified search criteria and module names 'PackageManagement'.
But I have this module!!!
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 1.4.7 PackageManagement {Find-Package, Find-PackageProvider, Get-…
And it's not all, because if I look into the PackageManagement folder I see this:
Directory: C:\Program Files\WindowsPowerShell\Modules\PackageManagement
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 19/3/2019 08:49 1.0.0.1
1.0.0.1 ??? But the version installed is 1.4.7.
I don't know how to fix this issue.
Hi everyone.
I found a solution to this 'issue'.
The first mistake was that Powershell core is NO the same that Powershell, in my case I'm using the new windows Terminal, so with this in mind, I decided to uninstall azure module in both Powershell.
After the uninstall process, I Installed the Azure module on PowerShell core and Powershell by separated (I think that was unnecessary) and then I import in Powershell core Az
, Az.Account
and Az.Resources
modules and this worked for me.
I hope that this can help you
@dsgon can you please show the commands that you ran to unistall and install to fix the issue?
This is a dumb as hell issue to even have in the first place. My solution was:
$ENV:USERPROFILE\Documents\WindowsPowerShell\Modules\PackageManagemnt
to my desktopGet-Module
Import-Module .\PackageManagement.psd1
Install-Module PowershellGet -Force
This operation now succeeds. Finally:
$ENV:USERPROFILE\Documents\WindowsPowerShell\Modules\PackageManagemnt
I'm having the same issue
My thingking: There is a difference between machine(system) and user Modules. The usermodules have preference above the system modules. You are able to install modules where you want theme to be via -scope. You can install theme in both locations at the same time. What happens if you install different versions for user and system? How do you replace the newest version? How do you replace the running version? How do you know which (system v.s. user) module is running? If I uninstall 1 module which exist in both location and is a fundamental mdule like packagemanagement... I have not investigated these yet, but hey, lets share these questions and then come with a solution.
Hmm. Surely this has been solved by other modules that update?
It's certainly possible to define the install scope: https://docs.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershell-5.1#parameters:~:text=Specifies%20the%20installation%20scope%20of%20the%20module
And you can programatically determine what's loaded in the current session with Get-Module
PS C:\Users\UserName> (Get-Module).path
C:\ProgramData\chocolatey\helpers\chocolateyProfile.psm1
C:\windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1
C:\windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1
C:\Program Files\WindowsPowerShell\Modules\PSReadline\2.0.0\PSReadLine.psm1
Hmm. Surely this has been solved by other modules that update?
It's certainly possible to define the install scope: https://docs.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershell-5.1#parameters:~:text=Specifies%20the%20installation%20scope%20of%20the%20module
And you can programatically determine what's loaded in the current session with
Get-Module
PS C:\Users\UserName> (Get-Module).path C:\ProgramData\chocolatey\helpers\chocolateyProfile.psm1 C:\windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1 C:\windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1 C:\Program Files\WindowsPowerShell\Modules\PSReadline\2.0.0\PSReadLine.psm1
Small change which will also show the usermodules loaded:
(Get-Module -All).path
Or showing only userscope:
((Get-Module -All).Path).where({$_ -notin (Get-Module).Path})
Wow, check this out. It's possible I'm doing things wrong but wow is this complicated.
I can't seem to remove 1.1.7.0 and I have no idea when I'm running Find-Package if it actually is using 1.2.0 or 1.1.7.0:
Think I'm done having fun?
Now, what would be logical at this point, is to try uninstalling 1.1.7.0 using something named Uninstall-Module... but nope... that's not possible. The fun has to continue.
On top of this, the documentation online constantly warns users about confusing the PackageManagement cmdlets with the Visual Studio NuGet Package Manager cmdlets, but there is no explanation for what to call "Visual Studio NuGet Package Manager cmdlets" other than "Visual Studio NuGet Package Manager cmdlets" (mouthful), and 90% of all searches for Find-Package end up putting you back on to "Visual Studio NuGet Package Manager cmdlets" blog posts, documentation, etc.