Automation

 View Only
Expand all | Collapse all

i cannot use the powercli cmdlet get-vdswitch

  • 1.  i cannot use the powercli cmdlet get-vdswitch

    Posted May 29, 2015 09:37 AM

    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 .



  • 2.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted May 29, 2015 09:41 AM

    Is that PowerCLI 6.0 R1 ?

    If yes, do a

    Get-Module -Name VMware*

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



  • 3.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Jun 01, 2015 01:09 AM

    hi,LucD:

    no,the powercli version is 5.8

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



  • 4.  RE: i cannot use the powercli cmdlet get-vdswitch
    Best Answer

    Posted Jun 01, 2015 01:09 PM

    What does this return ?

    Get-PSSnapin -Name VMware* | Select Name



  • 5.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Jun 02, 2015 01:28 AM

    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



  • 6.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Jun 02, 2015 02:35 AM

    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:



  • 7.  RE: i cannot use the powercli cmdlet get-vdswitch

    Broadcom Employee
    Posted Jun 01, 2015 01:19 PM

    Did you run a

    Import-Module VMware.VimAutomation.Vds

    within ISE ?



  • 8.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Jun 01, 2015 01:22 PM

    I think he just stated that he runs PowerCLI 5.8



  • 9.  RE: i cannot use the powercli cmdlet get-vdswitch

    Broadcom Employee
    Posted Jun 01, 2015 01:24 PM

    ok, ya correct.



  • 10.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Jun 02, 2015 01:35 AM

    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?



  • 11.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Aug 19, 2015 06:10 PM

    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.



  • 12.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Aug 19, 2015 06:31 PM

    Did you check if the module path is correct ?

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



  • 13.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Aug 19, 2015 08:04 PM

    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



  • 14.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Aug 20, 2015 09:49 AM

    What do you see when you do

    Get-Module -ListAvailable -Name VMware*



  • 15.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Aug 20, 2015 02:51 PM

    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.



  • 16.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Aug 20, 2015 03:43 PM

    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.



  • 17.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Aug 20, 2015 03:55 PM

    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)



  • 18.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Sep 22, 2015 01:03 PM

    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



  • 19.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Sep 22, 2015 01:59 PM

    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.

    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)"

    }



  • 20.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Oct 07, 2016 03:20 AM

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



  • 21.  RE: i cannot use the powercli cmdlet get-vdswitch

    Posted Oct 07, 2016 05:42 AM

    Fyi, I created a function for loading the PSSnapin and modules, independent from the PowerCLI release.

    See Universal PowerCLI Loader