I know this is an old thread, but since this theme has been repeated more than once, I thought I might update it and any others I see with the below.
Whereas I don't have a complete solution for you, I have one that will get you most of the way there. I have been working on a PowerShell module for Kaseya (available here - http://k2int.codeplex.com/). One of the cmdlets that has been implemented is the ability to remove an agent with the option to uninstall first, though the default is to remove without uninstall. This can be paired with the Get-KCMDMachine cmdlet to accomplish what you are looking for with only minor modification.
I am working on updating the module so it can readily, and securely, be run as an agent procedure against the KServer itself (in K2 only obviously) to accomplish the desired agent purge. Right now it can technically be run from a script, but any script would need to first import the module and would also have to have the password at runtime. The updated module, which I hope to have up in the next week or so, should allow you to pre-generate the required hashed password and be able to provide this at runtime.
Hope this helps.
Thanks, I'm looking forward to you're work, this is something that should te available Out of the Box
It's not really hard to do, go to the agent menu, click on the delete button. At this stage go ahead and display all agents or the client who you specifically want to delete agents from. At this stage it will display all agents, however if you click the "Select agents that have not check in since (then select the month and the day) and it will auto select the agents. Choose the second option to delete the account only (would be my suggestion just in case that machine turns on again). Click delete and all old accounts will just disapear.
This process takes around 2 minutes and can just be done once a month.
Resurrecting the thread once again...
The problem that I'm currently having is with a client we no longer service. They had several hundred agents deployed, and we've been spending months removing them from the system. We had previously purged machines that hadn't checked in for more than 90 days, but they are apparently still out there. Every couple of days, some machine will get pulled out of a closet and turned on. We have email alerts set up, so as soon as we see the email, we have to hurry up and uninstall/delete before it gets turned off again.
It would be nice if there was a way to either block agents from ever checking in again, or set up an option to automatically uninstall/delete for a group or organization when agents check in for the first time.
Go to System->License Manager, select the group and click on Change License Allocations. Set the Agents Max limit to 0 or 1 for that group.
Resurrecting the thread once more :)
There's a feature request for this on the helpdesk