Kaseya Community

Trying to create scripts that use Telnet

  • We have been trying to implement an automated process for performing routine telnet commands (creating a new user, opening ports, backing up config’s etc.), but unfortunately we have only had minimum success porting this to a kaseya script.


    The devices we are using are a mix of Cisco UC500 and ASA devices, and while ssh is an option we haven’t been able to get this working across the board.

    What we’ve tried:


    We have tried using the default Windows Telnet Client and a vbs file that uses sendkeys to send keystrokes to the active Window, while this works perfectly if you run it while logged into an active session, when we ported this into kaseya we tried to both execute the the necessary files as System and The currently logged on user (using both set agent credential and impersonate user) without any luck. The process simply starts and stays running and doesn’t actually finish.



    This utility uses a text file for your commands and will take wait for a specific string to be displayed and once it detects that string it will execute the next line.

    This worked brilliantly while logged into an active session, but we had the same problem as above when trying to do the same thing in kaseya. The process would run, but never finish.



    We also tried to use Putty/Plink to automate an SSH connection, but ran into an issue where putty would prompt you to accept an sha-cert, and we couldn’t find a switch to automate this process.


    Procedure Attached:

    The procedure attached is the one we wrote using tst10.exe to create a new user on the device.

    -Prompts for the login username/pass & the new username/pass to be created.

    -Uses the fart utility to simply a find & replace the values in the command file with the values entered above

    -Executes tst10.exe using set credential and outputs to a log file

    -Stores log to variable and emails the results


    The procedure runs everything successfully up until executing tst10.exe, the process runs and doesn’t finish/quite.

    Has anyone been able to script a telnet session?



  • Dave, that's a good one, How are you calling the script in Kaseya? are you using the execute file or execute commandline in the procedure? I'd use commandline as I've not had good success with execute file for calling vbscripts. It sounds like you're close if you've got the VBscript to do what you want.

  • There is a special trick to getting plink to accept the cert automatically...

    Create a text file, put inside of it "y" or "yes" and press Enter for a new line.

    When you run plink, run it with all your arguments to connect and at the end add < answerfile.txt

    It will read the content of the text file as if you typed it.

  • Ben, will you please impregnate my wife with our first born child?

  • If the child is already born, that would be a little painful.

  • SMason, maybe that's a new service we can sell. ;)

    Another trick...

    echo y  | YOUR COMMAND HERE

    Will get "y" sent to your command.

    The advantage of going the < txtfile.txt route, is that you can chain multiple commands together.

  • Thanks Ben, we were able to get this up and running.

    We noticed that we had to accept the sha cert using the same user account that was running the script for it to go through, but no problems after that.

  • Hi David, Can you please send me the procedure for this, Im stuck at the same issue. pls