Error when running Install-Module -Name PackageManagement,PowerShellGet -AllowClobber -Force -SkipPublisherCheck

1.4k Views Asked by At

I am trying to run the below command but I am getting an error message:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name PackageManagement,PowerShellGet -AllowClobber -Force -SkipPublisherCheck

Error message:

WARNING: The version '1.4.8.1' of module 'PackageManagement' is currently in use. Retry the operation after closing the applications.

I am running on a windows server and on PowerShell 5.1.

I've tried to remove the module and uninstall the module and I get the same error, the server has also had a reboot and there are no other users on it.

1

There are 1 best solutions below

3
Scepticalist On

The default versions of these are in the Windows system directory and should not be deleted.

You should install all elements individually to avoid "in use" errors

Update Nuget then install/update to the latest version of PowerShellGet:

Install-PackageProvider Nuget –Force
Install-Module -Name PackageManagement -AllowClobber -Force
Install-Module –Name PowerShellGet –Force -AllowClobber

Get-Module -ListAvailable PackageManagement, PowerShellGet