Tuesday, April 2, 2013

Find the last computer that joined your LabTech Server

Quick and easy:

SET: @sqlIdOutput@ = SQLRESULT[SELECT MAX(ComputerId) FROM computers]
SET: @sqlClientNameOutput@ = SQLRESULT[SELECT clients.name FROM clients JOIN computers USING(clientid) WHERE computerid = '@sqlIdOutput@']

Create Informational Alert on ComputerID #1:  The latest computer ID is @sqlIdOutput@ and can be found as a member of the @sqlClientNameOutput@ client.



[UPDATE]
(Hat tip to fellow LabTecher Kevin D for calling this out)
It seems there's an assumption in this logic.  It holds - UNLESS you've used the resignup utility.  If you have, we can't assume the highest computer ID = the last computer to be added.  Thanks Kev! (sorta.. )

No comments:

Post a Comment