我正在处理脚本,它会让我知道远程桌面(Windows服务器)上所需应用程序的运行状态(运行/停止) 我的代码运行正常,直到我登录远程桌面(使用“远程桌面连接”)..如果我关闭它而不注销..它继续正常工作..但是当我从那里注销时...它只是停止工作..这里有一件事我注意..甚至在我在ssh客户端上运行命令后注销...它给出了一些成功的确认
当从网络中的任何其他计算机启用该服务器的远程桌面连接时,我确实得到了所需的输出
当我从远程桌面连接注销时,所有下载的代码和输出
string runCommand = "wmic process call create "TestClient.exe";
SshCommand command = ssh.RunCommand(runCommand);
string myData = command.Result;
之后myData会有
执行(Win32_Process) - >创建()
方法执行成功。
输出参数:
instance of __PARAMETERS
{
ProcessId = [some pid in numeric]; //when I be logged off, this field would not be there.. (case of problem)
ReturnValue = [some numeric];
};
但在执行此操作后,我通过以下代码检查测试客户端的状态..
string rumCommand = "wmic process where "TestClient.exe" get ProcessID, ExecutablePath";
SshCommand command = ssh.RunCommand(rumCommand);
string myData = command.Result;
但myData !!!中没有列出任何正在运行的应用
按照以下方式连接ssh客户端..
string pass = "password";
PasswordAuthenticationMethod PasswordConnection = new PasswordAuthenticationMethod("user_name", pass);
KeyboardInteractiveAuthenticationMethod KeyboardInteractive = new KeyboardInteractiveAuthenticationMethod("user_name");
ConnectionInfo connectionInfo = new ConnectionInfo(serverIP, port, "user_name", PasswordConnection, KeyboardInteractive);
SshClient ssh = new SshClient(connectionInfo);
if (!ssh.IsConnected)
ssh.Connect();
答案 0 :(得分:0)