RemoteExec

Parent Previous Next

You can use the RemoteExec adapter to execute a given command on a specified target machine.



Syntax

       public class RemoteExec


Members

RemoteExec(string computer, string user, string password, string command, string commandargs = null, string extraRemoteExecArgs = null)

The constructor

int RunProcess()

Run the process. If successful, the exit code of the process is returned

bool HasStartError()

Indicates whether there was a start error

string GetStartError()

Returns the start error that occured

string GetCommandLine()

Get a command line with the remoteExec file name and arguments



Sample

This sample shows how you execute Notepad on the specified computer as the session user


import clr

clr.AddReferenceToFileAndPath(Session.GetAdapterPath("IYOPRO.REMOTEEXEC"))

from IYOPRORemoteExecAdapter import RemoteExec


r = RemoteExec("<device name>", "", "", "notepad.exe", None, "-su -cs")

x = r.RunProcess()

print(r)

print(r.GetCommandLine())

print(r.HasStartError())