PowerCLI Reference

New-SpbmRule

Synopsis

This cmdlet creates an SPBM rule in the client side.

Syntax

New-SpbmRule -AnyOfTags <Tag[]> [-Server <VIServer>] [-Confirm] [-WhatIf] [-SpbmOperatorType <SpbmOperatorType>] [<CommonParameters>]

New-SpbmRule [-Capability] <SpbmCapability> [-Value] <Object> [-Server <VIServer>] [-Confirm] [-WhatIf] [<CommonParameters>]

Related Commands

Online Version

Detailed Description

This cmdlet creates an SPBM rule in the client side.


There are two types of rules - capability-based rules and tag-based rules.


To create a capability-based rule, perform the following steps: 1. Select an available schema namespace. To get all available schema namespaces, run Get-SpbmCapability | select Namespace -unique. 2. Choose a capability ID within the selected schema namespace by using the Get-SpbmCapability cmdlet. 3. Provide a value for the selected Capability. It can be either a scalar value or a range of values.


To create a tag-based rule set, you must select at least one tag. If you select multiple tags, all specified tags should be of the same tag category. To see all available tags, run the Get-Tag cmdlet. You can use the Get-TagCategory and Get-Tag cmdlets to find a specific tag object.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
CapabilitySpbmCapabilitySpecifies an SPBM capability object. You must select one of the available capability objects for the given namespace. OBN for this object uses full name of the object, including the namespace name. You can find all available Capability objects and their data types under a namespace by using the Get-SpbmCapability cmdlet.trueFalse
ValueObjectSpecifies a capability property value. A property value is a single value or a collection of values. A single property value is expressed as a scalar value (Object), while a collection of values is expressed as a range of values (VMware.VimAutomation.VICore.Types.V1.Range), or an array (Object[]) of values. The type of each value can be Long, Int, String, Boolean, Double, DateTime, or TimeSpan.trueFalse
AnyOfTagsTag[]Specifies tag objects for the new rule. All specified tags should be of the same tag category. You can find all available tags by running the Get-Tag cmdlet. You can use the Get-TagCategory and Get-Tag cmdlets to find a specific tag.trueFalse
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falseFalse
ServerVIServerSpecifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of the Connect-VIServer cmdlet.falseFalse
SpbmOperatorTypeSpbmOperatorTypeSpecifies the logical operator for the values. Currently only NOT is supported.falseFalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falseFalse

Return Type

The newly created SpbmRule object

Notes

Works only with vCenter Server 5.5 or later. For more information, see the VMware Storage Policy API Reference: https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vspsdk.apiref.doc/right-pane.html

Examples

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

New-SpbmRule -Capability (Get-SpbmCapability -Name "VSAN.forceProvisioning") -Value $true

Creates a new SPBM rule with capability named "VSAN.forceProvisioning" and Boolean value set to true.

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

New-SpbmRule -Capability (Get-SpbmCapability -Name VSAN.stripeWidth) -Value 2

Creates a new SPBM rule with capability named "VSAN.stripewidth" and integer value set to 2.

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

New-SpbmRule -AnyOfTags (Get-Tag -Category "category1")

Creates a new SPBM rule with all the tags from the "category1" category.

-------------------------- Example 4 --------------------------

New-SpbmRule -AnyOfTags $tag1, $tag2

Creates a new SPBM rule with tag objects $tag1 and $tag2.


Copyright © VMware, Inc. All rights reserved.