Copy-DeployRule
Clones an existing rule. If you specify -Name, the new rule is assigned the specified name. Otherwise, the cmdlet assigns a new name to the original and gives the clone the name of the original rule.Use the -ReplaceItem and -ReplacePattern options to replace individual items or patterns from the old rule.If the old rule was in the working rule set, the cmdlet replaces it with the new rule unless you specify the -NoUpdateRuleSet option.You must have the "AutoDeploy.Rule.Create" privilege on the root folder of vCenter Server to use this cmdlet.
Syntax
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
DeployRule | DeployRuleWrapper | named |
|
Rule to copy. This parameter supports object-by-name, so you can pass the name of the rule. |
optional | AddOrReplacePattern | String[] | named |
|
Allows you to change individual patterns or add new ones, for example, the set of hosts the rule applies to. |
optional | AllHosts | SwitchParameter | named |
|
If you specify AllHosts, the rule is applied to all hosts. |
optional | ClearPatterns | SwitchParameter | named |
|
Remove all patterns in the original rule. This will be applied before AddOrReplacePattern so it will not clear any pattern updates. |
optional | Name | String | named |
|
If -Name is specified, the cmdlet assigns the name to the new rule. Otherwise, the new rule keeps the old name and the old name is renamed. |
optional | NoActivate | SwitchParameter | named |
|
If specified, the cmdlet changes the rule and adds it to the working rule set, but does not activate the working rule set. |
optional | NoUpdateRuleSet | SwitchParameter | named |
|
If specified, the cmdlet changes the rule but does not add the changed rule to the working and active rule set. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | ReplaceItem | VIObjectCore[] | named |
|
Allows you to make a copy and change individual items, for example the image profile the rule assigns. This parameter supports object-by-name, so you can pass the name of the item. |
optional | ReplacePattern | String[] | named |
|
ReplacePattern is depricated. The same functionality can be achieved with AddOrReplacePattern. |
Output
Examples
Example 1
Copy-DeployRule defimg -ReplaceItem "My New ESXi 5.0"
Copies a rule previously retrieved with Get-DeployRule and replaces the image in that rule with the specified image.
Example 2
$img = Get-ESXImageProfile -Name "My New ESXi 5.0" Copy-DeployRule defimg -ReplaceItem $img
Copies a rule previously retrieved with Get-DeployRule and replaces the image in that rule with the specified image.
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.