Executes a command on the Remote Host.

Namespace: Jscape.Telnet
Assembly: Jscape.Telnet (in Jscape.Telnet.dll) Version: 2.6.1.0

Syntax

C#
public byte[] Execute(
	string hostname,
	string username,
	string localUsername,
	string command
)
Visual Basic
Public Function Execute ( _
	hostname As String, _
	username As String, _
	localUsername As String, _
	command As String _
) As Byte()
Visual C++
public:
array<unsigned char>^ Execute(
	String^ hostname, 
	String^ username, 
	String^ localUsername, 
	String^ command
)

Parameters

hostname
Type: System..::..String
The hostname or IP address of the Remote Host.
username
Type: System..::..String
The username for the Remote Host.
localUsername
Type: System..::..String
The username for the Remote Host used to execute the command.
command
Type: System..::..String
The command to execute on the Remote Host.

Return Value

Result, as byte array, from Remote Host.

Examples

This example returns the results of a directory listing command executed under root user on the Remote Host. Substitute a valid Remote Host, port, user, and local user for the hostname, port, username, and localuser parameters.
CopyRsh Execute
Rsh rsh = new Rsh();            
byte[] response  = rsh.Execute("hostname", "username", "root", "ls -al");
string data = rsh.Encoding.GetString(response);            
Console.WriteLine(data);

CopyRsh Execute
Private WithEvents rsh As Rsh
rsh = New Rsh
Dim response As Byte() = rsh.Execute("hostname", "username", "root", "ls -al")
Dim data As String = rsh.Encoding.GetString(response)
Console.WriteLine(data)

See Also