SCCM - Applications that supersede this application - powershell

Longquo 231 Reputation points
2021-01-28T12:54:20.527+00:00

Hi QA

is there a powershell way to extract the same information as the GUI

https://learn.microsoft.com/en-us/powershell/module/configurationmanager/get-cmdeploymenttypesupersedence?view=sccm-ps

61482-microsoftconfigurationmanagement-3isd2ipats.png

Goal is to retrieve the newer appl that supersed this older application before retirement process op the old one.

What cmdlets can be used to get this?

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Intune | Configuration Manager | Other
0 comments No comments
{count} votes

Accepted answer
  1. Longquo 231 Reputation points
    2021-01-30T22:38:52.937+00:00

    Came up with below sample to get the result not that fast but works.

    function Get-Supersededby
    {
        [CmdletBinding()]
        [Alias()]
        [OutputType([string])]
        Param
        (
            $Name
        )
    
        Begin
        {
        }
        Process
        {
            $Apps = Get-CMApplication -name "$(($Name -split ' ')[0])*" -Fast | Where-Object {$_.IsSuperseding -eq 'true' -and $_.LocalizedDisplayName -notlike $Name} | Select-Object -ExpandProperty LocalizedDisplayName
            $Result = @()
            foreach ($item in $Apps)
            {
                $DeploymentTypeNames = Get-CMDeploymentType -ApplicationName $item | Select-Object -ExpandProperty LocalizedDisplayName
                foreach ($DeploymentTypeName in $DeploymentTypeNames)
                {
                    $Supersedence = Get-CMDeploymentType -ApplicationName $item -DeploymentTypeName $DeploymentTypeName
                    $Supersedence = Get-CMDeploymentTypeSupersedence -InputObject $Supersedence
                    $AppModelNames = $Supersedence | Select-Object -ExpandProperty AppModelName
                    foreach ($AppModelName in $AppModelNames)
                    {
                        $Supersedes = Get-CMApplication -Fast | Where-Object {$_.ModelName -eq "$AppModelName"}
                        if ($Name -eq $Supersedes.LocalizedDisplayName)
                        {
                            Write-Verbose "$item" 
                            $Object = New-Object -TypeName psobject 
                            $Object | Add-Member -MemberType NoteProperty -Name Name -Value $item
                            $Result += $Object
                        }
                    }
                }
            }
        }
        End
        {
            Return $Result
        }
    }
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. AllenLiu-MSFT 49,316 Reputation points Microsoft External Staff
    2021-01-29T07:33:51.353+00:00

    @Longquo
    Thank you for posting in Microsoft Q&A forum.
    The link you provide is to get the old deployment types that an application supersedes.
    But your requirement is to get the new deployment types that supersede this application.
    Seems no powershell command to meet this.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.