As with previous releases of PowerCLI we constantly improve the number of cmdlets and enable the ability to work with some of the latest features. With the recent release of PowerCLI 5.1 we have introduced the ability to work with Datastore Clusters. This can be useful for the following scenarios:
- Setting up new datastore clusters
- Adding multiple datastores to datastore clusters
- Adding multiple VMs to a datastore cluster
- Removing datastore clusters
- Configuring datastore clusters on mass
- Automating the testing of datastore clusters
New Datastore Cluster Cmdlets
The following datastore cluster cmdlets are available for use:
Name | Synopsis |
Get-DatastoreCluster | Retrieves datastore clusters. |
New-DatastoreCluster | Creates a new datastore cluster. |
Remove-DatastoreCluster | Deletes the specified datastore clusters. |
Set-DatastoreCluster | Modifies the configuration of the specified datastore cluster. |
As well as these datastore cluster cmdlets you can also use the Move-Datastore cmdlet to move datastores into datastore clusters, an example of this can be seen below:
$myDatastoreCluster = Get-DatastoreCluster -Name “MyDatatoreCluster”
Get-Datastore “MyDatastore1”, “MyDatastore2” | Move-Datastore -Destination $myDatastoreCluster
Additional to this, the VM cmdlets have been adjusted to receive a datastore cluster as well as a datastore so when a VM is created or altered these can use datastore clusters, the cmdlets can also be used to define storage DRS rules, an example of this can be seen below:
$vmhost = Get-VMHost -Name MyVMHost1
$myVM = Get-VM -Name WindowsXP
$mySourceTemplate = Get-Template -Name WindowsTemplate
$myDatastoreCluster = Get-DatastoreCluster -Name MyStorageCluster1
$myAdvancedOption = New-Object ‘VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.SdrsVMAntiAffinityRule’ $myVM
New-VM -Name VM -Template $mySourceTemplate -Datastore $myDatastoreCluster -AdvancedOption $myAdvancedOption -ResourcePool $vmhost
Using the datastore cluster cmdlets
The following video shows you how to use the datastore cluster cmdlets to quickly setup, configure and remove datastore clusters.