‎05-01-2018 09:57 PM
Select Top 1000000 tblADusers.Username,
tblADusers.Userdomain,
SubQuery1.Lastlogon,
SubQuery1.DaysSinceLogon,
tblADusers.Lastname,
tblADusers.Firstname,
tblADusers.Description,
tblADusers.City,
tblADusers.Zip,
tblADusers.Country,
tblADusers.UPN,
tblADusers.Title,
tblADusers.Department,
tblADusers.OU,
tblADusers.email,
tblADusers.Lastchanged,
tblADusers.IpPhone,
tblADusers.HomeDirectory,
tblADusers.ProfilePath,
tblADusers.LogonScript,
tblADusers.whenCreated,
tblADusers.whenChanged,
tblADusers.EmployeeType,
tblADusers.Info,
tblADusers.Division,
tblADusers.ADUserID,
tblADusers.EmployeeID,
tblADusers.EmployeeNumber
From tblADusers
Left Join (Select Top 1000000 tblCPlogoninfo.Username,
tblCPlogoninfo.Domain As Userdomain,
Max(tblCPlogoninfo.logontime) As Lastlogon,
DateDiff(day, Max(tblCPlogoninfo.logontime), GetDate()) As DaysSinceLogon
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) SubQuery1 On SubQuery1.Username = tblADusers.Username
And SubQuery1.Userdomain = tblADusers.Userdomain
Where SubQuery1.Lastlogon Is Not Null And
tblADusers.OU Not Like '%OU=Disabled Accounts%'
Order By tblADusers.Userdomain,
tblADusers.Username
‎03-07-2022 06:06 PM
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Lastseen
Left Join lansweeperdb.dbo.tblAssets On tblADusers.Username = tblAssets.Username
‎03-07-2022 01:13 PM
‎05-04-2018 09:00 PM
‎05-04-2018 04:27 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now