virtualdive
VMware Employee
VMware Employee

Task/Events for a ESX or VM: PowerCLI script

Jump to solution

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
0 Kudos
24 Replies
ShortsAllYear
Contributor
Contributor

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?  

 

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
system_noida
Enthusiast
Enthusiast

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

0 Kudos
LucD
Leadership
Leadership

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

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

0 Kudos