Automation

 View Only
  • 1.  need to find out login info in vcenter

    Posted Jul 03, 2019 05:55 PM

    I am trying to find out login info on a user using this

    Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) -Server vcenter | where{ $_ -is [VMware.Vim.UserLoginSessionEvent] -and {$_.Username -contains "domain\username"}} | Out-GridView

    but I am not seeing the info for the user.

    any idea why



  • 2.  RE: need to find out login info in vcenter

    Posted Jul 03, 2019 06:29 PM

    The -contains operator checks if the right-hand side value is present in the array on the left side, so that is not the correct operator in this case.

    Try with -eq

    Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) -Server vcsa.local.lab |

    where { $_ -is [VMware.Vim.UserLoginSessionEvent] -and $_.UserName -eq 'domain\user' } |

    Out-GridView

    If you want to check for multiple users, you could use the -contains operator.

    Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) -Server vcsa.local.lab |

    where { $_ -is [VMware.Vim.UserLoginSessionEvent] -and 'domain\user1','domain\user2' -contains $_.UserName } |

    Out-GridView



  • 3.  RE: need to find out login info in vcenter

    Posted Jul 04, 2019 01:24 PM

    hi Luc

    how can i get the vcenter info as well here?

    foreach($vc in $global:DefaultVIServers){

    Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) -Server $vc | where { $_ -is [VMware.Vim.UserLoginSessionEvent] -and $_.UserName -eq 'domain\username' } |

    Sort-Object -Property CreatedTime -Descending | select USername, IPAddress, createdtime, USeragent

    }



  • 4.  RE: need to find out login info in vcenter
    Best Answer

    Posted Jul 04, 2019 02:21 PM

    Try like this

    foreach ($vc in $global:DefaultVIServers)

    {

       Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) -Server $vc |

       where { $_ -is [VMware.Vim.UserLoginSessionEvent] -and $_.UserName -eq 'domain\username' } |

       Sort-Object -Property CreatedTime -Descending |

      select Username, IPAddress, createdtime, USeragent, @{N = 'vCenter'; E = { $vc.Name } }

    }

    ---------------------------------------------------------------------------------------------------------

    Was it helpful? Let us know by completing this short survey here.



  • 5.  RE: need to find out login info in vcenter

    Posted Jul 04, 2019 05:03 PM

    Thanks Luc



  • 6.  RE: need to find out login info in vcenter

    Posted Jul 04, 2019 05:10 PM

    any idea what this is under useragent?

    IpAddress CreatedTime UserAgent

    x.x.x.x 7/3/2019 8:43:36 AM h5-client/6.5.0

    x.x.x.x 7/3/2019 8:43:36 AM h5-client/6.5.0

    127.0.0.1 7/3/2019 8:10:13 AM h5-client/6.5.0



  • 7.  RE: need to find out login info in vcenter

    Posted Jul 04, 2019 05:18 PM

    That looks like access from the HTML 5 Web Client