VMware Cloud Community
thisischristia1
Contributor
Contributor
Jump to solution

Get-VIEvent Specific Time Range of a Specific date

So for some reason when Get-VIEvent was written, it uses the Date/time interval as MM/DD/YEAR. It does not allow you to specify the time without parsing it.

Does anyone have any workarounds in order to get all events of any date for a specific time? Any ideas?

0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

The Start and Finish parameters of the Get-VIEvent cmdlet expect a DateTime object as input. The Get-Date cmdlet returns a DateTime object. So, you can use the Get-Date cmdlet to return a specific time. The following command will return all of the events that happened between May 14th 2017 08:23 and 08:28.

Get-VIEvent -Start (Get-Date -Day 14 -Month 5 -Year 2017 -Hour 8 -Minute 23) -Finish (Get-Date -Day 14 -Month 5 -Year 2017 -Hour 8 -Minute 28)

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership
Jump to solution

The Start and Finish parameters of the Get-VIEvent cmdlet expect a DateTime object as input. The Get-Date cmdlet returns a DateTime object. So, you can use the Get-Date cmdlet to return a specific time. The following command will return all of the events that happened between May 14th 2017 08:23 and 08:28.

Get-VIEvent -Start (Get-Date -Day 14 -Month 5 -Year 2017 -Hour 8 -Minute 23) -Finish (Get-Date -Day 14 -Month 5 -Year 2017 -Hour 8 -Minute 28)

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos