Has anyone been able to script (or anything else) that will delete/retire a Labtech agent?

I have looked in the scripting actions and can't find anything there.

Right now I have a monitor that looks for agents that have not checked in for X days and sends an alert for me to remove it, but that means I have to perform an action... 

Views: 5515

Reply to This

Replies to This Discussion

I have a script I just finished up on yesturday to retire old labtech agents that have no checked in within the last 4 months (time frame easily editable). Also makes notes about the reason the agent was retired


I've also got a script that will delete the labtech software from agents.


I'm currently working on a script to automate our client offboarding processes. Cleans up the labtech update settings, disableds accounts, removes the hidden drive labtech uses, uninstall the agent, mark the agent as offboarded, and then delete it from labtech. Still some tweaks to be made, but should only be a few extra hours of work once it's all said and done will save us some huge time on cleaning up the system

So are you actually using a <whatever> built into Labtech to retire the agent? Or are you doing all of this stuff in the database yourself?  I'm mostly looking to use this for computers that have not checked in for a few months so we can keep our client locations clean of replaced/retired/old computers.

that's exactly the reason I built this script. We have a few clients that have a very rapid turn orver. They typically prefer to re-image a pc, rather than have anyone work on an issue for more than 45 minutes. so PC's are always coming and going in labtech.


I have two scripts in labtech that perform all the work. One script to find the old computers, and another to do the actual removal. but the actual cleanup command to retire the agent is sp_DeleteComputer(<computerID>,'Reason for deletion')


I can share my scripts for you if you like, or you can build it yourself. But that's the command you're looking for. You can use labtech SQL EXECUTE script command to do it. It will move the agent to the Retired Agents section of a location with the reason you put in there. The agent will stop checking in, even if the software is still installed

That's good info, thanks.

Though, I am curious as to how you found that command.

labtech scripting forums. Been trying to figure out for weeks how to do it automatically, posted on the scripting forums and got a response from someone there with that command.

Ah. It would be a great help if these things were documented and organized somewhere/somehow. 

If they are, I don't know about it.

yeah, the documentation is very hit and miss especially when you're trying to do any advanced work. I've found on more than one occasion their support have a completely different documentation than what they provide online. We get screen shots of their documentation from support rather than the actual document itself. Why they won't just put the updated version on the website, I don't know.

The new 2011.2 release that is supposedly vary close to release has an Agent Uninstall function in the script language.


Could you please share your SQL command?

Hey guys, for those of you who are still working on this issue, I came up with this SQL Query which will delete all retired agents that are older than 60 days. This is for MySQL**

 DELETE FROM retiredassets WHERE retireddate < (CURRENT_DATE - INTERVAL 60 DAY)

I had Labtech confirm that deleting a retired asset in your SQL Database will release the license that the retired agent holds. Just run this query as a scheduled task and youre all set and done. 


Sorry for the late reply. 

There is also logic in LT to allow you to keep the same agent name if the same computer comes back.  We use this logic along with imaging so that we can keep a machine history.  For example, reimaging a PC might wipe ticket history on a box that is old and getting long in the tooth.  You lose your ability to take a stack of tickets to management to show the time lost by the employee.  It might also hide a history of bluescreens or low memory, etc. 

We never remove a PC in an automated manner because it could be a very real issue that a box isn't checking in for an extended period.  In fact, that issue alone creates a ticket in our system for a human to go track the machine down and see what is broken. 

It sounds to me like you have a workflow problem that needs to be addressed. 

You can have agents keep their same Labtech ID by following the directions here (it's a reg key on the server):


Resign by MAC Address

  • This option lets a new computer that signs up to assume the role of a computer in the system rather than create a new account.
  • It uses the MAC address of the computer to do the association.
  • In order for the association to work, the computer must be offline for 90 minutes.

For 32-bit systems:
Set the HKLM\SOFTWARE\LabTech\Global\MacSignup registry key to True.
Set the HKLM\SOFTWARE\LabTech\Global\MacSignupTimeLimit registry key to -90.

For 64-bit systems:
Set the HKLM\SOFTWARE\wow6423node\LabTech\Global\MacSignup registry key to True.
Set the HKLM\SOFTWARE\wow6423node\LabTech\Global\MacSignupTimeLimit registry key to -90.

Reply to Discussion


© 2017   Created by Ben Johnson.   Powered by

Badges  |  Report an Issue  |  Terms of Service