Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230663

Re: How to add export-csv in this simple script?

$
0
0

You could do the same in a more PowerShell-like fashion as follows

 

Get-VM-Name (Import-Csvc:\scripts\vms.csv)|
SelectName,@{N="cluster";E={Get-cluster-VM$_}} |
Export-Csv-NoTypeInformation-usecultureC:\scripts\vminfo1.csv

No need for the Foreach loop, use the PowerShell functionality to "loop" through all the objects that are placed on the pipeline.

The Name parameter on the Get-VM cmdlet accepts an array of names.


Viewing all articles
Browse latest Browse all 230663

Trending Articles



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