Use script to send a user defined string at regular intervals

For servers that are unable to recognize Keep Alive signals, you can use script to periodically send a string to keep the server alive. The instructions below will show you how to send the "enter" key which is utilized by many users in these types of situations.

INSTRUCTIONS


Below, we've used Xshell Script (VB script) to send a user defined string at a user defined interval.


  1. Create the following and save it as a file.

    Sub Main
    'xsh.Screen.Synchronous = true
     
    Dim lab
    lab = 0
    Do
    While true
    xsh.Session.sleep 3000
    if xsh.Session.Connected = 0 Then
    Exit Do
    else
    ' xsh.Screen.Send lab
     xsh.Screen.Send vbCr
    end if
    'lab = lab + 1
    Wend
    Loop
    'xsh.Screen.Synchronous = false
    End Sub
  2. Connect to a desired session.
  3. Go to 'Tools -> Script -> Run' and select the created file and run it.