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?
5 Answers
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.
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!
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.
Make sure to update both PackageManagement and PowerShellGet individually. Don't forget to delete any older versions first if you have them.
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.
I've gone through that cycle a few times and have the same results.

Because it’s not well publicized and isn’t listed as a dependency for Exchange Online, I didn't consider it.