VMware Cloud Community
esxi1979
Expert
Expert
Jump to solution

Get what all things a user did over 1 week in vcenter..

Hello

Get what all things a user did over 1 week in vcenter..

Say  user X logged in in vcenter

that user  X put host A in miant mode

User X did disable DRS on cluster B

So on ...

i know what to use

can someone guide ?

eg i know its Get-VIEvent

Get-VM  | Get-VIEvent -MaxSamples ([int]::MaxValue)  -Start (Get-Date).adddays(-7) | `

where {$_.Gettype().Name -eq "VmDeployedEvent" -or $_.Gettype().Name -eq "VmCreatedEvent" -or $_.Gettype().Name -eq "VmRegisteredEvent" -or $_.Gettype().Name -eq "VmClonedEvent"}

1 Solution

Accepted Solutions
dmmcsherry
Enthusiast
Enthusiast
Jump to solution

This should get all events initiated by the specified user over the past 7 days.

$user = "domain\username"

Get-VIEvent -MaxSamples ([int]::MaxValue)  -Start (Get-Date).adddays(-7) | Where-Object Username -eq $user

If you want an exported CSV

$user = "domain\username"

Get-VIEvent -MaxSamples ([int]::MaxValue)  -Start (Get-Date).adddays(-7) | Where-Object Username -eq $user | Export-Csv C:\path\UserEvents.csv -NoTypeInformation

View solution in original post

2 Replies
dmmcsherry
Enthusiast
Enthusiast
Jump to solution

This should get all events initiated by the specified user over the past 7 days.

$user = "domain\username"

Get-VIEvent -MaxSamples ([int]::MaxValue)  -Start (Get-Date).adddays(-7) | Where-Object Username -eq $user

If you want an exported CSV

$user = "domain\username"

Get-VIEvent -MaxSamples ([int]::MaxValue)  -Start (Get-Date).adddays(-7) | Where-Object Username -eq $user | Export-Csv C:\path\UserEvents.csv -NoTypeInformation