Who created a VM

I know, this is not a nice solution, but working and simple, when you want to know who created a VM, or any Event information from a VM.
I found lots of other script witch solve this problem, but i have to know one indivudal vm creation day, and information about creator.

PowerCLI C:\WINDOWS\system32> $DATE = Get-Date
PowerCLI C:\WINDOWS\system32> Get-VM -Name VMNAME | Get-VIEvent -Types Info -Start $DATE.AddDays(-700) -Finish $DATE | Export-Csv c:\tmp\events.csv -Encoding utf8

In exported Excel file will store information about who created the VM. You will see like this: “Created virtual machine vmname.domain.loc on 192.168.x.x in clustername” and in this row find the account name who created that.

When you think, the vm is older then 700 days, you can change this value in command.

I hope this short article will help for you!

3 thoughts on “Who created a VM

    • I would like to delete a specific task or a specific event from the database like:

      DELETE FROM vpx_task
      vpx_task.descriptionid = ‘vim.host.DiskManager.Lease.MapDiskRegion’ AND
      vpx_task.username = ‘accountname’


      Sadly, its not working via Task Scheduler, only by running it manually..

Leave a Reply to Andras Jakab Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.