Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Change VSAN storage policy on one or more VMs
#See storage policies available
#Define storage policy you want to apply
$storagepolicyname = "RAID-1 FTT-1"
#Capture Storage policy object.
$storagepolicies = Get-SpbmStoragePolicy
$targetstoragepolicy = ($storagepolicies | where-object {$ -eq $storagepolicyname})
#Change for a single VM
$vm = get-vm nakabuntu
set-vm $vm -StoragePolicy $targetstoragepolicy
#Loop through multiple VMs to apply same policy.
$vms = get-vm
Foreach ($vm in $vms){
set-vm $vm -StoragePolicy $targetstoragepolicy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment