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
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
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
Thanks for the speedy reply Luc.
Do you know if this is on the roadmap to be fixed for a future build?
Maish
I don't know, remember I'm not VMW staff 🙂
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference