How to get the SCCM application’s dependency and supersedence details using PowerShell.

As part of the SCCM housekeeping activity, we need to retire the SCCM applications that are not used. To retire the SCCM application we need to check the application’s dependency and supersedence information. Fetching dependency and supersedence information using PowerShell/SCCM cmdlet is a bit difficult process as there is no direct property available to call the details on the get-cmapplication cmdlet. But we can refer to the  “SDMPackageXML” property where all this information is available in a serialized XML format.

As the information is in an XML format, we need to deserialize the XML to read the information properly. Please follow the below steps to get the SCCM application dependency and supersedence information through PowerShell

How to get Application Dependency 

Below is the property of an application in the SCCM console (Adobe Reader DC 11)

Once we select the application, then go to the deployment tab property to get the application dependency as shown below. As per the below example, “Acrobat Reader DC 10” is the dependent application

Below is the PowerShell cmdlet to get the application details.

Get-CMApplication "Adobe Reader 11.0.0.0"

Please note the “SDMPackageXML” property from the below result.

Now we need to deserialize the XML format to read the information easily.

Serializes or deserializes an application between the C# instance and the XML format, see the below link for more information.
https://docs.microsoft.com/en-us/previous-versions/system-center/developer/jj154378(v%3Dcmsdk.12)

$XMLDeS = [Microsoft.configurationmanagement.applicationmanagement.serialization.sccmserializer]::DeserializeFromString($Application.SDMPackageXML,$true)
$XMLDeS = [Microsoft.configurationmanagement.applicationmanagement.serialization.sccmserializer]::DeserializeFromString($Application.SDMPackageXML,$true)
$XMLDeS.DeploymentTypes

From the below result, we can see the application dependency and supersedence information.

The information which is required for us is inside the “Operands ” property. Go to operands property using the below cmdlet.

$XMLDeS.DeploymentTypes.dependencies.Expression.Operands

From the above information, we can see the dependent application information, but the problem is Instead of the application name we got the application scope ID and Application logical name. Now the question is how do we get the application information using scope ID and Logical Name? It is easy as we can see the application scope ID and the logical name is visible in get-cmapplication property.

From the below example we can see both information is available in the “Model” property in a combined format using a forward slash (/)

Get-CMApplication "Adobe Reader 11.0.0.0"

Now we need to join the application scope ID and logical name to search the application using the model name, follow the below cmdlet

$GetModel = $XMLDeS.DeploymentTypes.dependencies.Expression.Operands 
$ModelName = $GetModel.DeploymentTypeAuthoringScopeId + '/' + $GetModel.ApplicationLogicalName
$ModelName

As per the above example, we got the application model name, now we need to search the application using get-cmapplication cmdlet as showing below

Get-CMApplication | Where-Object {$_.ModelName -eq"$ModelName"}

Now we will get the dependency application name

Application Supersedence.

Below is the application supersedence option of an application from SCCM Console  (Right-click on the application)

We need to follow the same steps here to deserialize the XML format

$XMLDeS = [Microsoft.configurationmanagement.applicationmanagement.serialization.sccmserializer]::DeserializeFromString($Application.SDMPackageXML,$true)
$XMLDeS.DeploymentTypes

From the below result, we can see application supersedence information.

We need to select the supersedence option to see more details as shown below.

$XMLDeS.DeploymentTypes.supersedence

vivekrr.com

We need to filter the expression property to identify the superseded application’s name as shown below.

$XMLDeS.DeploymentTypes.supersedence.expression.

Now we need to follow the same process used to get the dependency application name here.

Since we are expecting multiple supersedence for the same application, we need to pass the application through a Foreach loop as shown below to fetch all the superseded application list

 

We got the two supersedence application details with a semicolon-separated value

Download the script