Unassociated vSAN objects – this time with PowerCLI

I came across https://kb.vmware.com/s/article/70726Procedures for identifying Unassociated vSAN objects and it reminded me of my old post https://vchrisblog.com/2018/07/13/unassociated-vsan-objects

The VMware KB is updated and has a better filter for finding the UUIDS
cat unassoc.txt | awk '{print $2}' | grep '^[0-9a-f]' >> /tmp/uuids.txt
I like the addition of the grep ^[0-9a-f] filter, it only grabs valid hex chars and will likely filter out things that I did not see in my environment. The rest of the code is largely the same manipulation I laid out in 2018.

There is also some code in the KB to perform the search for unassociated objects in PowerCLI. It does this by generating a vSANView and querying it for anything that is not associated with a VM object. Then taking the JSON object returned by the query. It seems you still need to do the removal in RVC. It’s worth reviewing the VMware KB to get some ideas.

The KB falls short of describing how to use the resulting unassociated object list (from rvc or PowerCLI) to perform any deletions. You can refer to my blog linked above for the delete method. As always double, and triple check your work before you delete anything. I cannot stress this enough, If you delete objects from vSAN they are gone forever. Because the lists we are generating are not associated with VMs there is a good chance they are invisible to your backup systems and you have no safety net here.

Play safe.

Leave a comment