如何在远程 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 09:48:27  来源:igfitidea点击:

How to execute a Windows command on a remote PC?

windowscmd

提问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 PsExecwhich can be downloaded here

这可以通过使用PsExec可以在这里下载

psexec \computer_name -u username -p password ipconfig

If this isn't working try doing this :-

如果这不起作用,请尝试这样做:-

  1. Open RegEdit on your remote server.
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.

  3. Add a new DWORD value called LocalAccountTokenFilterPolicy

  4. Set its value to 1.
  5. Reboot your remote server.
  6. Try running PSExec again from your local server.
  1. 在远程服务器上打开 RegEdit。
  2. 导航到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System。

  3. 添加一个名为 LocalAccountTokenFilterPolicy 的新 DWORD 值

  4. 将其值设置为 1。
  5. 重新启动远程服务器。
  6. 尝试从本地服务器再次运行 PSExec。