VMware Cloud Community
lmattos
Contributor
Contributor
Jump to solution

Doubt about details of virtual machines

Hello,

how i check the date of creation of a virtual machine in vmware esxi 5.5?

thanks for help

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
Sateesh_vCloud
Jump to solution

Is this VM created recently? If yes you can easily track it from Tasks & Events of Individual VM

If the VM created in the past then you need to export the events from vCenter then search for VM creation date in that file

pastedImage_0.png

------------------------------------------------------------------------- Follow me @ www.vmwareguruz.com Please consider marking this answer "correct" or "helpful" if you found it useful T. Sateesh VCIX-NV, VCAP 5-DCA/DCD,VCP 6-NV,VCP 5 DCV/Cloud/DT, ZCP IBM India Pvt. Ltd

View solution in original post

Reply
0 Kudos
8 Replies
Sateesh_vCloud
Jump to solution

Is this VM created recently? If yes you can easily track it from Tasks & Events of Individual VM

If the VM created in the past then you need to export the events from vCenter then search for VM creation date in that file

pastedImage_0.png

------------------------------------------------------------------------- Follow me @ www.vmwareguruz.com Please consider marking this answer "correct" or "helpful" if you found it useful T. Sateesh VCIX-NV, VCAP 5-DCA/DCD,VCP 6-NV,VCP 5 DCV/Cloud/DT, ZCP IBM India Pvt. Ltd
Reply
0 Kudos
vervoortjurgen
Hot Shot
Hot Shot
Jump to solution

you will have to use powerCLI

i found  script on the internet

dont know if it still works on esx5.5 U2

#Enter your vCenter Host below

$vcenter = "your_vcenter_server"

#Enter the CSV file to be created

$csvfile = "VM_Birthdays.CSV"

################################

#Load the VMware Powershell snapin if the script is being executed in PowerShell

Add-PSSnapin VMware.VimAutomation.Core -ErrorAction 'SilentlyContinue'

#Connect to the vCenter server defined above. Ignore certificate errors

Write-Host "Connecting to vCenter"

Connect-VIServer $vcenter -wa 0

Write-Host "Connected"

Write-Host ""

#Check to see if the file exists, if it does then overwrite it.

if (Test-Path $csvfile) {

Write-Host "Overwriting $csvfile"

del $csvfile

}

#Create the CSV title header

Add-Content $csvfile "VM,Born on,Creator,Creation Type,Event Message"

#Gather all VM's from vCenter

$vms = Get-VM | sort Name

foreach ($VM in $vms) {

Write-Host "Gathering info for $VM"

#Search for events where the VM was deployed from a template

$vmevents = Get-VIEvent $VM -MaxSamples([int]::MaxValue) | Where-Object {$_.FullFormattedMessage -like "Deploying*"} |Select CreatedTime, UserName, FullFormattedMessage

if ($vmevents)

{

$type = "From Template"

}

#If no events were found, search for events where the VM was created from scratch

if (!$vmevents) {

$vmevents = Get-VIEvent $VM -MaxSamples([int]::MaxValue) | Where-Object {$_.FullFormattedMessage -like "Created*"} |Select CreatedTime, UserName, FullFormattedMessage

Write-Host "Searching by Created"

$type = "From Scratch"

}

#If no events were found, search for events where the VM was cloned

if (!$vmevents) {

$vmevents = Get-VIEvent $VM -MaxSamples([int]::MaxValue) | Where-Object {$_.FullFormattedMessage -like "Clone*"} |Select CreatedTime, UserName, FullFormattedMessage

Write-Host "Searching by Cloned"

$type = "Cloned"

}

#If no events were found, search for events where the VM was discovered

if (!$vmevents) {

$vmevents = Get-VIEvent $VM -MaxSamples([int]::MaxValue) | Where-Object {$_.FullFormattedMessage -like "Discovered*"} |Select CreatedTime, UserName, FullFormattedMessage

Write-Host "Searching by Discovered"

$type = "Discovered"

}

#If no events were found, search for events where the VM was connected (typically from Backup Restores)

if (!$vmevents) {

$vmevents = Get-VIEvent $VM -MaxSamples([int]::MaxValue) | Where-Object {$_.FullFormattedMessage -like "* connected"} |Select CreatedTime, UserName, FullFormattedMessage

Write-Host "Searching by Connected"

$type = "Connected"

}

#I have no idea how this VM came to be.

if (!$vmevents) {

Write-Host "No clue how this VM got here!"

$type = "Immaculate Conception"

}

#In some cases there may be more than one event found (typically from VM restores). This will include each event in the CSV for the user to interpret.

foreach ($event in $vmevents) {

#Prepare the entries

$birthday = $event.CreatedTime.ToString("MM/dd/yy")

$parent = $event.Username

$message = $event.FullFormattedMessage

#Add the entries to the CSV

$write = "$VM, $birthday, $parent, $type, $message"

Add-Content $csvfile $write

}

}

kind regards Vervoort Jurgen VCP6-DCV, VCP-cloud http://www.vdssystems.be
vThinkBeyondVM
VMware Employee
VMware Employee
Jump to solution

Follow the way specified by Satheesh. It is one of easiest.


----------------------------------------------------------------
Thanks & Regards
Vikas, VCP70, MCTS on AD, SCJP6.0, VCF, vSphere with Tanzu specialist.
https://vThinkBeyondVM.com/about
-----------------------------------------------------------------
Disclaimer: Any views or opinions expressed here are strictly my own. I am solely responsible for all content published here. Content published here is not read, reviewed or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware.

Reply
0 Kudos
lmattos
Contributor
Contributor
Jump to solution

The creation date of this vm is old.

I will do the way you explained

Thanks for help Sateesh and sorry for my english.

Reply
0 Kudos
lmattos
Contributor
Contributor
Jump to solution

vervoort jurgen

Thanks for your help, but i dont have experience in use of powercli.

i will look more information about powercli.

anyway, thank you for your help.

thanks a lot the everybody.

Reply
0 Kudos
lmattos
Contributor
Contributor
Jump to solution

I will vickyvision2020 , thank you.

Reply
0 Kudos
vervoortjurgen
Hot Shot
Hot Shot
Jump to solution

your welcome

important thing is that you get an answer to your question

we are all here to share knowledge and help people

FYI at one point you will come in contact with powerCLI cause its sometimes needed Smiley Happy

kind regards Vervoort Jurgen VCP6-DCV, VCP-cloud http://www.vdssystems.be
Reply
0 Kudos
JagadeeshDev
Hot Shot
Hot Shot
Jump to solution

All the tasks and event related to the VM are stored in the Vcenter DB and there is no retention period  ( by default)

You can export the logs and filter using the scripts . Example :

$events = Get-VIEvent -Start (Get-Date).AddHours(-1) -MaxSamples ([int]::MaxValue) |

where {$_.GetType().Name -eq "TaskEvent"} |

Group-Object -Property {$_.Info.DescriptionId}



http://www.myitblog.in/
Reply
0 Kudos