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

PowerCLI Export and Import

$
0
0

Dear Community,

 

i want to export and import (after editing in excel) a csv file back to vCenter with PowerCLI.

The following information should be exported all in one line so i can easy edit the information in excel:

VM-Name, 2 different tags, 2 different categorys

For example virtualmachine1,

 

example how the csv should look:

virtualmachine1,"tag1","category1","tag2","category2"

virtualmachine2,"tag1","category1","tag2","category2"

and so on...

 

Here is what i got already but its not perfekt yet.

If you run this you dont get all the information needed in one line in the csv file. I need "category1" and "category2" not just "category"

I hope you understand what i mean, if not just run the script and check the export.

 

Get-tag | ForEach-Object {$Tag = $_;get-vm -Tag $_ | ForEach-Object {[pscustomobject]@{name=$_.name;tag=$Tag.name;Category=$tag.category}}} | Export-Csv -NoTypeInformation C:\temp\export.csv

 

And how can i import the csv file back after editing?

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 9071

Trending Articles



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