Add-DeployRule Command | Vmware PowerCLI Reference

Add-DeployRule

Adds one or more rules to the working rule set and then activates the working rule set. The rule can be added at a specific index with the "-At" option, otherwise it is added to the end. If you plan on making several changes to the rule set, you can pass the "-NoActivate" option to avoid activing the rule set after every change.A rule set is an ordered list of rules that determines what items, such as a host profile, should be associated with a host. For each type of item, AutoDeploy will find a matching rule and select the item specified in that rule. If more than one rule matches a host and the rules contain the same type of item, the item from the rule that comes first in the rule set will be used. This behaviour makes it possible to write a single generic rule that matches many hosts and then write more specific rules to override settings for specialized hosts.The working rule set can be used to test out changes to the rule set against hosts in vCenter Server. Once you are satisfied with the rules, you can activate the working rule set to control how any new hosts that are unknown to vCenter Server will be deployed.You must have the "AutoDeploy.RuleSet.Edit" privilege on the root folder of vCenter Server to use this cmdlet.

Syntax

Add-DeployRule
-DeployRule < DeployRuleWrapper[] >
[ [-At ] < UInt32 > ]
[-NoActivate ]
[-ProgressAction < ActionPreference > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
DeployRule DeployRuleWrapper[] named
  • pipeline
Rule(s) to add to the rule set. You can pass a DeployRule object here or the name of the rule.
optional At UInt32 1
Index in the rule set where you want to add the rule. The placement of the rule in the set determines its priority. Lower indexes have a higher priority.
optional NoActivate SwitchParameter named
Specify this parameter to add the rule to the working rule set but not to the active rule set. By default, the working rule set is activated after the change.
optional ProgressAction ActionPreference named

Output

Examples

Example 1

Get-DeployRule "testrule" | Add-DeployRule

Get a rule named "testrule" and add it to the end of the rule set.

Example 2

Add-DeployRule testrule -At 0

Add a rule named "testrule" to the beginning of the rule set.

Related Commands

DeployRule

Adds one or more rules to the rule set.

Clones an existing rule.

Gets a DeployRule object.

Creates a new rule.

Removes a rule from the working rule set.

Updates an existing rule.

DeployRuleSet

Gets the current working rule set or the current active rule set.

Sets the list of rules in the working rule set.

DeployRuleSetCompliance

Remediate any non-compliant associations discovered by Test-DeployRuleSetCompliance

Checks whether hosts are compliant with rules.