Automatically create device collections based on software metering rules

Automatically create device collections based on software metering rules

I had a lot of software  at a costumer which needed to be uninstalled automatically because of expensive licencing. I stumbled upon this article from systemcenterdudes where Nicolas Pilon have created queries and collections in SCCM containing exactly what i needed. Based on that article i created a powershell script to do that for me.

Define which metered files to define collections from

To limit the script not to create collections for every metered file, I choose to “tag” a metered file by typing “Licensed” in the description field. The Name field has to be the name from ARP/Appwiz.cpl as the field will be used for the collection query by the script.

See an example here of a tagged metered file:

If the ARP name of an appliccation has an variable to the name simply use a wildcard as show below on Visual Studio:

The script

The script have some variables that can be suited to your needs. The script will create the device collection folder that you have defined in $CollectionDevFolderName

Variables:

Running the script on the site server will create the examples as shown:

Outcome

Here is the collections created. Running the script again will skip the creation of existing collections.

Complete code

1 thought on “Automatically create device collections based on software metering rules”

Leave a comment