cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1450
Views
0
Helpful
9
Replies

Using PowerCLI 5.5 instead of 5.0

davshapi
Level 1
Level 1

CPO 3.1

Powercli 5.5

 

CPO seems to use PowerCLI 5.0 by default and cannot be changed as far as I can tell. 

 

I am working on automation for VDS (virtual distributed switches) and the built in VMware adapter is somewhat limited in that department so I was attempting to use PowerCLI but even basic commands in 5.5 such as Get-VDSwitch are "unrecognized as cmdlets" in my CPO process where the same command functions in my PowerCLI console I use for testing. 

So am I correct in my observation that CPO defaults to PowerCLI 5.0 even when 5.5 is installed? Is there a way to change this? Is there a place to download an upgraded version of the VMware adapter? 

 

Full error: PowerCLI script execution succeeded but returned the following errors:
The term 'Get-VDSwitch' 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.

 

1 Accepted Solution

Accepted Solutions

PowerCLI 5.5 console loads this snap-in when the console starts up.  This new snap-in (shipped with PowerCLI 5.5) did not exist when the activity was written.  And so, it is not loaded by the activity.  Perhaps we can enhance the activity to allow users to specify additional snap-in for it to load. :) 

View solution in original post

9 Replies 9

Shaun Roberts
Cisco Employee
Cisco Employee

Are you using the Execute Powershell activity or the one specific to VMWare? (powershell that is)

--Shaun Roberts
Principal Engineer, CX
shaurobe@cisco.com

I am using the PowerCLI activity. 

Do you have both 5.0 & 5.5 installed on your machine?  From your information, it appears that you might have the 64 bit version of PowerCLI 5.0 installed along with the 32 bit version of PowerCLI 5.5 installed.  Can you verify if that is the case?

 

The activity will use the 64 bit version of the PowerCLI if it is installed.  If not, then, it will look up the 32 bit version.

 

Yes just verified that only version 5.5 is installed on the CPO server. Code snippet from PowerCLI activity:

 

param (
[string] $NumPorts,
[string] $pgName,
[string] $vlan,
[string] $vdsName)

$vds = Get-VDSwitch -name $vdsName

New-VDPortgroup -VDSwitch $vds -Name $pgName -NumPorts $NumPorts -VlanTrunkRange $vlan -PortBinding Static -Confirm:$false

Screenshots of stuff from CPO server

The screenshot shows that you have the 32 bit version of PowerCLI 5.5 installed.

Can you check the following registry key to see if it is pointing to the PowerCLI 5.0?

"HKLM\SOFTWARE\VMware, Inc.\VMware vSphere PowerCLI"

 

 

I thought I had both versions installed but it appears that it is 32-bit for both. I will see if I cannot find and download a 64 bit version. 

 

Also that registry entry does not exist on my server :( 

 

davshapi
Level 1
Level 1

RESOLVED: https://communities.vmware.com/message/2416167

I changed my code to look like:

 

param (
[string] $NumPorts,
[string] $pgName,
[string] $vlan,
[string] $vdsName)

Add-PSSnapin VMware.vimautomation.vds

$vds = Get-VDSwitch -name $vdsName

New-VDPortgroup -VDSwitch $vds -Name $pgName -NumPorts $NumPorts -VlanTrunkRange $vlan -PortBinding Static -Confirm:$false

And it worked. Not sure why I have to do that in CPO but not in my PowerCLI console. 

PowerCLI 5.5 console loads this snap-in when the console starts up.  This new snap-in (shipped with PowerCLI 5.5) did not exist when the activity was written.  And so, it is not loaded by the activity.  Perhaps we can enhance the activity to allow users to specify additional snap-in for it to load. :) 

I don't know how much overhead that snap-in incurs but yes it would be great to have that support built-in for upcoming releases. Although it would be made irrelevant if upcoming VMware adapters for CPO include more VDS functionality to begin with. Either way, PowerCLI is very powerful and can do pretty much everything I have needed thus far, but it is also nice when I can just use the canned CPO activity as well. 

Review Cisco Networking for a $25 gift card