VMware Cloud Community
sachdeva_2007
Contributor
Contributor

NIC/VMTool/Hardware Detail Along With OS Version

please help me with the script to put the required info.

Run the below command but couldn't't join the OS version with NIC Version.

$vms=Get-View -ViewType VirtualMachine

$(

foreach($vm in $vms){

$networkcards=$vm.guest.net | ?{$_.DeviceConfigId -ne -1}

""|select  @{n="VM name";e={$vm.name}},@{n="uuid";e={$vm.config.uuid}},

@{n="Net_info";e={[string]::join(',',  $($networkcards|%{$devid=$_.DeviceConfigId;[string]::join

(',',$(($vm.config.hardware.device|?{$_.key  -eq $devid}).gettype().name,$_.network,($_.ipaddress -join ';'),

$_.Macaddress))})  )}}

}  Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName") |

Select -Property Name, @{N="Configured OS";E={$_.Config.GuestFullName}},  @{N="Running OS";

E={$_.Guest.GuestFullName}}

)

0 Kudos
1 Reply
LucD
Leadership
Leadership

You can do like this.

But I'm not sure what info, besides the MacAddress, you want to see for the network cards.

The code you listed is not making that clear to me.

Get-View -ViewType VirtualMachine |

Select  @{N="VM name";E={$_.Name}},

        @{n="uuid";e={$_.config.uuid}},

        @{N="MacAddress";E={($_.Guest.Net | Select -ExpandProperty MacAddress) -join ',' }},

        @{N="Configured OS";E={$_.Config.GuestFullName}},

        @{N="Running OS";E={$_.Guest.GuestFullName}}


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

0 Kudos