VMware Cloud Community
jessem
Enthusiast
Enthusiast
Jump to solution

Import annotations in vCenter

Hello,

I have a custom field in vcenter and I want to import info into this field.  The field is 'Chargeback Code'.  Here is a my csv.  Help please.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

Import-Csv devimport.csv  | %{
 
Get-VM -Name $_.VM | Set-Annotation -CustomAttribute 'Chargeback Code' -Value $_.'Chargeback Code'
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

Import-Csv devimport.csv  | %{
 
Get-VM -Name $_.VM | Set-Annotation -CustomAttribute 'Chargeback Code' -Value $_.'Chargeback Code'
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
jessem
Enthusiast
Enthusiast
Jump to solution

Thanks...I will test.  Do I need to change the format of my csv file?  Does it look ok with the fields and variables I have in there?

Also, will this script make any changes to other VMs that don't have anything in the 'chargeback code' field?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I used the CSV you attached as the inpu file, so no, you don't have to change anything.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

jessem
Enthusiast
Enthusiast
Jump to solution

Once again LucD, it worked like a champ.  Many thanks :smileycool:

Reply
0 Kudos