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 Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,409 questions
Microsoft Configuration Manager
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 41,296 Reputation points Microsoft Vendor
    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