VMware Cloud Community
StuartB20111014
Enthusiast
Enthusiast

A trivial question, but I can't find the answer

Hi Everyone,

I am trying to create a report of all the VMs within a VCenter. Using the get-vm with select-object and sort-object is a quite easy one liner. However I have custom notes fields. I realise I can expand these using the expandproperty, but am still unable to get both the vm "standard properties, such as name, vcpu, memory AND the extended notes fields.

What am I missing. Here is what I have, sans the extended fields . It more serves to explain what I am doing as "Install date" is actually a custom field.

get-vm | select-object "name","Install date" | sort-object "Powerstate"

Cheers

Stu

0 Kudos
2 Replies
RvdNieuwendijk
Leadership
Leadership

Hi Stu,

you can get the annotations with the Get-Annotation cmdlet. Like this:

Get-VM | `
Select-Object Name,@{N="Install date";E={($_|Get-Annotation -CustomAttribute "Install date").Value}} | `
Sort-Object Powerstate

Regards, Robert

Message was edited by: RvdNieuwendijk

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
RParker
Immortal
Immortal

http://robware.net/

Try that, it will do what you want, much eaiser than using a script.

0 Kudos