Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change VSAN storage policy on one or more VMs
#See storage policies available
Get-SpbmStoragePolicy
#Define storage policy you want to apply
$storagepolicyname = "RAID-1 FTT-1"
#Capture Storage policy object.
$storagepolicies = Get-SpbmStoragePolicy
$targetstoragepolicy = ($storagepolicies | where-object {$_.name -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