Working with vCloud Metadata in PowerCLI – Part 1

Way back in 2012 Alan Renouf created a PowerCLI module to deal with manipulation of metadata entries for vCloud Director objects – this can be incredibly useful to track related information for these objects. The vCD metadata functionality was enhanced in v5.1 (and then later in 5.5, 5.6 and 8.0) – in particular typed values were added with functionality to use date/time, boolean and numeric values (as well as free-form string text). Also added were security levels so that metadata could be made read-only or hidden (from a tenant perspective) but still accessible/visible to system owners. I’ve taken the PowerShell module that Alan published here and updated it to cope with these enhancements. I’ve also updated the returned fields/views to include the extra attributes (where present) such as security levels of metadata entries.

Note that I am definitely not a professional developer (and most of my PowerShell knowledge comes from Google) so there’s probably significant room for improvement in the code – comment back if you have suggestions for improvement and I’ll update this post.

Use of the module requires a valid connection to a vCloud instance (using Connect-CIServer). This won’t work for versions prior to v5.1 (most of my testing has been with PowerCLI 6 against a v8 vCD deployment) so please use at your own risk and make sure you thoroughly test your own scenarios. I’ll write a follow-up post detailing some example code and usage scenarios which people may find useful in the next few days.

I’d suggest copy/pasting the code (below) into a PowerShell module (.psm1) file and including the module in your scripts as needed.

 

Welcome

I’ve been meaning to write a public blog for a while (ok, several years) now, but there always seemed to be something more important/urgent/fun to do so I never got around to it.

Having found out recently that my VMware vExpert status has been renewed for 2016 (Huge thanks guys!) I figured there really was no excuse not to and finally got off my behind to start up this site. I’m hoping to regularly update with code snippets and ramblings which I’m hoping other IT professionals will find useful – especially if working with VMware products in the service provider industry.

So why ‘kiwicloud.ninja’ ? Well, I work in the Cloud / Service Provider industry in New Zealand (so kiwicloud), and only found that the .ninja TLD was available when hunting around to register a DNS name for the site and thought it looked like fun – nothing more than that!

As always, the views and opinions expressed on this site reflect my own and not those of my employer (no, I’m not going to mention them here, but anyone who wants to will find them anyway).

Regards, Jon.