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

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.

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… :wink:


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.

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 :slight_smile:

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);


Hi Graham,

Thanks for your reply

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