The system appears to have two (2) versions of PowerShellGet module installed.
Script 2.2 PowerShellGet
Script 1.0.0.1 PowerShellGet
How can I uninstall the older version? The Uninstall-Module
command appears to be looking in the 2.2
directory. Why is that?
>Uninstall-Module -Name 'PowerShellGet' -RequiredVersion '1.0.0.1'
PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'PowerShellGet'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2\PSModule.psm1:12655 char:21
+ ... $null = PackageManagement\Uninstall-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
+ FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage
When I try to specify the older version, it reports the new version.
>Get-Module -FullyQualifiedName @{ModuleName="PowerShellGet";ModuleVersion="1.0.0.1"}
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.2 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...}
>($PSVersionTable.PSVersion).ToString()
5.1.14409.1018
>(Get-CimInstance -ClassName Win32_OperatingSystem).Caption
Microsoft Windows 7 Enterprise
Short answer:
You can't that uninstall something with PowerShellGet
if it wasn't installed with PowerShellGet
.
Long answer:
PowerShellGet v1.0.0.1
was installed as a part of Windows, and not using PowerShellGet
(naturally). Hence, why you can't use PowerShellGet
to Uninstall-Module
it.
PowerShellGet v2.2
on the other hand, is installed with PowerShellGet
and so you can Uninstall-Module
it. You can also update it etc.
If you really want to uninstall the v1.0.0.1 version, you have to follow these Steps:
- Browse to
C:\Program Files\WindowsPowerShell\Modules\
- Go into
C:\Program Files\WindowsPowerShell\Modules\PowershellGet
folder, and delete the sub- folder1.0.0.1
- Then do the same for
C:\Program Files\WindowsPowerShell\Modules\PackageManagement
, delete the sub-folder1.0.0.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With