IP*Works! SSH V9 - Online Help
IP*Works! SSH V9
Questions / Feedback?

Execute Method

Execute a command on the remote PowerShell Server.

Syntax

[VB.NET]
Public Sub Execute(ByVal Command As String)
[C#]
public void Execute(string command);

Remarks

The Command parameter contains the text of the command to execute. If the connection to the server hasn't been explicitly made before with the SSHLogon method, then the component will establish a new connection, execute the command and immediately close it. If a connection has been previously established, it will still be open when the command is done.

If the command returned any errors, an exception will be raised with the error information returned by the server.

Example: Executing a command and iterating over the results

psclient1.Execute("ls c:\\");
for ( int i=0; i < psclient1.PSObjectCount; i++ ) {
   psclient1.PSObjectIndex = i;
   Console.WriteLine("{0}", psclient1.PSObject["Name"].Value);
}

NOTE: This method has a corresponding asynchronous version (ExecuteAsync) for use in the Xamarin environment.

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
Build 9.0.6240.0