Hi,
Please help, I am unable to get the MAC, Duplex, MTU, Speed, Model, there is no error but shows blank
function Get-NICDetails {
[CmdletBinding()]
param(
[Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)]
[ValidateNotNullorEmpty()]
[String] $Clustername
)
Begin {
$Validate = $True
if (($myCluster = Get-Cluster -Name $Clustername).count -lt 1) {
$Validate = $False
thow "No Cluster '$myCluster' found!"
}
}
Process {
$MyView = @()
if ($Validate -eq $True) {
foreach ($myVMhost in ($myCluster | Get-VMHost)) {
$esxcli2 = Get-ESXCLI -VMHost $myVMhost -V2
$niclist = $esxcli2.network.nic.list.invoke()
$nicdetails = @()
foreach ($nic in $niclist) {
$args = $esxcli2.network.nic.get.createargs()
$args.nicname = $nic.name
$nicdetail = $esxcli2.network.nic.get.Invoke($args)
$nicdetails += $nicdetail
}
ForEach ($nicdetail in $nicdetails){
$NICReport = [PSCustomObject] @{
Host = $myVMhost.Name
Version = $myVMhost.version
Host_Manufacturer = $myVMhost.Manufacturer
Host_Model = $myVMhost.Model
SerialNumber = $myVMhost.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |Where-Object {$_.IdentifierType.Key -eq "Servicetag"} |Select-Object -ExpandProperty IdentifierValue
vmnic = $nicdetail.Name
MAC = $nicdetail.MACAddress
LinkStatus = $nicdetail.LinkStatus
BusInfo = $nicdetail.driverinfo.BusInfo
Duplex = $nicdetail.Duplex
MTU = $nicdetail.MTU
Speed = $nicdetail.Speed
Model = $nicdetail.Description
Driver = $nicdetail.driverinfo.Driver
FirmwareVersion = $nicdetail.driverinfo.FirmwareVersion
DriverVersion = $nicdetail.driverinfo.Version
}
$MyView += $NICReport
}
}
$MyView
}
}
}