VMware Cloud Community
KS_10
Contributor
Contributor

Get-VIEvent get stuck If Folder name = VM name

Hello 

I use the below code to get the User info who has created any VM in the vCenter

It works fine, but today I seen that it was taking very long to generate the report. Then during debugging process I figured out that every time it get struct when trying to pull the logs for one particular VM. ( Take almost 45 min to get the logs for this machine)
And then later I find out that VM's folder name is also same as VM name.
I then changed the VM folder name to something else and run the script again and this time No issues.

How can we avoid this issue ? can anyone suggest anything ?

$Vm_Event = Get-VIEvent -Entity $VM_Name -Start $start -Finish $end -Types info `
|Where-Object {$_.GetType().Name -eq "VmClonedEvent" -or $_.GetType().Name -eq "VmDeployedEvent" `
-or $_.GetType().Name -eq "VmRegisteredEvent" -or $_.GetType().Name -eq "VmcreatedEvent"}

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

I suspect your 2nd run profited from the cached events from your 1st run.
The name of the Folder has no impact whatsoever on the duration of the collecting the events, the cache does.


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

Reply
0 Kudos