Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20958

Re: Who Logged Into This Server?

$
0
0

I think the query below might work for you. You can use it to create a report that can be displayed on the web. Either use the WHERE clause, or remove the line and select grouping by the IP Address in the Report Writer. Please note that this approach is not officially supported and the database schema is a subject to change, so the report may need a redesign with any upgrade to a newer version.

 

select UDT_User.AccountName, UDT_UserToIPAddressHistory.LogonDateTime, UDT_UserToIPAddressHistory.IPAddress

from dbo.UDT_UserToIPAddressHistory

join UDT_User on UDT_User.UserID = UDT_UserToIPAddressHistory.UserID

 

where UDT_UserToIPAddressHistory.IPAddress = '10.199.2.92'

 

order by UDT_UserToIPAddressHistory.LogonDateTime

 

 

This one should also include current connections (again, you can remove the two WHERE clauses and add grouping by IP Address in Report Writer):

SELECTDISTINCT userLatestLogin.RecentLogin AS [LogonDateTime], userLatestLogin.IPAddress, u.AccountName

FROM UDT_User u

INNERJOIN

(     SELECTMAX(uip.LogonDateTime)as [RecentLogin], uip.UserID,uip.IPAddress

  FROM (

  SELECT u2ip.LogonDateTime, u2ip.UserID, u2ip.IPAddress

  FROM UDT_UserToIPAddressCurrent u2ip

WHERE u2ip.IPAddress ='10.199.2.92' 

unionselect u2iph.LogonDateTime, u2iph.UserID,u2iph.IPAddress

  FROM UDT_UserToIPAddressHistory u2iph

WHERE u2iph.IPAddress ='10.199.2.92') uip

  GROUPBY uip.UserID,uip.IPAddress ) userLatestLogin

                                    ON u.UserID = userLatestLogin.UserID

 

                                    ORDERBY [LogonDateTime] DESC


Viewing all articles
Browse latest Browse all 20958

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>