VMware Cloud Community
sgruttad
Contributor
Contributor

get VM Notes using powercli / powershell

Hi all, I am trying to retrieve the notes annotation from vcenter using powercli.  I can get it easily with get-vm.

However, I am trying to get it from get-view. In get-view output I cannot find a notes field. I do see the config annotations field, which returns the data, but the notes that come back wont input into my mysql database.

Does anyone know if there is someplace in get-view to get the notes back like get-vm?

Does anyone know what get-vm is transforming that might make the notes data digestible?

Ive tried replacing the notes using regex toi just normal characters but no joy.

Steve

0 Kudos
1 Reply
LucD
Leadership
Leadership

Not sure what the issue is, both properties are of type [string].
Could it be that you have multi-line notes?

Then just remove the <lf>

Get-View  -ViewType VirtualMachine |

Select Name, @{N = 'Notes'; E = { $_.Summary.Config.Annotation.Replace("`n", '') } }


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

0 Kudos