maishsk
Expert
Expert

Set-Annotation - Multiple items

Jump to solution

Hi all,

I was wondering is it possible to set multiple annotations on the same vm without having to repeat the set-annotation process.

For Example now I would do it like this

Get-VM | % {

set-annotation -Entity $_ -CustomAttribute "Attr1" -value "1"

set-annotation -Entity $_ -CustomAttribute "Attr2" -value "2"

}

Is there anyway of not having to repeat the set-annotation for each and every attribute? I cannot see how to pass a set of values to the CustomAttribute and values parameters.

Thanks in advance.

Maish

Maish Saidel-Keesing • @maishsk • http://technodrone.blogspot.com • VMTN Moderator • vExpert • Co-author of VMware vSphere Design
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

I'm afraid that is not possible with the current PowerCLI build.

Even stranger, the Get-Annotation cmdlet allows an array for the CustomAttribute parameter, while the Set-Annotation cmdlet does not allow an array (as you discovered).

I think the explanation is that the underlying Set-Field method also doesn't do multiple custom attributes in 1 call.


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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership

I'm afraid that is not possible with the current PowerCLI build.

Even stranger, the Get-Annotation cmdlet allows an array for the CustomAttribute parameter, while the Set-Annotation cmdlet does not allow an array (as you discovered).

I think the explanation is that the underlying Set-Field method also doesn't do multiple custom attributes in 1 call.


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

View solution in original post

0 Kudos
maishsk
Expert
Expert

Thanks for the speedy reply Luc.

Do you know if this is on the roadmap to be fixed for a future build?

Maish

Maish Saidel-Keesing • @maishsk • http://technodrone.blogspot.com • VMTN Moderator • vExpert • Co-author of VMware vSphere Design
0 Kudos
LucD
Leadership
Leadership

I don't know, remember I'm not VMW staff 🙂


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

0 Kudos