简体   繁体   English

无法使用python在psexec等远程窗口上执行.exe文件

[英]Unable execute .exe file on remote windows like psexec using python

I have found the following code(see below link) to copy and execute the commands on remote windows machine. 我发现以下代码(请参见以下链接)可在远程Windows计算机上复制并执行命令。 I could able to run all the windows commands but When I give C:\\file.exe as the input windows command line is not executing my command. 我可以运行所有Windows命令,但是当我输入C:\\ file.exe作为输入Windows命令行时,它不执行我的命令。 Can I execute file in remote machine like this or is any other pythonic way of doing this? 我可以在这样的远程机器上执行文件吗? Please help...Thanks In advance 请帮忙...谢谢

http://code.activestate.com/recipes/577945-execute-remote-commands-on-windows-like-psexec/ http://code.activestate.com/recipes/577945-execute-remote-commands-on-windows-like-psexec/

As with psexec, the user id being used by the script should have local administrator rights on the remote computer. 与psexec一样,脚本使用的用户ID在远程计算机上应具有本地管理员权限。 If you are using the root of C:\\ to store the executable your actions could be limited by Windows security and I would also recommend using a subdirectory for the executable with the NTFS permissions relaxed (Everyone - modify) for testing. 如果您使用C:\\的根目录来存储可执行文件,则您的操作可能会受到Windows安全性的限制,并且我还建议您为可执行文件使用一个子目录,并放宽NTFS权限(所有人-修改)进行测试。

my guess would be that your py2exe executable has dependencies, and that the effective path for your executable (running remotely) is different from the path locally, and because of this, some of these dependencies are not available when run remotely. 我的猜测是您的py2exe可执行文件具有依赖性,并且您的可执行文件(远程运行)的有效路径与本地路径不同,因此,在远程运行时,其中一些依赖性不可用。

psexec has an interactive shell option, if you use it and try to run your executable, you might get a better idea of how it is failing. psexec有一个交互式外壳程序选项,如果使用它并尝试运行可执行文件,则可能会更好地了解它是如何失败的。 you could also dump out the path and compare to the path on a local command prompt on that machine, etc. 您还可以转储路径,并与该计算机上本地命令提示符下的路径进行比较,等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM