是否可以rdesktop
在 Linux 中使用工具运行 Windows 命令?我尝试了以下rdesktop -s
选项:
rdesktop -u user -p 10.0.0.2 -s "cmd.exe"
Run Code Online (Sandbox Code Playgroud)
但我无法cmd.exe
使用上述命令打开,我也尝试使用完整路径:
rdesktop -u user -p'password' 10.0.0.2 -s "C:\WINDOWS\system32\cmd.exe"
Run Code Online (Sandbox Code Playgroud)
但即使我使用-s
.
我正在尝试qwinsta /server
从 Linux获取在 Windows 中使用的 RDP 会话列表。
我没有使用的解决方案,rdesktop
但我使用winexe
在 Linux 上调用的程序在 Windows 机器上执行远程命令。您可以从以下 URL 获取应用程序或使用您的发行版的软件存储库系统来安装它。
更新:SSL 证书是为上面的 sourceforge 链接自签名的,所以我提供了另一个链接:
下面是一个用法示例:
winexe -A credentials.cfg //remotehost "qwinsta /server"
Run Code Online (Sandbox Code Playgroud)
您将要使用登录信息创建一个 credentials.cfg 文件,如下所示:
username=user
password=pass
domain=workplace
Run Code Online (Sandbox Code Playgroud)
仅提供适用于您的域。最好不要将您的登录凭据(尤其是密码)放在命令行上。cmd.exe
如果您需要交互式提示,请尝试使用上面的示例运行。这种方法的好处是您可以在 Linux 脚本中使用远程命令的输出或 grep 输出。
小智 5
If you have access to the computer, install an ssh server on it.
On Linux you can use for example Overlook-Fing to find the IP of the computer.
Then you type
ssh username@ipaddress
into the Linux shell.
Example:
ssh Lenovo@192.168.0.100
Run Code Online (Sandbox Code Playgroud)
Then type the user's password and you should have access to the computer's Windows Command Prompt. You could also use telnet but ssh is encrypted.