VMware Cloud Community
tomtom1
Enthusiast
Enthusiast

Get the userid id from Tasks&Events

Hi, I want the list of all the VMs that have a userid called "xyz" in initiated by section. I know, we can get this with get-vievent cmdlet but now sure, how I can use it ? any help will be greatly appreciated.

If the list shows the VMs that don't have that userid, that will also do

Thanks

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

You mean something like this ?

Get-VIEvent -Start (Get-Date).AddDays(-1) -MaxSamples ([int]::MaxValue) | 
Select CreatedTime,
@
{N="Type";E={$_.GetType().Name}},
@{N="VM";E={$_.Vm.Name}},
@{N="User";E={$_.UserName}}


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

Reply
0 Kudos
tomtom1
Enthusiast
Enthusiast

Actually, this is giving me the data and time. Which I don't need.

I am looking for one particular user in each and every VM. And that user name will only be under "initiated by" column, under tasks and events.

I need the VM name and in next column that username.

Thanks for your help !!!

Reply
0 Kudos
LucD
Leadership
Leadership

I see, something like this ?

$userName = "user"

Get-VIEvent
-Start (Get-Date).AddDays(-1) -MaxSamples ([int]::MaxValue) | where {$_.UserName -eq $userName} |
Select @{N="VM";E={$_.Vm.Name}}, @{N="User";E={$_.UserName}}


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

Reply
0 Kudos