如何在远程 PC 上执行 Windows 命令?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11935695/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to execute a Windows command on a remote PC?
提问by bubble
Is it possible to execute a Windows shell command on a remote PC when I know its login name and password? Is it possible to do it using client PC's Windows shell?
当我知道登录名和密码时,是否可以在远程 PC 上执行 Windows shell 命令?是否可以使用客户端 PC 的 Windows shell 来完成?
回答by Raphi Pour
psexec \RemoteComputer cmd.exe
or use ssh or TeamViewer or RemoteDesktop!
或使用 ssh 或 TeamViewer 或 RemoteDesktop!
回答by user3744855
If you are in a domain environment, you can also use:
如果您在域环境中,还可以使用:
winrs -r:PCNAME cmd
This will open a remote command shell.
这将打开一个远程命令外壳。
回答by Eyal Sooliman
You can use native win command:
您可以使用本机 win 命令:
WMIC /node:ComputerName process call create “cmd.exe /c start.exe”
The WMIC is part of wbem win folder: C:\Windows\System32\wbem
WMIC 是 wbem win 文件夹的一部分:C:\Windows\System32\wbem
回答by Birat Bade Shrestha
This can be done by using PsExec
which can be downloaded here
这可以通过使用PsExec
可以在这里下载
psexec \computer_name -u username -p password ipconfig
If this isn't working try doing this :-
如果这不起作用,请尝试这样做:-
- Open RegEdit on your remote server.
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.
Add a new DWORD value called LocalAccountTokenFilterPolicy
- Set its value to 1.
- Reboot your remote server.
- Try running PSExec again from your local server.
- 在远程服务器上打开 RegEdit。
导航到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System。
添加一个名为 LocalAccountTokenFilterPolicy 的新 DWORD 值
- 将其值设置为 1。
- 重新启动远程服务器。
- 尝试从本地服务器再次运行 PSExec。