dhanu2k7
Enthusiast
Enthusiast

task and events

hello I am using below script to pull events, when I ran, i am getting output but those are tasks and i am not getting events list, I verified in VC that event is there on cluster level event I am searching is Successfully restored access to volume****

$xxxxx= get-cluster xxxxx

Get-VIevent -entity $xxxxx -Start 03/23/2018 -Finish 03/26/2018 -maxsamples 10000 | Where {$_.FullFormattedMessage -contains "Successfully restored"} | select @{Name='host';E={$_.Host.name}}, @{N='user';E={$_.UserName}},@{N='Createdtime'; E={$_.CreatedTime}}, @{N='Fullmessage';E={$_.FullFormattedMessage}} anything wrong in the script? regards dhanu

Tags (1)
Reply
0 Kudos
IT_pilot
Expert
Expert

instead of -contains "Successfully restored" try -match "Successfully restored"

http://it-pilot.ru
Reply
0 Kudos
LucD
Leadership
Leadership

I'm not sure you can do this by looking at the FullFormattedMessage.

First try to determine which event you actually see for this.

Make sure the action actually occurred during the interval, then from the list of returned events find the one you should be filtering for

$xxxxx= Get-Cluster xxxxx

Get-VIevent -Entity $xxxxx -Start 03/23/2018 -Finish 03/26/2018 -MaxSamples ([int]::MaxValue) |

Group-Object -Property {$_.GetType().Name}


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

Reply
0 Kudos