VMware Cloud Community
vihar1
Enthusiast
Enthusiast
Jump to solution

Gather NIC information via PowerCLI

Hello All,

we need to gather the following information about all NICs in all hosts via PowerCLI:

- name

- manufacturer

- driver version

- firmware version

- MAC address

We know the esxcli method but it would take an awful lot of time as we have many hosts and they would send an alarm for disabling lockdown mode and enabling SSH so it would be extremely time-consuming and ineffective.

While googling we've found this method via Get-EsxCLI (http://jreypo.wordpress.com/tag/powercli/) but for some reason I cannot even list the NICs.

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> $esxcli = Get-EsxCli -vmhost Host

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> $esxcli.system.module.get

TypeNameOfValue     : VMware.VimAutomation.ViCore.Util10Ps.EsxCliExtensionMethod

OverloadDefinitions : {vim.EsxCLI.system.module.get.ModuleDetails get(string module)}

MemberType          : CodeMethod

Value               : vim.EsxCLI.system.module.get.ModuleDetails get(string module)

Name                : get

IsInstance          : True

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> $esxcli.system.module.list

TypeNameOfValue     : VMware.VimAutomation.ViCore.Util10Ps.EsxCliExtensionMethod

OverloadDefinitions : {vim.EsxCLI.system.module.list.Module[] list(boolean enabled, boolean loaded)}

MemberType          : CodeMethod

Value               : vim.EsxCLI.system.module.list.Module[] list(boolean enabled, boolean loaded)

Name                : list

IsInstance          : True

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> $esxcli.network.nic.list

TypeNameOfValue     : VMware.VimAutomation.ViCore.Util10Ps.EsxCliExtensionMethod

OverloadDefinitions : {vim.EsxCLI.network.nic.list.Nic[] list()}

MemberType          : CodeMethod

Value               : vim.EsxCLI.network.nic.list.Nic[] list()

Name                : list

IsInstance          : True

Can anyone help me? Thanks in advance!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Add parenthesis to the method call

$esxcli.network.nic.list()


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

View solution in original post

0 Kudos
5 Replies
kunaludapi
Expert
Expert
Jump to solution

I hope this helps you.

vGeek: PowerCLI esxi host Physical nic info in nice table format

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
LucD
Leadership
Leadership
Jump to solution

Add parenthesis to the method call

$esxcli.network.nic.list()


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

0 Kudos
vihar1
Enthusiast
Enthusiast
Jump to solution

Thanks guys.

I want to query an advanced option without success:

$esxcli.system.settings.advanced.list("Net.UseHwTSO")

The remote server returned an error: (500) Internal Server Error.

At E:\vm\PowerCli scripts\esxcli.ps1:10 char:1

+ $tsostate = $esxcli.system.settings.advanced.list("Net/UseHwTSO")

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationStopped: (:) [], ViError

    + FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.ViError

As I understand from its help:

Value               : vim.EsxCLI.system.settings.advanced.list.SettingsAdvancedOption[]

                      list(string option, string tree)

Option should be the whole option (-o on console) and tree is the main category (here: net)

$esxcli.system.settings.advanced.list("Net.UseHwTSO","Net")

The remote server returned an error: (500) Internal Server Error.

At line:1 char:1

+ $esxcli.system.settings.advanced.list("Net.UseHwTSO","Net")

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationStopped: (:) [], ViError

    + FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.ViError

I am missing something here I think, can you help me out?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you try with

$esxcli.system.settings.advanced.list("/Net/UseHwTSO")


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

vihar1
Enthusiast
Enthusiast
Jump to solution

I missed the root slash, thank you!

0 Kudos