This topic contains 4 replies, has 3 voices, and was last updated by
July 12, 2015 at 6:04 am #27428
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.
July 12, 2015 at 6:12 am #27429ParticipantPoints: 45Rank: Member
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... 😉
July 12, 2015 at 10:49 am #27431ParticipantPoints: 0Rank: Member
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.
July 12, 2015 at 10:00 pm #27448
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;
sccm.DeploymentType ssdt = appToSupersede.DeploymentTypes;
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);
July 12, 2015 at 11:14 pm #27451
Thanks for your reply
It would be great, If you share the cmdlets to add dependencies 🙂
The topic ‘How to add dependencies for an application in SCCM 2012 R2 using PowerShell 3.0’ is closed to new replies.