VMware Cloud Community
vsantester
Contributor
Contributor
Jump to solution

Change Storage Profile (SPBM) policy and apply to both home and vmdks

Hi there, I need to change the storage policy on a cluster worth of VMs. I've been following vSphere PowerCLI 5.8 SPBM Walkthrough (Part 1): Introduction | VMware vSphere Blog - VMware Blogs, specifically running this:

Get-Cluster "MyCluster" | Get-VM "myvm.local" | Set-SpbmEntityConfiguration -StoragePolicy "VSAN-FTT=1"

This applies the new Storage Profile policy to the "home" folder of the VM, but ignores the vmdks, hence the VM fails to comply with the policy. How can I make it so that it changes the home and all vmdks on the VM to the policy I'm specifying.

Thanks in advance,

Tags (3)
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You will have to set the storage policy on the hard disks as well in an extra command, for example:

$vm = Get-Cluster "MyCluster" | Get-VM "myvm.local"

$hd = Get-HardDisk -VM $vm

$vm | Set-SpbmEntityConfiguration -StoragePolicy "VSAN-FTT=1"

$hd | Set-SpbmEntityConfiguration -StoragePolicy "VSAN-FTT=1"

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

3 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You will have to set the storage policy on the hard disks as well in an extra command, for example:

$vm = Get-Cluster "MyCluster" | Get-VM "myvm.local"

$hd = Get-HardDisk -VM $vm

$vm | Set-SpbmEntityConfiguration -StoragePolicy "VSAN-FTT=1"

$hd | Set-SpbmEntityConfiguration -StoragePolicy "VSAN-FTT=1"

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
vsantester
Contributor
Contributor
Jump to solution

Awesome, that works great. Thanks.

0 Kudos
PiotrBerent
Contributor
Contributor
Jump to solution

I need to dig that post out.

How to set with powercli this toogle switch from GUI "Configure per disk" - since setting both (for VM Home, and Disks) is ok, but newly added disk will not have this policy.

0 Kudos