VMware Cloud Community
Munster99
Enthusiast
Enthusiast
Jump to solution

help reqd with the 'get-customattribute' cmdlet

Hey all

Can anyone help me with the cmdlet above pls?

What I'm trying to do is simply do a search in our VC against certain 'custom attributes' and confirm the VMs associated with them.

(i.e. custom attribute 'RED' has a VM servers called 'SERVER1,SERVER2 etc.')

i've tried to find the objects associated with this and all i get is the following objects:

ServerId
Server
Key
Name
TargetType
Uid
Client

So how can i use these to get something that reports back a VM servernames ???

As usual - Many thanks in advance for your help

Munster99

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Sure, try it like this

Get-VM | Get-Annotation -CustomAttribute "Red" | Where {$_.Value}


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Not sure I "get" the question, but do you mean something like this

Get-VM | Get-Annotation -CustomAttribute "Red"


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

0 Kudos
Munster99
Enthusiast
Enthusiast
Jump to solution

thanks LucD

Wow, is that it ??? (I love powercli).

I've noticed it brings back ALL the entries is there a way to filter out the ones with no value please ?

munster99

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Sure, try it like this

Get-VM | Get-Annotation -CustomAttribute "Red" | Where {$_.Value}


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

0 Kudos
Munster99
Enthusiast
Enthusiast
Jump to solution

As per usual LucD your a life saver !

thanks

munster99

0 Kudos