High priority SCCM applications

This post is about getting all high priority SCCM applications using PowerShell. Today I had to check our server how many applications are set to High (Distribution Priority). The customer has a total of 40 distribution points (pull and push) all over the world and configured sophisticated BITS rules and schedules. Therefore, ConfigMgr only replicates high priority applications using higher bandwidth.

Screenshot of high priority in GUI

How to get the application properties

Now, to get information about SCCM applications, there’s a simple cmdlet available: “Get-CMApplication“. But the result is rather disappointing if you’re looking for advanced properties like “InstallCommandLine”, “DetectAction” or “Priority”.

ConfigMgr stores all those properties in an XML string “SDMPackageXML”.

Screenshot of SDMPackageXML string

We need to first deserialize this string and filter the results to match the xml tag “HighPriority”. Therefore assign a variable to the Get-CMApplication so that you can access the SDMPackageXML property and send the value to a text file.

Open up the TXT file and copy-paste the contents to one of the XML beautifiers out there. As a result the XML code is much easier to read. Disassembling the structure is a piece of cake now.

Screenshot of SDMPackageXML string beautified

Type accelerators (like [version]) come in very handy. [xml] helps accessing a specific tag within any XML string. You can use the XML hierarchy like a method or a property on an object. Enclose the whole variable in parenthesis and put the [xml] in front. Then use the structure we just found out to grab the appropriate value, which results in HighPriority = 1 in this example.

high priority sccm applications

The final script to find high priority sccm applications

The final script to find all high priority sccm applications and more looks like this:

Save the code to a file called “Get-ITBApplicationDistributionPriority.ps1” and use dot sourcing to make the function available to your session. After that use the function like any other cmdlet.

Example:

This will create text files for each priority type containing the application names of all “Ultra*” apps on CM1. I chose text files because it’s simple and allows me to process them later easily.

Maybe I will blog part 2 on how to set all high priority apps to medium.

2 thoughts on “High priority SCCM applications”

    • Actually you should get a text file for each priority type.

      I think you missed the “dot sourcing” part. Read the article carefully.
      If you run the script, nothing happens because the script contains a function. You need to load that function first, then you can use it. Run 2 commands:

      1. Load the function:
      . .\Get-ITBApplicationDistributionPriority.ps1
      (note the two dots)

      2. Run the new command:
      Get-ITBApplicationDistributionPriority -SiteCode “CM1” -Name “Ultra*”
      (run from a writable folder on your C:\ drive)

      Reply

Leave a Comment