Error "Get-PowerCLIVersion : The term 'Get-PowerCLIVersion' is not recognized as the name of a cmdlet,   function, script file, or operable program." while starting VMware vSphere PowerCLI

Error "Get-PowerCLIVersion : The term 'Get-PowerCLIVersion' is not recognized as the name of a cmdlet, function, script file, or operable program." while starting VMware vSphere PowerCLI

Sometimes the following error appear while starting VMware vSphere PowerCLI:

Get-PowerCLIVersion : The term 'Get-PowerCLIVersion' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At C:\Program Files (x86)\VMware\Infrastructure\vSphere
PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1:38 char:12
+ $version = Get-PowerCLIVersion
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-PowerCLIVersion:String) [], CommandNotFoundExce
ption
+ FullyQualifiedErrorId : CommandNotFoundException

 

Error "Get-PowerCLIVersion : The term 'Get-PowerCLIVersion' is not recognized as the name of a cmdlet,   function, script file, or operable program." while starting VMware vSphere PowerCLI

 

To solve this issue try to start Powershell as administrator and run the following commands (they will add PowerCLI modules to the global variable on the system level):

$CurrentValue = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine")
[Environment]::SetEnvironmentVariable("PSModulePath", $CurrentValue + ";C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules", "Machine")

 

 

Tags: vmware (en), powershell (en)

Print