Creating and Using Custom Properties in VMM 2012 in PowerShell (and a gotcha)

Custom properties, introduced in Virtual Machine Manager 2012 (VMM), consist of a user-defined name / value pair. They can be used in a variety of circumstances including

  • VM placement (or use of matching properties on host groups),
  • Reporting (by using custom properties to tag VM’s and services with various bits of owner information)
  • Lifecycle Management (through the addition of a custom property to store expiration date)
  • Customizing View in the VMM Admin Console (more on this in a minute)

While you can add custom properties in the UI, I like adding them to PowerShell, which I can incorporate into Orchestrator runbooks to automate the VM and service provisioning, tagging by virtualization assets to support all of the possibilities mentioned above. Below is a sample script demonstrating how to tag a service instance with information to support virtualization lifecycle management, specifically owner information (a RequestedBy property) and an ExpirationDate property to store the retirement date for the newly deployed asset.

Sample Script

PowerShell snow below intended for use in a VMM script, presumably as part of an Orchestrator runbook. The only thing you need to do make the sample work for you is define is the value of a variable called $SvcName, intended to represent the display name of the newly deployed service (from a service template)

Exposing Custom Properties in the UI

As alluded to earlier , in the VMs and Services pane of the VMM 2012 Admin Console,  custom properties can be exposed by right-clicking on the title bar and selecting the appropriate properties. below is a screenshot the results of the sample PowerShell snippet shown above use as part of a runbook to deploy a service  with VMM 2012.


Something to be aware of (Gotcha)

Custom attributes do not accept special characters, such as apostrophes, which I witnessed firsthand recently.  There is a bug in VMM 2012  that presents itself when certain special characters are used in custom attributes throughout the UI, causing the console to crash.  The fix should you encounter this problem is to remove the offending value via PowerShell or direct database edit, (through Microsoft support would recommend the PowerShell method).

Additional Resources

Hopefully this info provides some food for thought when choosing your naming conventions for your template-based deployments in VMM 2012. Here are a few additional articles in the ‘private cloud in the real world’ series and related System Center articles you may find interesting.

Orchestrator Jumpstart Series

One thought on “Creating and Using Custom Properties in VMM 2012 in PowerShell (and a gotcha)

  1. richard

    Does anyone know which management packs contain the custom properties fields?

    I am trying to use VMM custom properties in the service manager portal and cant find a class that seems to cover it.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.