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

**URL:** <https://forums.powershell.org/t/how-to-add-dependencies-for-an-application-in-sccm-2012-r2-using-powershell-3-0/4506>\
**Category:** PowerShell Help\
**Created:** [July 12, 2015, 12:34am UTC](https://forums.powershell.org/t/how-to-add-dependencies-for-an-application-in-sccm-2012-r2-using-powershell-3-0/4506 "2015-07-12T00:34:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarangaraj-d](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@sarangaraj-d](https://forums.powershell.org/u/sarangaraj-d)\
**Post date:** [July 12, 2015, 12:34am UTC](https://forums.powershell.org/t/how-to-add-dependencies-for-an-application-in-sccm-2012-r2-using-powershell-3-0/4506/1 "2015-07-12T00:34:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![\_timpringle](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/_timpringle/32/276_2.png) [@\_timpringle](https://forums.powershell.org/u/_timpringle)\
**Post date:** [July 12, 2015, 12:42am UTC](https://forums.powershell.org/t/how-to-add-dependencies-for-an-application-in-sccm-2012-r2-using-powershell-3-0/4506/2 "2015-07-12T00:42:18Z")

</div>

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… 😉

---

<div class="post-metadata">

**Author:** ![graham-beer](https://avatars.discourse-cdn.com/v4/letter/g/49beb7/32.png) [@graham-beer](https://forums.powershell.org/u/graham-beer)\
**Post date:** [July 12, 2015, 5:19am UTC](https://forums.powershell.org/t/how-to-add-dependencies-for-an-application-in-sccm-2012-r2-using-powershell-3-0/4506/3 "2015-07-12T05:19:22Z")

</div>

Hi,

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.

---

<div class="post-metadata">

**Author:** ![sarangaraj-d](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@sarangaraj-d](https://forums.powershell.org/u/sarangaraj-d)\
**Post date:** [July 12, 2015, 4:30pm UTC](https://forums.powershell.org/t/how-to-add-dependencies-for-an-application-in-sccm-2012-r2-using-powershell-3-0/4506/4 "2015-07-12T16:30:54Z")

</div>

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);  
dt.Supersedes.Add(deploymentRule);

SaveApplication(application);

---

<div class="post-metadata">

**Author:** ![sarangaraj-d](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@sarangaraj-d](https://forums.powershell.org/u/sarangaraj-d)\
**Post date:** [July 12, 2015, 5:44pm UTC](https://forums.powershell.org/t/how-to-add-dependencies-for-an-application-in-sccm-2012-r2-using-powershell-3-0/4506/5 "2015-07-12T17:44:52Z")

</div>

Hi Graham,

Thanks for your reply

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

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:45pm UTC](https://forums.powershell.org/t/how-to-add-dependencies-for-an-application-in-sccm-2012-r2-using-powershell-3-0/4506/6 "2024-05-16T20:45:04Z")

</div>


