Change VSAN storage policy on one or more VMs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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