Sample Scripts for Managing vSphere Policy-Based Storage with VMware PowerCLI

To help you get started with VMware PowerCLI, this documentation provides a set of sample scripts that illustrate basic and advanced tasks in vSphere policy-based storage management.

Subtopics
Create a Tag-Based Storage Policy
Create a Capability-Based Storage Policy
Associate a Storage Policy with a Virtual Machine and Its Hard Disk
Disassociate a Storage Policy Associated with a Virtual Machine and Its Hard Disk
Enable SPBM on a Cluster and Verify that It Is Enabled
Remove a Storage Policy
Edit a Storage Policy
Export and Import a Storage Policy
Create a Virtual Machine in a Datastore Compatible with Storage Policy
Create a vSAN Datastore
Modify a vSAN Datastore
Create a vSAN Stretched Cluster
Create an NFS 4.1 Datastore
Add a VASA Provider and Create a Policy
Invoke a Planned Failover on a Replication Group and Reverse the Replication
Attach a Flat VDisk to a Virtual Machine