Greetings,
I need to get a list of all VM's
from my vCenter infrastructure.
I tried the get-vm Powershell but
it didn't get my custom fields properly.
How can I get a list of
all VM's on my Servers including my custom (Notes, Dev Status, Bus
Owner) fields?
If it matters I am exporting it to a CSV file.
Furthermore,
how can I edit that CSV file and then upload the changes to my ESX's
You need to create an SQL query against the VPX_VM table in your vCenter DB.
Can you point me to a resource that would explain how to do that?
The most basic way is to use sqlcmd command line on SQL server. Run something like: sqlcm -S <ServerName> -d <DB Name> -E and once prompted run SQL queries (ex. select DNS_NAME,GUEST_STATE from VPX_VM).
You can use the Get-Annotation cmdlet for that.
Since I'm not sure in which format you want this listing I just wrote the values to the screen
foreach($vm in (Get-VM)){ $vm | Get-Annotation | %{ Write-Host $vm.Name $_.Name $_.Value } }
Let me know if you want another output format.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference