VMware Cloud Community
Ghaithiland
Contributor
Contributor

Cannot install PowerCLI

Hello,

I am trying to install PowerCLI using the following commands 

Install-Module -Name PowerShellGet -RequiredVersion 2.2.5 -Force

This one returns a Warning:

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

I have removed and the module and installed it again, tried to proceed with the next step:

Install-Module -Name VMware.PowerCLI -SkipPublisherCheck -Force -AllowClobber

But getting this error:

PackageManagement\Install-Package : Package 'VMware.Vim' failed to be installed because: The process cannot access the file 'C:\Users\gmohammed\AppData\Local\Temp\xs5ns0ff\netcoreapp2.0\VMware.Vim.dll' because it is being used by another process. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9710 char:34 + ... talledPackages = PackageManagement\Install-Package @PSBoundParameters + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (VMware.Vim:String) [Install-Package], Exception
+ FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

I spent quite some time searching\Googling to get a solution but no luck.

I appreciate any help, thanks!

0 Kudos
8 Replies
LucD
Leadership
Leadership

Can you try using a PowerShell session started as Administrator?
Then try to upgrade the module with 

Update-Module -Name PowerShellGet -RequiredVersion 2.2.5

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Ghaithiland
Contributor
Contributor

The command went fine, but when I tried to install PowerCLI I got the same error, screenshot attached.

Thanks,

 

0 Kudos
LucD
Leadership
Leadership

Can you try the solution from Solved: Re: Unable to Install PowerCLI - VMware Technology Network VMTN


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Ghaithiland
Contributor
Contributor

I have tried steps from the provided link and the other link, deleted all content of temp folder, restarted, and still the same.

I have attached some screenshots hope that helps.

 

0 Kudos
LucD
Leadership
Leadership

The solution from that thread I pointed to was that the user had Visual Studio installed.
After removing that, the module installed


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Ghaithiland
Contributor
Contributor

No Visual Studio installed, nothing in program files or program data and not in control panel.

Regards,

0 Kudos
LucD
Leadership
Leadership

Strange.
Did you try on another station?
Same result?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Ghaithiland
Contributor
Contributor

I have tried it on my laptop and it works fine so I ended up doing an offline installation and that worked, thanks for your help tho!

0 Kudos