- Configuration Items in Configuration Manager (SCCM, MECM) - Mon, Aug 22 2022
- Create and read SCVMM custom properties with PowerShell and the VMM Console - Mon, Apr 18 2022
- Prevent ransomware attacks on network shares with File Server Resource Manager (FSRM) - Mon, Mar 7 2022
Like VMware vSphere, SCVMM allows you to create custom properties to better filter through information about your virtual machines, hosts, and templates. For example, you could create a custom property to track the product of the virtual machine (i.e., VPS Level 1).
Manage SCVMM custom properties with the VMM Console
Launch the SCVMM. You can install the Virtual Machine Manager Console using the Microsoft SCVMM installer, which is available for download from the Microsoft Development Network (MSDN) or the Volume Licensing Service Center (VLSC).
Find a virtual machine to which you want to add a custom property. Right-click the virtual machine and select Properties.
The virtual machine properties will open. Select the Custom Properties section. You should see ten custom properties, labeled Custom1 through Custom10.
While you can, of course, add values to these properties, it is much more practical to create your own custom properties. Click the Manage Custom Properties button. From here, you can view custom properties that you've already created by object type, as well as assign new or existing custom properties to different objects. For this guide, we will focus on creating and assigning custom properties for the virtual machine object.
Click the Create button to create a new custom property for the virtual machine object. For this guide, enter the Department for the custom property name and click OK. Optionally, you can also add a description.
You should now see the custom property Department available to assign. Select the property under the column Available properties and click the Add button. You've now just assigned the custom property Department to the virtual machine object, and it is now available on all your VMs globally for you to assign values.
Click OK. You should now see a custom property named Department listed in the VM custom properties. Enter a value and click OK. For this guide, I will enter the value HR.
Click OK. You've now just added a custom property to your VM and assigned it a value—but where is it in the VMMC? Well, you need to add your newly created custom property as a column to display in the VM grid. Right-click any of the column headers and select your newly created property. You should now see your newly created custom property in the VM grid.
Now let's say you want to search for VMs that are used by the HR department. In the search bar, enter with quotes "Department: HR". Sure enough, when you enter "Department: HR", the VMs assigned the value HR for the custom property Department are returned as a result.
From the Manage Custom Properties setting, you can also perform several other functions, such as renaming custom properties and unassigning custom properties from objects.
Create SCVMM custom properties with PowerShell
Now, if you're like me, you tend to do most of your administrative tasks using PowerShell. Fortunately, SCVMM comes with several PowerShell cmdlets you can use to manage custom properties. Note that you need the VMMC installed on the workstation or server you use to run these commands.
Let's start by opening the PowerShell ISE and creating a new custom property called Cost Center for all our VMs. Enter the following command:
New-SCCustomProperty -Name "Cost Center" -AddMember VM
The -Member switch specifies which object to add the custom property to (VM, Template, VM Host, etc.).
New-SCCustomProperty -Name "Cost Center" -AddMember VM
If the command is successful, you will see output like this:
Additionally, you should now see the custom property Cost Center available for use in the VMMC.
Now, let's pick a VM and assign a value to this custom property. Enter the following command:
Set-SCCustomPropertyValue -InputObject (Get-SCVirtualMachine -Name "US-GLOBAL-03") -CustomProperty (Get-SCCustomProperty -Name "Cost Center") -Value "IT001"
The Get-VirtualMachine -Name "US-GLOBAL-03" command is required to properly convert the VM name to a readable format—as standard quotation marks will not work. The same requirement exists when specifying a custom property to assign a value. If the command is successful, you will see output like this:
Additionally, you should now see the custom property Cost Center with the value IT001 added your VM—in my case, the VM US-GLOBAL-03:
Read SCVMM custom properties with PowerShell
To read the custom property Cost Center, enter the following command:
Finally, let's remove the custom property Cost Center from the VMMC altogether. Enter the following command:
Remove-SCCustomProperty -CustomProperty (Get-SCCustomProperty -Name "Cost Center")
The Get-SCCustomProperty -Name "Cost Center" command is required to convert the custom property properly to a readable format. If the command is successful, you will see output like this:
Additionally, the custom property Cost Center will no longer be available/visible in the Virtual Machine Manager Console.
Subscribe to 4sysops newsletter!
You can use these and other SCVMM cmdlets to write PowerShell scripts to create, add, and remove custom properties and values for multiple VMs and other object types.
Join the 4sysops PowerShell group!
Your question was not answered? Ask in the PowerShell forum!