## PowerCLI Reference

# New-SpbmStoragePolicy

## Synopsis

This cmdlet creates a requirement storage policy in an SPBM server.

Syntax

New-SpbmStoragePolicy [-Name] <String> [-Description <String>] [-AnyOfRuleSets <SpbmRuleSet[]>] [-CommonRule <SpbmRule[]>] [-Server <VIServer>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Export-SpbmStoragePolicy
Get-SpbmStoragePolicy
Import-SpbmStoragePolicy
Remove-SpbmStoragePolicy
Set-SpbmStoragePolicy

Detailed Description

This cmdlet creates a requirement storage policy in an SPBM server. A requirement policy contains requirements that are derived from tag-defined capabilities or from VMware VSAN capabilities.
A policy is a collection of rule sets. A rule set references storage capabilities and defines requirements based on those capabilities.
Rules from the VAIOFilter namespace are only accepted as value by the CommonRule parameter. These rules apply to all rule sets as common requirements.
You can use the following styles when creating a new policy.
# Style 1:
New-SpbmStoragePolicy
-Name ...
-RuleSet (
New-SpbmRuleSet (
(New-SpbmRule EmcStorage.Latency.MaxValue 45),
(New-SpbmRule EmcStorage.MulPropCap.Property (Range 2 14)),
),
New-SpbmRuleSet (
(New-SpbmRule SpbmCore.Throughput 5),
(New-SpbmRule -Tag $supportsThinProvisioning)
)
)
-CommonRule
((New-SpbmRule IOFilters.EMCCache.MaxValue 1000),
(New-SpbmRule IOFilters.EMCCache.OtherRange (Range 2 14)))
# Style 2:
$r1 = New-SpbmRule -Capability namespace1.capability1.property1 -Value ...
$rs1 = New-SpbmRuleSet -Rule $r1
$ca1 = Get-SPBMCapability -Name EMCStorage.Latency.*
$r2 = New-SpbmRule -Capability $ca1[0] -Value ...
$r3 = New-SpbmRule -Capability EMCStorage.Latency.MaxValue -Value ...
$rs2 = New-SpbmRuleSet -Rule ($r2,$r3)
$r4 = New-SpbmRule -Capability IOfilters.Replication.Someprop -Value ...
$ca2 = Get-SPBMCapability -Name IOFilters.*
$r5 = New-SpbmRule -Capability $ca2[0] -Value ...
$sp = New-SpbmStoragePolicy -RuleSet ($rs1,$rs2) -CommonRule ($r4,$r5)
# Style 3: Creating a storage policy with only VAIOFilter-based common rules
$ca1 = Get-SPBMCapability -Name IOFilters.*
$r1 = New-SpbmRule -Capability $ca1[0] -Value ...
$sp1 = New-SpbmStoragePolicy -CommonRule ($r1)
#Style 4: Creating a storage policy without VAIOFilter-based common rules
$ca1 = Get-SPBMCapability -Name EMCStorage.Latency.*
$r1= New-SpbmRule -Capability $ca1[0] -Value ...
$r2 = New-SpbmRule -Capability EMCStorage.Latency.MaxValue -Value ...
$rs1 = New-SpbmRuleSet -Rule ($r1,$r2)
$sp1= New-SpbmStoragePolicy -RuleSet ($rs1)

Parameters

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Name | String | Specifies the name of the capability-based policy to be created. The maximum length of the name is 80 characters. | true | false
AnyOfRuleSets | SpbmRuleSet[] | Specifies an array of rule sets that define the storage requirements. An SPBM rule with the VAIOFilter namespace cannot be added in any of these rule sets. | false | true (ByValue)
CommonRule | SpbmRule[] | Specifies the SPBM rules from the VAIOFilter namespace only. These rules are considered with all the SPBM rule sets as common requirements. | false | false
Confirm | SwitchParameter | If 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. | false | false
Description | String | Specifies the text description associated with the policy. | false | false
Server | VIServer | Specifies 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 Connect-VIServer. | false | true (ByValue)
WhatIf | SwitchParameter | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | false

Return Type

The newly created SpbmStoragePolicy 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-SpbmStoragePolicy -Name "MyPolicy" -Description "MyPolicyDescription" -AnyOfRuleSets $ruleset1, $ruleset2, $ruleset3

Creates a new storage policy named "MyPolicy", with description "MyPolicyDescription" and with rule set objects $ruleset1, $ruleset2 and $ruleset3.

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

    New-SpbmStoragePolicy -Name "MyPolicy" -AnyOfRuleSets (New-SpbmRuleSet -AllOfRules $rule1, $rule2, $rule3)

Creates a new storage policy named "MyPolicy" with a rule set containing rule objects $rule1, $rule2, and $rule3.

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

    $c = Get-SpbmCapability ?Name IOFILTERS*
    $cr = New-SpbmRule ?Capability $c[0] ?Value 10
    $p = New-SpbmStoragePolicy -Name policy1 -AnyOfRuleSets (New-SpbmRuleSet -Name ruleset1 -AllOfRules @($rule1, $rule2)) -CommonRule ($cr)

Creates a storage policy with one rule set and one VAIOFilter common rule.

Copyright © VMware, Inc. All rights reserved.