Hi there,
i think i did not understand all requirements, or they were not described correctly but what i understood is:
data needed: uuid, vm name,network name, mac, ip
what do you mean by adapter type , do want to have info about e1000,vmxnet etc ??
--
$vms=get-view -viewtype virtualmachine -filter @{"name"="myvm1"}
foreach($vm in $vms){
$networkcards=$vm.guest.net
""|select @{n="VM name";e={$vm.name}},@{n="uuid";e={$vm.config.uuid}},@{n="net info";e={[string]::join(',', $($networkcards|%{[string]::join(',',$($_.network,$_.ipaddress,$_.Macaddress))}) )}}
}
--
try this first out for 1 vm where : "myvm1" should be change to some existing vm in your infra. If all is good , run this
$vms=get-view -viewtype virtualmachine
foreach($vm in $vms){
$networkcards=$vm.guest.net
""|select @{n="VM name";e={$vm.name}},@{n="uuid";e={$vm.config.uuid}},@{n="net info";e={[string]::join(',', $($networkcards|%{[string]::join(',',$($_.network,$_.ipaddress,$_.Macaddress))}) )}}
}
Greg
If you want that type card e1000,vmxnet etc.. you can try it like this
$vms=get-view -viewtype virtualmachine
foreach($vm in $vms){
$networkcards=$vm.guest.net
""|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,$_.Macaddress))}) )}}
}
i forgot about the csv at the end so:
$(
foreach($vm in $vms){
$networkcards=$vm.guest.net
""|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,$_.Macaddress))}) )}}
}
)|export-csv c:\rep321.csv