your home for end-user virtualization!

Use PowerCLI to apply your vSAN storage policy

I  noticed that VM’s created with the vSphere fat client, were not getting the vSAN storage policy applied to them. So they we’re not as protected as one might think.

lack of storage policy

lack of storage policy

I wanted to make sure that all the VM’s living on vSanDatastore were protected by the vSAN storage policy. I wrote a quick PowerCLI script to do this:

$VMlist = get-datastore vsandatastore | get-vm
$StoragePolicy = "vSAN"
foreach ($VM in $VMlist)
{
Get-VM -Name $VM | Set-SpbmEntityConfiguration -StoragePolicy $StoragePolicy
}

 

Search

Categories