powershellscripts.com

Tutorials  PowerShell Cmdlet Help for New-DeployRule



NAME
New-DeployRule

SYNOPSIS
Creates a new rule.

SYNTAX
New-DeployRule [-Name] -Pattern -Item []

New-DeployRule [-Name] -AllHosts -Item []


DESCRIPTION
Creates a new rule with the specified items and patterns. The items specify what should be associated with an ESXi
host and the patterns specify which ESXi hosts the rule applies to. A rule on its own does not affect anything.
The rule must first be added to the working rule set in order to place it in context with the other rules in the sy
stem. Since multiple rules can match a single host, the rule set is used to rank the rules. Items in higher ranki
ng rules are preferred over items in lower ranking rules. Only one item of a particular type will be associated wi
th the host. For example, if two rules in a rule set have host profiles, only the profile in the higher ranking ru
le will be used. Alternatively, if one rule has a host profile and the other rule has an image profile, both rules
will have an affect.

You must have the "AutoDeploy.Rule.Create" privilege on the root folder of vCenter Server to use this cmdlet.


PARAMETERS
-Name
Name of the new rule.

Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Pattern
Set of hosts the new rule should apply to.

Pattern strings use the following syntax:

== Adds a pattern that exactly matches the specified value against the specified attribute. Us
e this syntax if you need to match a string that contains a comma.

=[,val2,... ,valN] Adds a pattern that matches against the comma-separated list of values.

Supported value types are:

string Exact string match
- Range of IPv4 addresses.

Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Item
Item the rule should apply to the hosts. Can be an image profile, a host profile, or a folder or cluster on the
vCenter Server system to add the host to.

Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-AllHosts
Specify AllHosts to apply the new rule to all hosts managed by VMware Auto Deploy. Hosts are managed by VMware
Auto Deploy if the DHCP server directs them to the Auto Deploy TFTP configuration file.

Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
VMware.DeployAutomation.Types.DeployRule


NOTES




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

C:\PS> $rule = New-DeployRule -Name "defaultFolder" -Item "NewHosts" -AllHosts


Create a rule that places all hosts in the folder named "NewHosts".





-------------- Example 2 --------------

C:\PS> $img = Get-ESXImageProfile -Name "My ESXi 5.0"
C:\PS> $rule = New-DeployRule -Name "testrule" -Item $img -Pattern "vendor=Acme","vendor==VMware, Inc.","ipv4=192.
168.1.10-192.168.1.20"


Create a rule that assigns the image profile named "My ESXi 5.0" to hosts that match a set of vendors and are in a
particular IPv4 range.






RELATED LINKS
Add-DeployRule
Copy-DeployRule
Set-DeployRule