Try something like this
Import-CsvC:\vmnames.csv-UseCulture|%{ $vm=Get-VM-Name$_.vmName
$nicInfo=Get-VMGuestNetworkInterface-VM$vm
$row=""|SelectName,Host,OS,Thick,NicType,VLAN,IP,Gateway,Subnetmask,DNS,DNSSuffix,Tools,HWVersion,HotCPUAddEnabled,HotMemAddEnabled $row.Name=$vm.Name
$row.Host=$vm.Host.Name
$row.OS=$vm.Guest.OSFullName
$row.Thick= [string]::Join(',',(Get-Harddisk-VM$vm|Select-ExpandPropertyDiskType)) $row.NicType= [string]::Join(',',(Get-NetworkAdapter-VM$vm |Select-ExpandPropertyType)) $row.VLAN= [string]::Join(',',(Get-VirtualPortGroup-VM$vm|Select-ExpandPropertyVlanId)) $row.IP= [string]::Join(',',$vm.Guest.IPAddress) $row.Gateway= [string]::Join(',',($nicInfo|Select-ExpandPropertyDefaultGateway)) $row.Subnetmask= [string]::Join(',',($nicInfo|Select-ExpandPropertySubnetmask)) $row.DNS= [string]::Join(',',($nicInfo|Select-ExpandPropertyDns)) $row.DNSSuffix=&{ $nics=@(Get-WmiObject-ClassWin32_NetworkAdapterConfiguration-Filter"IPEnabled = 'True'"-ComputerName$vm.Guest.Hostname) [string]::Join(',',$nics[0].DNSDomainSuffixSearchOrder) } $row.Tools=$vm.ToolsVersionStatus
$row.HWVersion=$vm.Version
$row.HotCPUAddEnabled=$vm.ExtensionData.Config.CpuHotAddEnabled
$row.HotMemAddEnabled=$vm.ExtensionData.Config.MemoryHotAddEnabled
$row|Export-CsvC:\$($vm.Name).csv-NoTypeInformation-UseCulture
}
Note1: the Get-VMGuestNetworkInterface can be called without guest credentials if you are running with credentials that are allowed to logoon to the guest OS. If not, you will have to use the GuestUser and the GuestPassword parameters.
Note2: To obtain the DNS search suffixes, the script uses a WMI call. If a WMI is not allowed, the script will need to use an Invoke-VMScript cmdlet instead.
Note3: if the VMware Tools are not installed on a VM, some properties might not be available.