‎08-09-2022 11:59 AM - last edited on ‎04-01-2024 12:55 PM by Mercedes_O
Basically, I want to run an SQL to auto-populate the tblAssetCustom.Contact on what is in the Last User
Solved! Go to Solution.
‎08-12-2022 12:09 PM
I've added a script below which fills the scanned AD displayname in the Contact field, if the last logged on user was an AD user and this AD user was scanned via an Active Directory User Path target.
https://www.lansweeper.com/kb/94/backing-up-your-installation.html
Keep in mind that joining tblADUsers to the script will likely reduce the amount of assets targeted by it. It should still cover all of your Windows computers that have had logons by AD users if you've fully scanned your AD via an AD User Path scanning target.
UPDATE tblassetcustom
SET
contact = ad.Displayname
FROM tblassetcustom
INNER JOIN tblassets a ON a.assetid = tblassetcustom.assetid
INNER JOIN tbladusers ad ON ad.username = a.username
AND ad.Userdomain = a.Userdomain;
‎08-12-2022 12:09 PM
I've added a script below which fills the scanned AD displayname in the Contact field, if the last logged on user was an AD user and this AD user was scanned via an Active Directory User Path target.
https://www.lansweeper.com/kb/94/backing-up-your-installation.html
Keep in mind that joining tblADUsers to the script will likely reduce the amount of assets targeted by it. It should still cover all of your Windows computers that have had logons by AD users if you've fully scanned your AD via an AD User Path scanning target.
UPDATE tblassetcustom
SET
contact = ad.Displayname
FROM tblassetcustom
INNER JOIN tblassets a ON a.assetid = tblassetcustom.assetid
INNER JOIN tbladusers ad ON ad.username = a.username
AND ad.Userdomain = a.Userdomain;
‎08-16-2022 08:55 AM
I can confirm Script the worked! thanks a lot Bruce_B
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now