Visual Studio 内的 psexec

发布于 2024-07-13 10:27:50 字数 277 浏览 7 评论 0原文

我一直在尝试让 psexec 从 Visual Studio 中的自定义构建任务在远程计算机上运行可执行文件。 所有这些命令都可以从命令行运行,但从应用程序运行它似乎是一个问题。 有些命令可以工作,但其他 psexec 会挂起,因此 msbuild 和 Visual Studio 2005 也会挂起。在这种情况下,我调用 SharePoint 的 stsadm.exe,但从应用程序运行 psexec 时,很多程序都会出现此问题。 有很多人遇到这个问题,但似乎没有解决方案,所以我的问题是:有人知道 psexec 的可行替代方案吗?

I've been trying to get psexec to run executables on remote machines from custom build tasks in visual studio. All of these commands work from the command line but running it from an application seems to be a problem. Some commands work, on other psexec hangs and consequently so do msbuild and visual studio 2005. I'm calling SharePoint's stsadm.exe in this case, but this problem occurs with a lot of programs, when running psexec from an application. There are lots of people having this problem, but there seems to be no solution, so my question is: Does anyone know a working alternative to psexec?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

唔猫 2024-07-20 10:27:50

我在对远程系统执行 PSEXEC 时经历过“挂起”,但我总是将其归因于远程进程运行所在的安全上下文。

来自 PSEXEC 帮助:

如果您省略远程用户名
进程在同一帐户中运行
你执行 PsExec,但是因为
远程进程正在模仿它
将无法访问网络
远程系统上的资源
。 什么时候
您指定远程用户名
进程在帐户中执行
指定,并且可以访问任何
该帐户拥有的网络资源
进入。 注意密码是
以明文形式传输至
远程系统。

如果您远程执行一个进程,然后需要访问数据库 (stsadm.exe),那么尝试访问网络资源可能会失败,具体取决于 PSEXEC 的执行方式。 如果是这样的话,我想它最终会超时并给出某种资源不可用的消息。

在对远程计算机执行部署步骤时通常会执行两件事,以防止出现您所描述的行为:

  1. 就像 rifferte 提到的那样,确保所需的所有资产
    部署是本地到远程
    机器(复制文件等)之前
    使用 PSEXEC 执行脚本(*.bat、*.vbs、*.ps 等)-
    这样一切都在“本地”运行
    远程机器。

  2. 使用以下命令运行 PSEXEC
    域用户名/密码
    执行它 - 请注意,这
    信息以明文形式传递
    到远程服务器。

I've experienced 'hangs' when executing PSEXEC against a remote system, but I always attributed it to the security context in which the remote process was running under.

From PSEXEC help:

If you omit a username the remote
process runs in the same account from
which you execute PsExec, but because
the remote process is impersonating it
will not have access to network
resources on the remote system
. When
you specify a username the remote
process executes in the account
specified, and will have access to any
network resources the account has
access to. Note that the password is
transmitted in clear text to the
remote system.

If your executing a process remotely, that then needs to access the database (stsadm.exe), then it could be failing trying to access the network resource, depending on how PSEXEC was executed. If thats the case, I'd imagine it would eventually time out and give some sort of resource unavailable message.

There are two things that generally done when executing deployment steps against a remote machine to prevent the behavior your describing:

  1. Like rifferte mentioned, make sure all assets needed to
    deploy are local to the remote
    machine (copy files, etc) before
    using PSEXEC to execute the script (*.bat, *.vbs, *.ps, etc) -
    so that everything runs 'local' to
    the remote machine.

  2. Run PSEXEC using
    a domain username/password when
    executing it - note that this
    information is passed in clear text
    to the remote server.

森林迷了鹿 2024-07-20 10:27:50

总有RCE

RemCom 很小(10KB upx 包装)
Remoteshell / telnet 替换
让您可以远程执行进程
windows系统,远程复制文件
系统,处理输出和
将其流回。 它允许执行
直接使用远程 shell 命令
完整的交互式控制台,无需
必须安装任何客户端软件。
在本地机器上它也能够
模仿所以可以用作沉默
替换 Runas 命令。

There's always RCE.

RemCom is a small (10KB upx packed)
remoteshell / telnet replacement that
lets you execute processes on remote
windows systems, copy files on remote
systems, process there output and
stream it back. It allows execution of
remote shell commands directly with
full interactive console without
having to install any client software.
On local machines it is also able to
impersonate so can be used as a silent
replacement for Runas command.

盛夏尉蓝 2024-07-20 10:27:50

您可以尝试让 psexec 调用一个 bat 程序,该程序在远程计算机上执行您需要的内容。 我在 installutil.exe 中遇到了这个问题。 远程计算机上的一个简单的bat文件解决了这个问题。

您还应该在 sysinternals 板上分享您的经验。 在未来的修订中他们可能可以做一些事情。

You can try to have psexec call a bat program that executes what you need on the remote machine. I ran into this issue with installutil.exe. A simple bat file on the remote machine resolved it.

You should also share your experience on the sysinternals board. There may be something they can do in a future revision.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文