Hi,
that query would be quite a bit more complex as there isn't a single clean field that stores "last user" for all assets. There's the fields username and userdomain in tblAssets that get filled by Windows computer scans, Linux scans, Chromebook scans, etc. This is the one that makes the most sense to use I suppose. This doesn't contain a "friendlyname" though (first name, last name). Rather it contains the username used to log on to the machine with.
I've added a script below which fills userdomain\username in the Contact field, if username and userdomain are filled.
- Keep in mind that this script will overwrite any data that is currently already stored in tblAssetCustom.Contact, to avoid that, you'd need to adjust the where clause (only select rows with empty/NULL values in that field)
- Do be careful when running scripts, make sure you've got a backup ready, just in case. Keep in mind you can no longer run scripts via the web console, this was removed to improve the security of the application. You'll need to connect to your Lansweeper database using SQL Server Management Studio or user Program Files (x86)\Lansweeper\Tools\DatabaseMaintenance.exe
https://www.lansweeper.com/kb/94/backing-up-your-installation.html
UPDATE tblassetcustom
SET
contact = a.userdomain + '\' + a.username
FROM tblassetcustom
INNER JOIN tblassets a ON a.assetid = tblassetcustom.assetid
WHERE(username IS NOT NULL
AND username <> '')
AND (userdomain IS NOT NULL
AND userdomain <> '');