VMware Cloud Community
virtualdive
VMware Employee
VMware Employee
Jump to solution

Task/Events for a ESX or VM: PowerCLI script

Hello All,

Please can someone suggest a script that copies all the Task/Events entries of a VM or ESX to html or excel sheet and mail it. It should be particular server not all servers in vCenter.

Thanks,

Regards,

'V'
thevshish.blogspot.in
vExpert-2014-2021
Reply
0 Kudos
24 Replies
ShortsAllYear
Contributor
Contributor
Jump to solution

I was wondering how to get all Events from the top cluster from a starting date to an ending date.  The only fields I need are Description, User and Date stamp.  In your code below I don't know what the purple is, would that be the variable name I wish to use?  

 

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I'm not sure what code and which part in purple you are referring to.
Perhaps it is better to create a new thread.


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

Reply
0 Kudos
system_noida
Enthusiast
Enthusiast
Jump to solution

Hi Luc,

I am too looking to export the task and event details of VMs but I have multiple VMs. Please could you help me to input the csv or txt file for the multiple VMs and export the Events details

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Basically, that could be something like this

$vmNames = Get-Content -Path .\vmnames.txt
$vm = Get-VM -Name $vmNames
Get-VIEvent -Entity $vm -Start (Get-Date).AddDays(-1)  |
Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture 


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

rachappachalmi
Enthusiast
Enthusiast
Jump to solution

Hi LucD,

 

Thanks for this script, but I want that out file with date and VM name , can you help me on this pls.

 

Regards

Rachappa

Reply
0 Kudos