Visual Studio 内的 psexec
我一直在尝试让 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在对远程系统执行 PSEXEC 时经历过“挂起”,但我总是将其归因于远程进程运行所在的安全上下文。
来自 PSEXEC 帮助:
如果您远程执行一个进程,然后需要访问数据库 (stsadm.exe),那么尝试访问网络资源可能会失败,具体取决于 PSEXEC 的执行方式。 如果是这样的话,我想它最终会超时并给出某种资源不可用的消息。
在对远程计算机执行部署步骤时通常会执行两件事,以防止出现您所描述的行为:
就像 rifferte 提到的那样,确保所需的所有资产
部署是本地到远程
机器(复制文件等)之前
使用 PSEXEC 执行脚本(*.bat、*.vbs、*.ps 等)-
这样一切都在“本地”运行
远程机器。
使用以下命令运行 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 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:
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.
Run PSEXEC using
a domain username/password when
executing it - note that this
information is passed in clear text
to the remote server.
总有RCE。
There's always RCE.
您可以尝试让 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.