- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
instead of -contains "Successfully restored" try -match "Successfully restored"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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