Automation

 View Only
  • 1.  Export VM with Datastore and Datastore Cluster name

    Posted Sep 20, 2021 01:13 PM

    Hello

    This prints perfectly, but cannot export if I do export-csv (it doesn't input any information) 

    How can I export? 

     

    Thanks



  • 2.  RE: Export VM with Datastore and Datastore Cluster name
    Best Answer

    Posted Sep 20, 2021 01:17 PM

    The foreach statement doesn't place anything in the pipeline.
    You can rewrite that code to use the pipeline.



  • 3.  RE: Export VM with Datastore and Datastore Cluster name

    Posted Sep 20, 2021 01:22 PM

    Thanks!!!  

    I thought foreach was required if we wanted to go through the list 



  • 4.  RE: Export VM with Datastore and Datastore Cluster name

    Posted Sep 20, 2021 01:25 PM

    Not really, if you place an array in the pipeline, the ext cmdlets will take those objects one-by-one.
    Kind of an implicit foreach.

    You can also use Foreach-Object, that does place objects in the pipeline