Hi All,
I'm trying to add an existing Global Condition to an application deployment type via Powershell. The part I'm stuck at is running this command:
$app.DeploymentTypes[1].Requirements.Add($rule)
Cannot find an overload for "Add" and the argument count: "1".
At line:1 char:1
+ $app.DeploymentTypes[1].Requirements.Add($rule)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
I'm assuming that means that I haven't selected/set my $rule properly. I tried using this command to assign $rule to an object using the Requirements on a different deployment type:
$rule = $app.DeploymentTypes.[0].Requirements
I've looked through the article here (gallery.technet.microsoft.com/SCCM-2012-Global-Condition-2b133101#content)and tried tweaking his scripts, but it seems like each time you Create the GlobalCondition you're making a new one; what I want to do is just assign an existing one. That way, if I need to modify all of the application deployment types using that one Global Condition I can change one and have it change for all that use that (i.e. if Windows 8.2 comes out, then I don't need to check the 8.2 box on all my deployment type requirements).
How do I select an existing GlobalCondition properly so that i can assign it using the command below?
$app.DeploymentTypes[1].Requirements.Add($rule)
Thanks a ton in advance!