Uncategorized

How to list datastores and VMs that are on shared storage.

A lot of the magic VMware provides relies on shared storage. If a VM is on local storage, you can’t VMotion it, HA won’t restart it, and a host of other limitations. Do you know which of your VMs, if any, are on local storage? This script can make answering that question pretty easy. First, here’s a function that will locate datastores that use shared storage.

To use, launch PowerCLI, connect to your vCenter server, load the function above and run:

And you’ll wind up with a list of datastores that your hosts can share.

But that’s not what we’re after, we want datastores that can’t be shared. Not too hard,


Once we have $localOnly, we pass that to Get-VM.

This gives us the list of VMs that can’t be shared amongst hosts.