VMware Cloud Community
deepak_ashwath
VMware Employee
VMware Employee

Find the life of a VM, after its deletion,

Hello Everyone,

I'm writing a script, but I have a small question ,

I want to list/find all the VMs under a resource pool or OrgVdc, along with the "Creation Date", Deletion Date" of any VMs in that resource pool, ? basically want to find all VMs that existed over a peroid of time when i execute the command.

for example say there is a VM that was created on Jan 10th and it was deleted on Jan 15th , now is there any command in vSphere Power CLI, where if I mention list all the VMs in the ESX or in the resource pool that existed from Jan 1st to Jan 30th, the output should also have the VM listed that was there from Jan 10th to Jan 15th, or is Database is the only way ?

Please give your inputs

Thanks,

Deep

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

The best option is to look at the events with the Get-VIEvent cmdlet.

Most of the activities in your vSphere envrionment produce 1 or more events (as you can see under Tasks & Events in the vSphere client).

There are numerous sample scripts in this community, and a few on my blog.

It will be a matter of finding the correct eventnames that document the lifecycle of a VM


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
deepak_ashwath
VMware Employee
VMware Employee

Thanks LuCD, i will check, I'm not sure if i can depend on Get-VIEvent, as there are 1000+ VMs.

Reply
0 Kudos