Kaseya Community

Uninstalling Agent via script

  • Hi,

    We are looking for a good way to schedule a uninstall of a agent. When our customer wants to quite the services (SLA), they have to stop it at leased 3 months before the end date of the SLA. At this moment we have to remember to delete the agent on a specific date. We are looking for a way to schedule this so the agent will be automaticly deleted at the date we set. This its not a standard feature so i guess we have to write a script. Writing a uninstall script for the agent can be done, but when unistalling the agent on the machine the agent will still be still present on the Kaseya server. Does anyone know a way to delete the agent on the server as well?

    Thanks!

    Legacy Forum Name: Uninstalling Agent via script,
    Legacy Posted By Username: Informatics
  • What about using Windows' very own Task Scheduler? You should be able to create a .job (or use the AT command) to schedule the uninstaller to run.

    Make a simple kaseya script that either copies a prewritten task (.job file) to the target machines or use the Execute Shell Command to create a new job. Set the start date for the job to run the same day the SLA terminates.

    It might be better to just create yourself a task in Outlook/Connectwise/Autotask/whatever or schedule service ticket for that day. That way you won't run into the same problem if the client chooses to renew/renegotiate (remembering to cancel the uninstall job).

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: CeruleanBlue
  • CeruleanBlue
    What about using Windows' very own Task Scheduler? You should be able to create a .job (or use the AT command) to schedule the uninstaller to run.


    SchTasks is a much better CLI interface to scheduled tasks than the old AT command. Have a look at it.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: RCS-Michael
  • Thanks for the replies!

    Uninstalling the agent with a script is working. But when i uninstall the agent on the machine it self, it won't send out a signal to the Kserver to delete the agent profile. So in this case my Kserver will be full with agents that not exist anymore and showing offline.

    To keep my server clean i want to build a extra line into my script that delete's the agent (profile) on the Kserver as well....

    Can this be done?

    Thanks!

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Informatics
  • Have you thought of setting a reminder every month or so, to clear out entries that havent checked in within a certain period of time?

    That'd get rid of all your old/inactive accounts.

    This can be found under the agent tab - delete.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: LANWorx