You'll have to provide more details about the VM solution you're using. Are you talking about VMWare, Citrix, Oracle, etc? Generally, I'd say you'll have to create an automation that either looks at the admin console for the VM infrastructure (ex. vCenter console). Alternatively, if your VM infrastructure includes some sort of API (ex. a REST interface) you may be able to query that for details.
Cheers,