Automation

 View Only
Expand all | Collapse all

remove software vib via connecting vcenter

  • 1.  remove software vib via connecting vcenter

    Posted Apr 21, 2015 10:37 PM

    instated of connecting to ESXi Host directly. is any way to remove the software vib on a esxi ... remove software vib via connecting vcenter

    when we have to remove a vib from more than 100+ esxi host .. We have to connect all server servers to remove the module? it too loaded. Is there any way that we can connect to vCenter using powercli and then read the esxcli of the host. and remove the vib

    i tried below no luck

    PS C:\Users\Administrator> $esxcli = Get-VMHost | Get-EsxCli

    PS C:\Users\Administrator> $hpams=$esxcli.software.vib.list() | Where { $_.Name -like “*scsi-megaraid-sas*”}

    PS C:\Users\Administrator> $hpams | ForEach { $esxcli.software.vib.remove($false, $false, $false, $false, $_.Name)}

    Missing required parameter –vibname

    At line:1 char:47

    + $hpams | ForEach { $esxcli.software.vib.remove <<< $hpams

    AcceptanceLevel : VMwareCertified

    ID : VMware_bootbank_scsi-megaraid-sas_4.32-1vmw.500.0.0.469512

    InstallDate : 2015-01-11

    Name : scsi-megaraid-sas

    ReleaseDate : 2011-08-19

    Status :

    Vendor : VMware

    Version : 4.32-1vmw.500.0.0.469512


    same commands i am able to remove if i am connected individual esxi host using root id ( Connect-VIServer <esxi ip> ) … But when i connected with vcenter using administrator (Connect-VIServer vcenter ip ) it not working getting above error message .. .


    i tried with $hpams | ForEach { $esxcli.software.vib.remove($null, $false, $false, $false, $_.Name)} also no luck ...


    and me if you have any fix for this ...



  • 2.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 05:34 AM

    You can use the Get-EsxCli cmdlet, and then the remove method.

    Something like this

    $esxcli.software.vib.remove($false, $true, $false, $true, $vibName)

    The last parameter is the VIB name, you can get those with

    $esxcli.software.vib.list() | Select Name

    Building on your trial, did you already try like this ?

    Get-VMHost | %{

        $esxcli = Get-EsxCli -VMHost $_

        $esxcli.software.vib.list() | Where { $_.Name -like “*scsi-megaraid-sas*”} | %{

            $esxcli.software.vib.remove($false, $false, $false, $true, $_.Name)

        }

    }



  • 3.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 08:16 AM

    i tried same issue

    PS C:\Users\Administrator\Desktop> $esxcli.software.vib.remove($false, $true, $false, $true, $scsi-megaraid-sas)

    You must provide a value expression on the right-hand side of the '-' operator.

    At line:1 char:65

    + $esxcli.software.vib.remove($false, $true, $false, $true, $scsi- <<<< megaraid-sas)

        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException

        + FullyQualifiedErrorId : ExpectedValueExpression

    about

    Get-VMHost | %{

        $esxcli = Get-EsxCli -VMHost $_

        $esxcli.software.vib.list() | Where { $_.Name -like “*scsi-megaraid-sas*”} | %{

            $esxcli.software.vib.remove($false, $false, $false, $true, $_.Name)

        }

    }




  • 4.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 08:53 AM

    In your code that last parameter on the method should be $_.Name in my opinion.

    For the code I provided, can you check that the following actually returns an object that has the Name property ?

    $esxcli.software.vib.list() | Where { $_.Name -like “*scsi-megaraid-sas*”}



  • 5.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 09:17 AM

    I already tried with the $_.Name same issue .. when i run the same commend connecting individual esxi host .. its working $esxcli.software.vib.remove($null, $true, $false, $true, $_.Name)

    but when i connect vcenter and ran facing the issue ....

    below is out of $esxcli.software.vib.list() | Where { $_.Name -like "*scsi-megaraid-sas*"}


    PS C:\Users\Administrator> $esxcli = Get-VMHost | Get-EsxCli

    PS C:\Users\Administrator> $esxcli.software.vib.list() | Where { $_.Name -like "*scsi-megaraid-sas*"}

    AcceptanceLevel : VMwareCertified

    ID              : VMware_bootbank_scsi-megaraid-sas_4.32-1vmw.500.0.0.469512

    InstallDate     : 2015-01-11

    Name            : scsi-megaraid-sas

    ReleaseDate     : 2011-08-19

    Status          :

    Vendor          : VMware

    Version         : 4.32-1vmw.500.0.0.469512



  • 6.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 09:25 AM

    It could be a limitation for the software.vib namespace and the remove method, that you need in fact to be connected to the ESXi node.

    Not sure about that, and can't find any documentation on that.

    Just a wild guess, did you already try setting the 2nd parameter (Force) to $true on the remove method ?



  • 7.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 10:01 AM

    i already tried $null

    2nd parameter as $true also ... no luck ...

    thinking to automate how to remove a software vib from 100+ esxi .. logging each and every server is too loaded .. so thinking alternate .. 

    PS C:\Users\Administrator> $hpams |  ForEach { $esxcli.software.vib.remove($null, $true, $false, $true, $_.Name)}

    Missing required parameter --vibname

    At line:1 char:48

    + $hpams |  ForEach { $esxcli.software.vib.remove <<<< ($null, $true, $false, $true, $_.Name)}

        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

        + FullyQualifiedErrorId : MethodInvocationException

    PS C:\Users\Administrator> $hpams |  ForEach { $esxcli.software.vib.remove($false, $true, $false, $true, $_.Name)}

    Missing required parameter --vibname

    At line:1 char:48

    + $hpams |  ForEach { $esxcli.software.vib.remove <<<< ($false, $true, $false, $true, $_.Name)}

        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

        + FullyQualifiedErrorId : MethodInvocationException

    PS C:\Users\Administrator> $hpams |  ForEach { $esxcli.software.vib.remove($null, $true, $false, $true, $_.Name)}

    Missing required parameter --vibname

    At line:1 char:48

    + $hpams |  ForEach { $esxcli.software.vib.remove <<<< ($null, $true, $false, $true, $_.Name)}

        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

        + FullyQualifiedErrorId : MethodInvocationException



  • 8.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 10:41 AM

    Can you try like this ?

    Get-VMHost | %{

        $esxcli = Get-EsxCli -VMHost $_

        $esxcli.software.vib.list() | Where { $_.Name -like “*scsi-megaraid-sas*”} | %{

            $esxcli.software.vib.remove($false, $false, $false, $true, @($_.Name))

        }

    }



  • 9.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 10:51 AM

    No luck ... LucD...



  • 10.  RE: remove software vib via connecting vcenter
    Best Answer

    Posted Apr 22, 2015 10:57 AM

    One more variation, $null for the first parameter

    Get-VMHost | %{

        $esxcli = Get-EsxCli -VMHost $_

        $esxcli.software.vib.list() | Where { $_.Name -like “*scsi-megaraid-sas*”} | %{

            $esxcli.software.vib.remove($null, $false, $false, $true, @($_.Name))

        }

    }



  • 11.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 11:02 AM

    i already tried with $null ... same issue .



  • 12.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 11:15 AM

    I'm out of ideas for now I'm afraid.

    I'll have to do some experimenting in my lab this evening.



  • 13.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 11:20 AM

    Hmmmm.. do post me if you find my fix on you lab experimenting .. meanwhile i will do from my end ... let see ..

    LucD :- Thanks for your prompt reply



  • 14.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 09:18 PM

    Been playing with this on a test ESXi node in my lab, and for me this seems to work (while connected to the vCenter).

    In fact, I wasn't able to reproduce the issue you are seeing.

    I have no idea at this time why you're seeing the error.

    Do you have another box where you could install PowerCLI, and try from there ?



  • 15.  RE: remove software vib via connecting vcenter

    Posted Apr 22, 2015 09:51 PM

    are you using same command $esxcli = Get-VMHost | Get-EsxCli   


    to get the esxcli right ?



  • 16.  RE: remove software vib via connecting vcenter

    Posted Apr 23, 2015 04:49 AM

    In this case I used

    $esxcli = Get-EsxCli -VMHost MyEsx



  • 17.  RE: remove software vib via connecting vcenter

    Posted Apr 23, 2015 09:02 PM

    Thanks Lucd ... Working fine on my other box ...

    Thanks once again ...