Hi All,
My code is working fine. ie
Get-VM -Location XYZ | Get-VIEvent -Start (Get-Date).adddays(-30) | `
where {$_.Gettype().Name -eq "VmBeingDeployedEvent" -or $_.Gettype().Name -eq "VmCreatedEvent" -or $_.Gettype().Name -eq "VmRegisteredEvent"}..
But I was surprised when i found one of the VM created it (the above code) did not cach.
The vcenter logs shows the event tho :-
info 3/15/2014 9:53:18 PM <<userid>> Creating <<VMname>> on host <hostname>>in XYZ
But I do not see this in the server evet/task tab for some reasons.
Can anyone suggest anything here ?
Thanks
I got some clue in Get VM's creation date
investigating
A short remark on the event types you are using, I would use the VmDeployedEvent instead of the VmBeingDeployedEvent.
In the latter you are not sure that the VM was actually deployed, it just says that the VM is being deployed.
I would also add the VmClonedEvent to the Where-clause.
Fyi, in my Events, Dear Boy, Events – Part 2 post I show a script to get a handy overview of all possible events in your vSphere environment.
And you can of course also use the Gui from my Event-O-Matic post :smileygrin:
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks .. I by purpose left the cloned one after reading an article .. but let me add that should not harm me.. BTW the fix in my case was the "-MaxSamples ([int]::MaxValue)"
BTW I feel blessed & privileged when LucD himself almost all my Qs !
Yes, that 100 events limit can be a nuisance :smileygrin:
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference