VMware Cloud Community
tianhailong666
Enthusiast
Enthusiast
Jump to solution

how to export ESX host module using PowerCLI or other way for vSphere ESX 4.0 host

Dear all,

I have write a  powercli script which can gen ESX host module info,  but below are listed some errors when I run in my environment ( my environment is very large, it includes several VC and thousands of ESXi host which version have from ESX4.0 to ESX5.5.)   I check some other reply that the error was caused by ESX 4.0 host in my current environment(ESX 4.0 is not support for get-esxcli ).   somebody could to double check it? and have any good method to gen ESX 4.0 host module info via powercli or other ways?   I am looking forward to your kindly reply, thanks.

@@

$vCenterServerList = "10.235.117.97","10.235.127.66"

foreach($vCenterServer in $vCenterServerList) {

Connect-VIServer -Server $vCenterServer -User zhulei -Password "******"

$vmhosts = Get-VMHost

$result = @()

foreach( $vmhost in $vmhosts ){

$esxcli = get-esxcli -vmhost $vmhost

$result += $EsxCli.software.vib.list() | where {$_.Name -match "megaraid-sas"} | select Name,Version,Vendor,CreationDate,@{n="VMhost";e={$vmhost.name}}
#$result += $EsxCli.software.vib.list() | where {$_.Name -match "igb"} | select Name,Version,Vendor,CreationDate,@{n="VMhost";e={$vmhost.name}}
}
}

$resultexport-csv -path D:\megaraid_modules_all.csv -notype


Error

Name Port User
---- ---- ----
10.235.117.97 443   zhulei
Get-EsxCli : 2016/8/31 11:00:37    Get-EsxCli        Message: An error occurred while communicating with the remote host.;

InnerText:   

;
InnerText:    
所在位置 D:\PowerCLI\get_ESXiModule.ps1:17 字符: 23
+         $esxcli = get-esxcli <<<<  -vmhost $vmhost
    + CategoryInfo : NotSpecified: (:) [Get-EsxCli], HostCommunication
    + FullyQualifiedErrorId : Client20_DynamicTypeManagerServiceImpl_GetMoInstances_ViError,VMware.VimAutomation.ViCore.Cmdlets.Co
   mmands.GetEsxCli

不能对值为空的表达式调用方法。
所在位置 D:\PowerCLI\get_ESXiModule.ps1:19 字符: 39
+         $result += $EsxCli.software.vib.list <<<< () | where {$_.Name -match "megaraid-sas"} | select Name,Version,Vendor,Creatio
nDate,@{n="VMhost";e={$vmhost.name}}
    + CategoryInfo : InvalidOperation: (list:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull


0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Afaik, the current POwerCLI version (6.3R1) only goes back to ESX 5.0.

See the VMware Product Interoperability Matrixes


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

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

Afaik, the current POwerCLI version (6.3R1) only goes back to ESX 5.0.

See the VMware Product Interoperability Matrixes


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

0 Kudos