VSAN, SPBM Compliance, & PowerCLI

I very often tear down/distress my “lab” environment while working on docs/testing code/trying to replicate issues/etc. I was trying to recreate an issue the other day and decided to replace my vCenter Appliance. I deleted the VCSA, but left some of the other VMs, as they had some services I needed like DNS.

After deploying the a new VCSA, I noticed an error in the Cluster’s Monitor tab, under Virtual SAN, specific to my VSAN objects. The Compliance status for all my old VM’s was “Out of Date.”

I clicked on a single VM, picked my VM storage policy, and selected the VM home and clicked OK. I could have just as easily selected Apply to all. Not hard, but potentially time consuming in the case of a lot of objects.

I thought for a second. I’d rather not do this for each of these objects… Plus, I’ll likely tear down the VCSA again… So why not script it?

I looked at 2 PowerCLI cmdlets to handle this. Get-SpbmEntityConfiguration shows the currently assigned SPBM policy, along with whether it is compliant or not, and the last time it was checked. Set-SpbmEntityConfiguration sets SPBM configuration data for VMs, HardDisks, and cluster objects.

My PowerShell/PowerCLI is a little rusty, but I was able to crank out a one liner for the task.

vSphere 5.5 End of General Support

-248Days-12Hours-49Minutes-22Seconds

Disclaimer

Any views or opinions expressed here are strictly my own. While I am a blogger who works for VMware, I am solely responsible for all content published here. This is a personal blog, not a VMware blog. Content published here is not read, reviewed, or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware or any of its divisions, subsidiaries, or business partners.

Any of my code, configuration references, or suggestions, should be researched and verified in a lab environment before attempting in a production environment.

Agreement to use any of my code or recommendations, removes me from any liability as such.