VMware Cloud Community
Yuanyl
Contributor
Contributor
Jump to solution

i cannot use the powercli cmdlet get-vdswitch

hi,guys:

     when i finished install the powercli ,i can use some powercli cmdlet,but when i want to get the VDS infomation,the IDE noticed that "the term 'get-vdswitch' is not recognized as the name of a cmdlet function,script file or operaable program".\

     can anyone thell me what wrroy about that.

     THX .

Tags (2)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

What does this return ?

Get-PSSnapin -Name VMware* | Select Name


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

View solution in original post

Reply
0 Kudos
20 Replies
LucD
Leadership
Leadership
Jump to solution

Is that PowerCLI 6.0 R1 ?

If yes, do a

Get-Module -Name VMware*

and check if VMware.VimAutomation.Vds is in the list


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

Reply
0 Kudos
Yuanyl
Contributor
Contributor
Jump to solution

hi,LucD:

no,the powercli version is 5.8

and i can use the cmdlet in my uat environment with the same version.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

What does this return ?

Get-PSSnapin -Name VMware* | Select Name


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

Reply
0 Kudos
VinithMenon
VMware Employee
VMware Employee
Jump to solution

Did you run a

Import-Module VMware.VimAutomation.Vds

within ISE ?

LucD
Leadership
Leadership
Jump to solution

I think he just stated that he runs PowerCLI 5.8


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

Reply
0 Kudos
VinithMenon
VMware Employee
VMware Employee
Jump to solution

ok, ya correct.

Reply
0 Kudos
Yuanyl
Contributor
Contributor
Jump to solution

hi,LucD:

     it's return like this:

    

     Name

     --------

     Vmware.VimAutomation.Croe

     but i run this in uat environment it's return like that:

     Name

     --------

     Vmware.VimAutomation.Croe

     Vmware.DeployAutomation

     Vmware.ImageBuilder

     Vmware.VimAutomation.Cloud

     Vmware.VimAutomation.License

     Vmware.VimAutomation.Storage

     Vmware.VimAutomation.Vds

Reply
0 Kudos
Yuanyl
Contributor
Contributor
Jump to solution

hi:

         it's return error like :

     The specified module 'VMware.VimAutomation.vds' was not loaded beause no vaild module file was found in any module directory.

     could you tell me what does this mean?

Reply
0 Kudos
Yuanyl
Contributor
Contributor
Jump to solution

HI,LucD:

     I realize this issue maybe the reason that the module wasn't import,so i try to add the module:

     add-pssnapin vmware.vimautomation.vds

     It work's!

     :smileylaugh::smileylaugh:

Reply
0 Kudos
tekerjerbs
Contributor
Contributor
Jump to solution

I'm having the same issue on v6.0 R1 and cannot get this to work.

Get-Module -Name VMware* returns VMware.VimAutomation.Vds in the list, however add-pssnapin VMware.vimautomation.vds fails with the generic message:

add-pssnapin : The Windows PowerShell snap-in 'VMware.vimautomation.vds' is not installed on this computer.

I can load VMware.VimAutomation.Core without any issues but not the VDS module and therefore all VDS related commands fail when executed from a .ps1 script or native PowerShell, such as get-vdswitch and export-vdswitch.

I'm thinking about trying an older version of PowerCLI, just wanted to find out if anyone else out there has the same issue.  I am trying to automate exporting our VDS switch configurations and am currently stuck.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you check if the module path is correct ?

See my Fixing a (minor) PowerCLI 6 R1 issue post


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

tekerjerbs
Contributor
Contributor
Jump to solution

I managed to get the user's psmodulepath variable to match the machine's, so if it wasn't correct before it certainly is now and also used your script to take care of the vim.psc1 file but the issue still persists.

are you actually able to load the VMware.vimautomation.vds snap-in? I'm not even sure if I need this or not but it still seems like the VDS related cmlets are failing

Import-Module VMware.VimAutomation.Vds seems to work as suggested earlier in the thread, maybe I can use it to get by for now

thanks anyway

LucD
Leadership
Leadership
Jump to solution

What do you see when you do

Get-Module -ListAvailable -Name VMware*


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

tekerjerbs
Contributor
Contributor
Jump to solution

PS C:\> Get-Module -ListAvailable -Name VMware*


    Directory: C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     6.0.0.0    VMware.VimAutomation.Cis.Core
Manifest   6.0.0.0    VMware.VimAutomation.Core
Binary     6.0.0.0    VMware.VimAutomation.HA
Manifest   6.0.0.0    VMware.VimAutomation.SDK
Binary     6.0.0.0    VMware.VimAutomation.Storage
Binary     6.0.0.0    VMware.VimAutomation.Vds

it's interesting that VMware.VimAutomation.Core is the only one I can add using the add-pssnapin cmdlet

do adding any of those other ones work for you?

I'm using two difference systems, one of them a clean install of PowerCLI and they all have this same issue.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

PowerCLI 6R1 is a mix of PSSnapin and Modules.

When you start the PowerCLI prompt, do you then get the cmdlet ?

And yes, for me the cmdlets all work.


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

Reply
0 Kudos
tekerjerbs
Contributor
Contributor
Jump to solution

PowerCLI lets me execute VDS commands but if I try running add-pssnapin VMware.VimAutomation.Vds it will still fail (even though it's technically already loaded and not needed)

Reply
0 Kudos
roeschuxxx
Contributor
Contributor
Jump to solution

Got the same problem after PowerCli 5.5 to 6.0r2 update

A script with

Add-PSSnapin VMware.VimAutomation.Core

Add-pssnapin vmware.vimautomation.vds

at the beginning wasn't anymore able to load/install the vds Snappin. After i've commented these two lines out and wrote instead

Import-Module VMware.VimAutomation.Vds

It worked again

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The VDS component is a module in PowerCLI 6  R2, that's why the Add-PSSnapin doesn't work.

What is included in PowerCLI in which format is documented in the PowerCLi 6.0 R2 Release Notes.

pcli6r2.png

You can use a Try-Catch construct to handle this. Something like for exsample

$name = 'test.test'

Try{

    Add-PSSnapin -Name $name -ErrorAction Stop

}

Catch{

    Write-Warning "There is no PSSnapin called $($name)"

}


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

Reply
0 Kudos
bernz
Enthusiast
Enthusiast
Jump to solution

The same works for me, need to import that plugins for vds, using Powershell.

Reply
0 Kudos