c#用psexec作为系统执行更多命令 [英] c# execute more commands with psexec as system

查看:262
本文介绍了c#用psexec作为系统执行更多命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用psexec作为系统连接到远程工作站,然后使用特定字母映射网络驱动器,然后在该磁盘上运行脚本。

I have to connect to a remote workstation with psexec as system then map a network drive with a specific letter and then run a script on that disk.

我是能够与psexec连接,但我不知道如何在同一个psexec会话上运行更多命令。

I'm able to connect with psexec but I don't know how to run more command on the same psexec's session.

谢谢

推荐答案

您已在C#论坛上发布此内容。 您是否只是在使用psexec时遇到问题,或者您是否真的在C#应用程序中调用psexec?

You've posted this in a C# forum.  Are you just having trouble with the usage of psexec, or are you actually invoking psexec from inside a C# application?

EASIEST方法是创建一个可以满足您需要的批处理文件,复制批处理文件到远程计算机,并使用psexec调用批处理文件。  psexec可用于运行交互式会话,但这是一项更复杂的任务。 
您必须将管道连接到进程的stdin和stdout,然后发送单独的命令,就好像您是用户以交互方式键入一样。

The EASIEST method is to create a batch file that does what you need, copy that batch file to the remote computer, and invoke the batch file with psexec.  psexec can be used to run an interactive session, but that's a much more complicated task.  You have to connect pipes to the stdin and stdout of the process, and then send individual commands as if you were a user typing interactively.


这篇关于c#用psexec作为系统执行更多命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆