How to add dependencies for an application in SCCM 2012 R2 using PowerShell 3.0

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of SARANGARAJ D SARANGARAJ D 2 years ago.

  • Author
  • #27428
    Profile photo of SARANGARAJ D

    Hi All,

    I'm just a beginner for PowerShell and I'm quite interested in learning PowerShell scripting.
    I've been working on automation in SCCM 2012R2.
    I've created a basic PS script to create, distribute and deploy an application in SCCM 2012 R2. But I'm not able to figure out how to add dependencies in SCCM 2012 R2 using PS.
    Though I've seen lot of scripts in online and i can do copy paste the script, but i want to really understand the script and work on.

    So, can anyone help me with the script and explanation???

    Thanks in advance.

  • #27429
    Profile photo of Tim Pringle
    Tim Pringle

    Hi Sarangaraj,

    SCCM can be managed from PowerShell in multiple ways, some by hooking into a couple of the DLLs, and others solely via WMI.

    If you can paste the script, maybe we can try and help to explain it to you... 😉

  • #27431
    Profile photo of Graham Beer
    Graham Beer


    I've found that the cmdlets that come with SCCM are pretty good and I've managed to automate quite a few things with them.

  • #27448
    Profile photo of SARANGARAJ D

    Hi Tim,

    Thanks for your reply.
    Below is the script which I got from internet.
    If you prefer any other script that is also fine, but that requires explanation 🙂 

    sccm.Application application = GetApplicationFromName(txtSCCMApplicationName.Text);
    sccm.Application appToSupersede = GetApplicationFromName(cmbSuperseded.Items[cmbSuperseded.SelectedIndex] as string);

    sccm.DeploymentType dt = application.DeploymentTypes[0];
    sccm.DeploymentType ssdt = appToSupersede.DeploymentTypes[0];
    DeploymentTypeIntentExpression intentExpression = newDeploymentTypeIntentExpression(appToSupersede.Scope, appToSupersede.Name, (int)appToSupersede.Version, ssdt.Scope, ssdt.Name, (int)ssdt.Version,DeploymentTypeDesiredState.Prohibited, true);
    DeploymentTypeRule deploymentRule = new DeploymentTypeRule(NoncomplianceSeverity.None,null, intentExpression);


  • #27451
    Profile photo of SARANGARAJ D

    Hi Graham,

    Thanks for your reply

    It would be great, If you share the cmdlets to add dependencies 🙂

You must be logged in to reply to this topic.