When installing the PowerCLI module, you may get the following error during the installation process:
PackageManagement\Install-Package : A command with name ‘Export-VM’ is already available on this system. This module
‘VMware.VimAutomation.Core’ may override the existing commands. If you still want to install this module
‘VMware.VimAutomation.Core’, use -AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
+ … $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power….InstallPackage:InstallPackage) [Install-Package],
Exception
+ FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.Pack
ageManagement.Cmdlets.InstallPackage
This error is due to a module which is already available on the system containing that cmdlet. In my example, I have the Hyper-V PowerShell module installed on my machine.
To solve this issue, that’s pretty simple, you just have to append “-AllowClobber” parameter to the Install-Module cmdlet.
PS > Install-Module –Name VMware.PowerCLI –Scope CurrentUser –AllowClobber
Thanks for reading! You can follow me on Twitter @PrigentNico