VMware Cloud Community
paullee92
Enthusiast
Enthusiast

Script failure prompt

Hi All,

I trying to execute a script as per below link to collect NIC and HBA driver firmware version:

https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Powercli-Script-to-get-FW-and-driver-v...

But When i run the script, got got a prompt as per below:

___________________________________________________________________________________________

Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.EsxCli.EsxCliElementImpl] does not contain a method named 'list'.

At line:11 char:21

+    foreach ($nic in $esxcli.network.nic.list()) {

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

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

    + FullyQualifiedErrorId : MethodNotFound

 
Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.EsxCli.EsxCliElementImpl] does not contain a method named 'list'.
At line:11 char:21
+ foreach ($nic in $esxcli.network.nic.list()) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (list:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

______________________________________________________________________________________________

Please advice how to solve this

Reply
0 Kudos
8 Replies
paullee92
Enthusiast
Enthusiast

I have added invoke() after $esxcli.network.nic.list

foreach ($nic in $esxcli.network.nic.list.invoke())foreach ($nic in $esxcli.network.nic.list.invoke())

Now the script is working fine.

But the csv file export for nic, it only content Hotname,and NICName details.

But NICDriver NICDriver-Version NICFirmware-VersionNICDriver NICDriver-Version NICFirmware-Version all colums are empty

Tags (1)
Reply
0 Kudos
paullee92
Enthusiast
Enthusiast

The script working fine after I have changed the below value:

NICDriver NICDriver-Version NICFirmware-VersionNICDriver NICDriver-Version NICFirmware-Version 

To

@{N = "NICDriver"; E = {$nic.Driver}},

 

   @{n = "NICDriver-Version"; E = {$Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name}).driverinfo.Version}},

 

   @{N = "NICFirmware-Version"; E = {$Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name}).driverinfo.FirmwareVersion}} 

   

   }

 

 

   $reportHba += $esxcli.Storage.san.fc.list.Invoke()|

 

  select @{N = 'HostName'; E = {$esxcli.VMHost.Name}},

 

  Adapter, DriverName, DriverVersion, FirmwareVersion, hardwareVersion, PortState

 

}

 

 

 

$reportNic | Export-Csv -Path C:\Temp\Host\reportNic.csv -NoTypeInformation -UseCulture

@{N = "NICDriver"; E = {$nic.Driver}},

@{n = "NICDriver-Version"; E = {$Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name}).driverinfo.Version}},

@{N = "NICFirmware-Version"; E = {$Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name}).driverinfo.FirmwareVersion}}

}


$reportHba += $esxcli.Storage.san.fc.list.Invoke()|

select @{N = 'HostName'; E = {$esxcli.VMHost.Name}},

Adapter, DriverName, DriverVersion, FirmwareVersion, hardwareVersion, PortState

}


$reportNic | Export-Csv -Path C:\Temp\Host\reportNic.csv -NoTypeInformation -UseCulture

Reply
0 Kudos
paullee92
Enthusiast
Enthusiast

If i put only one server on the notepad, then the entire script working fine.

If i put more that one server in the notepad for an example

ServerA

ServerB

ServerC

I getting error as per below:

__________________________________________________________________________________________

 

   

Get-EsxCli : 19-Apr-22 4:22:50 PMGet-EsxCliCould not find VMHost with name 'ServerC'.

At line:9 char:14

+    $esxcli = Get-EsxCli -VMHost $esxhosts -V2

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

    + CategoryInfo          : ObjectNotFound: (ServerC:String) [Get-EsxCli], VimException

    + FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.Ge 

   tEsxCli

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Get-EsxCli : 19-Apr-22 4:22:53 PMGet-EsxCliCould not find VMHost with name 'ServerC'.

At line:9 char:14

+    $esxcli = Get-EsxCli -VMHost $esxhosts -V2

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

    + CategoryInfo          : ObjectNotFound: (ServerC:String) [Get-EsxCli], VimException

    + FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.Ge 

   tEsxCli

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Get-EsxCli : 19-Apr-22 4:22:56 PMGet-EsxCliCould not find VMHost with name 'ServerC'.

At line:9 char:14

+    $esxcli = Get-EsxCli -VMHost $esxhosts -V2

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

    + CategoryInfo          : ObjectNotFound: (ServerC:String) [Get-EsxCli], VimException

    + FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.Ge 

   tEsxCli

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the 

"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."

At line:13 char:4

+    $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...

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

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

 

PS C:\> 



Get-EsxCli : 19-Apr-22 4:22:50 PM Get-EsxCli Could not find VMHost with name 'ServerC'.
At line:9 char:14
+ $esxcli = Get-EsxCli -VMHost $esxhosts -V2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (ServerC:String) [Get-EsxCli], VimException
+ FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.Ge
tEsxCli

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Get-EsxCli : 19-Apr-22 4:22:53 PM Get-EsxCli Could not find VMHost with name 'ServerC'.
At line:9 char:14
+ $esxcli = Get-EsxCli -VMHost $esxhosts -V2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (ServerC:String) [Get-EsxCli], VimException
+ FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.Ge
tEsxCli

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Get-EsxCli : 19-Apr-22 4:22:56 PM Get-EsxCli Could not find VMHost with name 'ServerC'.
At line:9 char:14
+ $esxcli = Get-EsxCli -VMHost $esxhosts -V2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (ServerC:String) [Get-EsxCli], VimException
+ FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.EsxCli.Ge
tEsxCli

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "0", with value: "System.Collections.Hashtable", for "Get" to type "System.Int32": "Cannot convert the
"System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Int32"."
At line:13 char:4
+ $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

PS C:\>

Reply
0 Kudos
LucD
Leadership
Leadership

Try this version

$esxhosts = Get-Content C:\scripts\hostname.txt
$reportNic = @()
$reportHba = @()

foreach ($esx in $esxhosts) {
    $esxcli = Get-EsxCli -VMHost $esx -V2
    foreach ($nic in $esxcli.network.nic.list.Invoke()) {
        $reportNic += $Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name }).driverinfo |
        Select-Object @{N = "HostName"; E = { $esxcli.VMHost.Name } },
        @{N = "NICName"; E = { $nic.Name } },
        @{N = "NICDriver"; E = { $NicInfo.Driver } },
        @{n = "NICDriver-Version"; E = { $NicInfo.Version } },
        @{N = "NICFirmware-Version"; E = { $NicInfo.FirmWareVersion } } #|Export-Csv -Path C:\Scripts\NIC-Drive-FW.csv
    }

    $reportHba += $esxcli.Storage.san.fc.list.Invoke() |
        Select-Object @{N = 'HostName'; E = { $esxcli.VMHost.Name } },
        Adapter, DriverName, DriverVersion, FirmwareVersion, hardwareVersion, PortState
}


$reportNic | Export-Csv -Path .\reportNic.csv -NoTypeInformation -UseCulture
$reportHba | Export-Csv -Path .\reportHba.csv -NoTypeInformation -UseCulture


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

Reply
0 Kudos
LucD
Leadership
Leadership

I updated the typo in the other thread as well


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

Reply
0 Kudos
bikashyadav
Contributor
Contributor

HI LucD,

 

Not able to locate the value for variable $NicInfo. Do i need to update somewhere as

$NicInfo=$Esxcli.network.nic.get.Invoke(@{nicname = $nic.Name }).driverinfo

 

Thanks

Bikash

Tags (1)
Reply
0 Kudos
LucD
Leadership
Leadership

How did you run the script?
What does the error message state exactly? 


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

Tags (1)
Reply
0 Kudos
bikashyadav
Contributor
Contributor

It didn't give any error. Only thing is the output file value is blank for NICDriver, NICDriver-Version and NICFirmware-Version.

Reply
0 Kudos