PowerCLI Reference

vSphere Auto Deploy 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
Get-ScriptBundle

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. ^M
^M
Use the -ReplaceItem and -ReplacePattern options to replace individual items or patterns from the old rule. ^M
^M
If the old rule was in the working rule set, the cmdlet replaces it with the new rule unless you specify the -NoUpdateRuleSet option.^M
^M
You must have the "AutoDeploy.Rule.Create" privilege on the root folder of vCenter Server to use this cmdlet.

Parameters

Name Type Description Required? Pipeline Input Default Value
DeployRule DeployRule Rule to copy. This parameter support s object-by-name, so you can pass the name of the rule. true true (ByValue)
AllHosts SwitchParameter If you specify AllHosts, the rule is applied to all hosts. false false
Name String 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. false false
NoActivate SwitchParameter If specified, the cmdlet changes the rule and adds it to the working rule set, but does not activate the w orking rule set. false false
NoUpdateRuleSet SwitchParameter If specified, the cmdlet changes the rule but does not add the changed rule to the working and active rule set. false false
ReplaceItem VIObjectCore[] 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. false false
AddOrReplacePattern String[] Allows you to change individual patterns or add new ones, for example, the set of hosts the rule applies to. false false
ReplacePattern String[] >ReplacePattern is depricated. The same functionality can be achieved with AddOrReplacePattern. false false
ClearPatterns SwitchParameter Remove all patterns in the original rule. This will be applied before AddOrReplacePattern so it will not clear any pattern updates. false false

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.

----- --------- Example 3 --------------

C:\PS> $bundle = Get-ScriptBundle -Name "MyscriptBundle" C:\PS> Copy-DeployRule defimg -ReplaceItem $bundle

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


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