SCVMM does provide ten default custom properties (CustomProperty1-10). Like the custom properties of an AD object, objects in VMM can be enriched with information by adding data to those properties. Now there’s even more. You can define additional custom properties at will. So thinking about possible use cases I came along the following…
Wouldn’t it be nice if..
- VMM would show information about VM network adapter configuration like IP Address, Subnetmask, VLAN, etc?
You can actually do that using the custom properties on the various objects.
First we have to create new custom property objects and assign them to the object type “Virtual Machine” within SCVMM. This can be done using the GUI Console as well, but we’ll use good old Powershell 🙂
New-SCCustomProperty -Name "IPv4 Address" -Description "" -AddMember @("VM") New-SCCustomProperty -Name "IPv4 Mask" -Description "" -AddMember @("VM") New-SCCustomProperty -Name "VLAN" -Description "" -AddMember @("VM")
Next, we will add the new properties to our VM view
So how the hell we get the information pumped into VMM now? Well there are of course several ways we can use to get IP information from our guests. Again, R2 will add more power here as we have a connection to IPAM from SCVMM manage IP info centrally. For now I’ve decided to get the info via CIM. Therefore I created a Powershell script which does the following:
- -Get all Hyper-V Hosts in SCVMM (there are filter capabilities using script parameter)
- -Get Virtual Machine Class and associated network adapter object information via CIM
- -Read IPv4 Address and Netmask, get the VLAN ID from the VM network adapter
- -Pump the information into the apropriate custom properties of the VM objects within VMM
- -I just wrote it in a quick and dirty way, just to show how you could do stuff like this and how you can leverage the information content of VMM using custom properties.
The result can then look like this:
You can get a copy of the script here
Some other things..
- Whatever you like to put into custom properties, it has to be a [STRING]
- The script has issues with multihomed VMs
- You’ll use the script at your own risk