Forum

Sending command to ...
 
Notifications
Clear all

Sending command to multiple tabs

0 Posts
2 Users
0 Reactions
152 Views
 31
(@31special)
New Member
Joined: 14 years ago
Posts: 1
Topic starter  

Is there a way to send a command to multiple tabs using Absolute Telnet?

For example let say I have 30 tabs opened, each tab is a different server. I need to poweroff the servers and I want to do this by sending the command to all servers at the same time.

Is there a way to do this with Absolute Telnet?


   
ReplyQuote
(@bpence)
Member Admin
Joined: 9 months ago
Posts: 1374
 

This sounds like a job for scripting, but currently scripts only run within the context of the tab they are run in. There is no way for a script to issue commands to other tabs.

You could try the following:

1. Write a script that connects to each server and issues the shutdown command, then disconnects. Do this in a loop and loop through a list of servers. THis would all execute within a single script in a single tab.

2. AbsoluteTelnet/SSH *does* have the ability to run as an ActiveX control, however. You could write a C# program that uses Absolute to connect to each server, issue the shutdown, etc...

Need more help?

Brian


   
ReplyQuote
(@bpence)
Member Admin
Joined: 9 months ago
Posts: 1374
 

The script could look something like this. I created a file called c:serverslist.txt that contains a lis of servers you'd want to affect. This script reads through the list, connects to the server and issues a shutdown command. Your script may vary, depending on the connection type, login sequence, etc... But you should get an idea from here how it could be done.

This code can be implemented as an on-demand script using the key-mapping feature. The keyword VBSCRIPT at the beginning tells the key mapper to execute the following text as a script when the given key is pressed. Key mapping functionality can be found on the Options->Properties->VTOPtions page.

VBSCRIPT
  DIM objFSO, objFile, serverName, portNumber, userName, password, retval, timeout
sub MAIN
  Print "running"+vbNewLine
   set objFSO = CreateObject("Scripting.FileSystemObject")   
    set objFile = objFSO.OpenTextFile("c:\servers\list.txt",1) 
   Do until objFile.AtEndOfStream
     serverName =  objFile.ReadLine
     portNumber =  objFile.ReadLine
     userName =  objFile.ReadLine
     password =  objFile.ReadLine
     timeout = objFile.Readline

      Print "Shutting down: " + serverName + vbNewLine

     Terminal.SetConnectionType "ssh2"
     Terminal.SetConnectionHost serverName 
     Terminal.SetConnectionPort portNumber
     Terminal.SetSSHUsername userName
     Terminal.SetSSHPassword password


     retval = Terminal.Connect ( timeout )

    if(retval) then
       Terminal.WaitForTimeout  "~$", 10000 
       Terminal.Print("Connected")
       Terminal.SendText "sudo shutdown -r now" +vbNewLine
       Terminal.WaitForTimeout "password", 10000
       Terminal.SendText password+vbNewLine
       Terminal.WaitForTimeout "The system is going down"
       Terminal.Disconnect
    else
       Terminal.Print("Not Connected")
    end if
      
   Loop  
  objFile.Close
  Print "done"+vbNewLine
end sub

   
ReplyQuote
Share: