Renci SSHNet 无法正常工作
Renci SSHNet not working properly
我正在编写脚本,它将让我知道远程桌面(windows 服务器)上所需应用程序的 运行 宁状态(running/stopped)
在我登录远程桌面(使用 "Remote Desktop Connection")之前,我的代码运行良好。如果我在不注销的情况下关闭它。它会继续正常工作。但是当我从那里注销时。它只是停止工作..我注意到一件事..即使当我在 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 中不会列出任何 运行ning 应用程序!!!
按照以下方式连接 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();
是的,这是一个非常简单的问题,但也很困难。因为我已经通过任务调度程序制作了测试客户端(我正在测试它们是否 运行)运行 并且忘记勾选复选框,这表明即使在注销后它也会是 运行 ..选中此复选框..一切正常
我正在编写脚本,它将让我知道远程桌面(windows 服务器)上所需应用程序的 运行 宁状态(running/stopped) 在我登录远程桌面(使用 "Remote Desktop Connection")之前,我的代码运行良好。如果我在不注销的情况下关闭它。它会继续正常工作。但是当我从那里注销时。它只是停止工作..我注意到一件事..即使当我在 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 中不会列出任何 运行ning 应用程序!!!
按照以下方式连接 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();
是的,这是一个非常简单的问题,但也很困难。因为我已经通过任务调度程序制作了测试客户端(我正在测试它们是否 运行)运行 并且忘记勾选复选框,这表明即使在注销后它也会是 运行 ..选中此复选框..一切正常