## PowerCLI Reference

# Get-SpbmStoragePolicy

## Synopsis

This cmdlet returns all available requirement policies and resource policies.

Syntax

Get-SpbmStoragePolicy [-Requirement] [-Resource] [[-Name] <String[]>] [-Namespace <String[]>] [-Capability <SpbmCapability[]>] [-Tag <Tag[]>] [-Server <VIServer[]>] [<CommonParameters>]
Get-SpbmStoragePolicy [-Id <String[]>] [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

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

Detailed Description

This cmdlet returns all available requirement policies and resource policies.

Parameters

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Name | String[] | Filters the storage policies by name. | false | false
Capability | SpbmCapability[] | Filters the storage policies by capability schema. | false | false
Id | String[] | Filters the storage policies by ID. Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that matches exactly one of the string values in that list. | false | false
Namespace | String[] | Filters the storage policies by namespace. | false | false
Requirement | SwitchParameter | Specifies the policy category. Policy category can be either "requirement" or "resource". If nothing specified, retrieves both. | false | false
Resource | SwitchParameter | Specifies the policy category. Policy category can be either "requirement" or "resource". If nothing specified, retrieves both. | 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)
Tag | Tag[] | Filters the storage policies by tag. | false | false

Return Type

List of SpbmStoragePolicy objects

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 --------------

    Get-SpbmStoragePolicy -Name "MyPolicy"

Returns all storage policies named "MyPolicy".

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

    Get-SpbmStoragePolicy -Requirement -Namespace "VSAN" -Tag $tag1, $tag2

Returns all storage policies of type Requirement containing one or more rules which contain one or more capabilities from the "VSAN" namespace and any of the $tag1 or $tag2 tags.

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

    Get-SpbmStoragePolicy -Id "PolicyId"

Returns a storage policy with ID "PolicyId".

Copyright © VMware, Inc. All rights reserved.