Client Management Suite

 View Only
  • 1.  display current user logon

    Posted Oct 19, 2014 09:34 PM

    Greetings Everyone,

    Need a little assistance from the kind community, I am attempting to generate a report where it achieves the following:

    - To only display the current user that is logged in on the machine if that same user is part of the local admin group on that client machine.

    I am very weak in SQL and have only achieved the below so far:

    SELECT DISTINCT
       [ID].Name AS [Machine Name],
       [ID].[Last Logon User],
       [ID].[Client Date] AS [Last Logon],
       AGM.[Domain] + '\' + AGM.[member name] as Membership
       
    FROM
       [Inv_AeX_AC_Identification] AS [ID],
       [vRM_Computer_Item] AS [VR]
          JOIN [Inv_UG_Admin_Group_Members] AS [AGM]
             ON ([VR].[Guid] = [AGM].[_ResourceGuid])
    WHERE
    AGM.Domain not like '%domainname.local%'
    AND
    AGM.Domain not like '%domainname%'
    AND
    AGM.[Member Name] not like '%Administrator%'
    AND
    AGM.[Member Name] not like '%Domain%'
    AND
    AGM.[Member Name] not like '%Helpdesk%'
    AND
    AGM.[Member Name] not like '%domainname2%'
    AND
    AGM.[Member Name] not like '%sysgsoc%'
    AND
    AGM.[Member Name] not like '%qmmadtgt'
    AND
    AGM.[Member Name] not like '%User&'
    AND
    AGM.[Member Name] not like '%Dell-Clone%'

    Many thanks in advance for any assistance rendered.



  • 2.  RE: display current user logon

    Posted Oct 22, 2014 10:10 AM

    I think this would work.  You'd need to add the other stuff you included.

     

    select c1.Name, id1.[Last Logon User], a1.*

    from vRM_Computer_Item c1

    join Inv_UG_Admin_Group_Members a1 on c1.Guid = a1._ResourceGuid

    join Inv_AeX_AC_Identification id1 on c1.Guid = id1._ResourceGuid

    where a1.[Member Name] = id1.[Last Logon User] and a1.Domain = id1.[Last Logon Domain]