maxx203
Contributor
Contributor

Limited amount of lines

Hello, 

could someone please tell me, why the following command does only show 100 lines instead of 1000 i want to see? I need to check a specfic time range and i dont get it how to do that. 

Get-VIEvent | Where-Object UserName -ilike "*" | Select-Object CreatedTime,ipaddress,username,fullformattedmessage -Last 1000 


Regards
Maxx

0 Kudos
3 Replies
mmcgill1
VMware Employee
VMware Employee

Hi Maxx,

You can specify the "MaxSamples" parameter to specify 1000 to return.  It defaults to 100 if not specified.

ie,

Get-VIEvents -MaxSamples 1000

0 Kudos
mmcgill1
VMware Employee
VMware Employee

Correction: "Get-VIEvent -MaxSamples 1000"

I added an "s" by mistake 🙂

0 Kudos
LucD
Leadership
Leadership

By default, Get-VIEvent returns only 100 events (the 100 most recent ones).
You can use the Start and Finish parameter to specify a specific time range.
In that case you don't have to use the MaxSamples parameter.

Get-ViEvent -Start (Get-Date).AddHours(-8) -Finish (Get-Date)

# If only Start or Finish, you'll get only 100 events back
Get-ViEvent -Start (Get-Date).AddHours(-8)

# You can combine this with MaxSamples
Get-ViEvent -Start (Get-Date).AddHours(-8) -MaxSamples ([int]::MaxValue)


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

0 Kudos