Quantcast
Channel: VMware Communities : Discussion List - Automation Tools
Viewing all articles
Browse latest Browse all 9071

Export multiple items of information to a single CSV file

$
0
0

Hi guys,

 

I'm trying to export information to a .csv file.  In the end I want the following information in the CSV with the following headers:

Name,NumCpu,MemoryMB,Description,NetworkName


I can get all the information for the first four headings (Name, NumCpu, MemoryMB, Description) with the following command:

Get-VM MYVM | select Name, NumCpu, MemoryMB, Description | Export-Csv -path "c:\outp\VMs.csv" -NoTypeInformation

 

To get the VLAN (aka NetworkName) I run the following command:

 

Get-VM MYVM | Get-NetworkAdapter | select NetworkName | Export-Csv "c:\output\VMs.csv" -NoTypeInformation

 

The command run successfully, however the second command is overwriting the information from the first one.  I have tried the -append switch which gives an error suggesting I use -force, which I have also tried, but the best I have been able to achieve is all the information being exported, but with unwanted spaces.  Is there an easy way to consolidate these two commands and export them to the csv file on the same line?

 

Thanks.


Viewing all articles
Browse latest Browse all 9071

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>