Remove Old PowerShellGet and PackageManagement Modules

Recently, I was installing Exchange Online PowerShell V3 module (EXO V3 module) on a Windows 11 device. Cmdlets in EXO V3 modules are based on REST API connections which require PowerShellGet and PackageManagement modules to be installed.

Therefore, I first checked to find out if these modules are Installed on my device using below command. The output shows that PackageManagement and PowerShellGet version 1.0.0.1 is installed on the device.

Get-Module PowerShellGet, PackageManagement -ListAvailable
Check Powershellget and packagemanagement modules versions

I wanted to update these modules to the latest version, therefore I have used below command which updated both PowerShellGet and PackageManagement modules to the latest version. Please note PowerShellGet is dependent on PackageManagement module.

I used -Force switch to install the module without any prompts on the console, and -AllowClobber will override or clobber an existing command available in another module to ensure there are no conflicts or error during the module installation.

Install-Module PowerShellGet -Force -AllowClobber

After updating the PowerShellGet and PackageMangement modules, execute below command to list the available versions.

Get-Module PowerShellGet, PackageManagement -ListAvailable

You may find multiple versions of PowerShellGet and PackageManagement in the list because when you install newer version of these modules, it gets installed side-by-side with older versions. To get rid of the older versions of these modules, you will need to delete module folders.

  • Go to the location C:\Program Files\WindowsPowerShell\Modules\PackageManagement and delete 1.0.0.1 folder.

If you find more folders with older version of this module at this location, you can safely remove them if you are planning to just use the latest version of these modules.

Delete 1.0.0.1 folder from Packagemanagement module folder
  • Go to the location at C:\Program Files\WindowsPowerShell\Modules\PowerShellGet and delete 1.0.0.1 folder.

If you find more folders with older version of this module at this location, you can safely remove them if you are planning to just use the latest version of these modules.

Delete 1.0.0.1 folder from Powershellget module folder

Now, execute below command to check the available versions. You will not find the versions corresponding to the folders you have deleted for these modules.

Get-Module PowerShellGet, PackageManagement -ListAvailable
check updated version of Powershellget and packagemanagement

Read Next

Leave a Comment