How do I fix the 'PackageManagement is currently in use' error?
Asked by
oar-lock
I'm trying to run some ExchangeOnline commands, but I keep getting the error message that says "'PackageManagement' is currently in use. Retry the operation after closing the applications." I've followed a bunch of solutions from forums including using Process Explorer, uninstalling and deleting the ProgramFiles, but nothing seems to work. Has anyone else experienced this and found a solution?
Answers
Have you tried using the `-AllowClobber` flag? If that doesn't work, I recommend rebooting your system, running the uninstall command again, rebooting, and then trying to reinstall it.
Reply to this answer
Make sure to update both PackageManagement and PowerShellGet individually. Don't forget to delete any older versions first if you have them.
Reply to this answer
It's tricky because you can't update the modules that are currently in use. You might try saving the modules locally, removing the loaded versions, and then importing them back. It's a workaround that has worked for me to install updated modules in the proper locations.
Reply to this answer
I ran into this issue a couple of weeks ago as well. I had multiple versions of the PackageManagement module installed. What I did was copy one version to my desktop, delete all the modules, and then install only the latest version. Don't forget to update PowerShellGet while you're at it!
Reply to this answer
Why aren't you using `Install-PSResource`? Itโs not as well known but it's supposed to be a better option for handling these types of installations.
chart+26: Because itโs not well publicized and isnโt listed as a dependency for Exchange Online, I didn't consider it.
Reply to this answer
Add your answer
Answers are reviewed before publication.
rescue dog training: I've gone through that cycle a few times and have the same results.