VMware Cloud Community
workingengg
Contributor
Contributor
Jump to solution

remove software vib via connecting vcenter

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 ...

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

    }

}


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

View solution in original post

Reply
0 Kudos
16 Replies
LucD
Leadership
Leadership
Jump to solution

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

remove.png

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)

    }

}


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

Reply
0 Kudos
workingengg
Contributor
Contributor
Jump to solution

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

hpams issue.jpg

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)

    }

}


hpams issue1.jpg

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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*”}


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

Reply
0 Kudos
workingengg
Contributor
Contributor
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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 ?


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

Reply
0 Kudos
workingengg
Contributor
Contributor
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

    }

}


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

Reply
0 Kudos
workingengg
Contributor
Contributor
Jump to solution

No luck ... LucD...

luc.jpg

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

    }

}


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

Reply
0 Kudos
workingengg
Contributor
Contributor
Jump to solution

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

nullluc.jpg

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

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


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

Reply
0 Kudos
workingengg
Contributor
Contributor
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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.

vib-remove.png

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 ?


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

Reply
0 Kudos
workingengg
Contributor
Contributor
Jump to solution

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


to get the esxcli right ?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

In this case I used

$esxcli = Get-EsxCli -VMHost MyEsx


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

workingengg
Contributor
Contributor
Jump to solution

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

Thanks once again ...

Reply
0 Kudos