vSphere PowerCLI Reference

Copy-DeployRule

Synopsis

Clones an existing rule.

Syntax

Copy-DeployRule [-DeployRule] <DeployRule> [-Name <String>] [-AllHosts] [-ReplaceItem <VIObjectCore[]>] [-ReplacePattern <String[]>] [-NoUpdateRuleSet] [-NoActivate] [<CommonParameters>]

Related Commands

New-DeployRule
Get-ESXImageProfile
Get-Cluster
Get-Datacenter
Get-Folder
Get-VMHostProfile

Detailed Description

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.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
DeployRuleDeployRuleRule to copy. This parameter supports object-by-name, so you can pass the name of the rule.truetrue (ByValue)
AllHostsSwitchParameterIf you specify AllHosts, the rule is applied to all hosts.falsefalse
NameStringIf -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.falsefalse
NoActivateSwitchParameterIf specified, the cmdlet changes the rule and adds it to the working rule set, but does not activate the working rule set.falsefalse
NoUpdateRuleSetSwitchParameterIf specified, the cmdlet changes the rule but does not add the changed rule to the working and active rule set.falsefalse
ReplaceItemVIObjectCore[]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.falsefalse
ReplacePatternString[]Allows you to make a copy and change individual patterns, for example the set of hosts the rule applies to.falsefalse

Return Type

VMware.DeployAutomation.Types.DeployRule

Notes

Examples

-------------- Example 1 --------------

C:\PS> 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 --------------

C:\PS> $img = Get-ESXImageProfile -Name "My New ESXi 5.0"

C:\PS> Copy-DeployRule defimg -ReplaceItem $img

Copies a rule previously retrieved with Get-DeployRule and replaces the image in that rule with the specified image.


Copyright © 1998 - 2014 VMware, Inc. All rights reserved.