VMware Cloud Community
Vmware_CUCM
Contributor
Contributor

Power-CLI Connect-VIServer - Server <IP Address> gives error message "not recognized as the name of a cmdlet ..."

Connect-VIServer : The term 'Connect-VIServer' 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 line:1 char:1

+ Connect-VIServer -Server 172.16.0.200

+ ~~~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (Connect-VIServer:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

0 Kudos
3 Replies
jrodsguitar
Enthusiast
Enthusiast

Did you install Power-CLI and did you import the module?

Install-Module -Name VMware.PowerCLI

Import-Module VMware.PowerCLI

Blog: https://powershell.house/
0 Kudos
IRIX201110141
Champion
Champion

Most likely you havent install PowerCLI yet or succesfully loaded the needed module/pss-snapin from your environment.  If you download and installed if you will get 2 icons on the desktop which starts powershell together with the right environment.   Otherwise try

import-module VMware.VimAutomation.Core

in your script. If you use powercli 6.5 and up because they switch from snapins to modules.

Link: https://my.vmware.com/group/vmware/details?downloadGroup=PCLI650R1&productId=646

Regards,

Joerg

0 Kudos
timweaver23
Enthusiast
Enthusiast

If you want the modules to load each time you start powershell, you can edit your powershell profile with something like .....

cd "C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts"

.\Initialize-PowerCLIEnvironment.ps1

cd c:\

Import-Module VMware.VimAutomation.Core

Your powershell profile is usually found in C:\Users\[username]\WindowsPowerShell and can be named Microsoft.PowerShell_profile.ps1

You can find your profile location and details by typing in $profile

See this link for details ...

How to Integrate PowerCLI 6.5 with PowerShell and PowerShell ISE – [bw] wickhorst.com

0 Kudos