在远程桌面会话中创建进程?

发布于 2024-08-13 18:50:56 字数 42 浏览 4 评论 0原文

如何使用 C# 在特定远程桌面会话中调用进程,以便它在特定上下文中启动

How do I invoke a process in a specific remote desktop session so that it will start in that particular context using C#

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

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

发布评论

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

评论(2

━╋う一瞬間旳綻放 2024-08-20 18:50:56

我使用 wtsapi 中的 CreateProcessAsUser() 方法获得了它,所以没有更多问题。

I got it using the CreateProcessAsUser() method from wtsapi so, no more issues.

故事和酒 2024-08-20 18:50:56

您是否考虑过使用 SysInternals 的 PsExec?这将允许您远程运行进程,如果您指定与远程登录用户相同的凭据,那么它将“在其 rdp 会话中运行”,如您所说。

如果您因为无法提供正确的凭据而无法做到这一点,那么您剩下的唯一真正选择就是执行常规系统管理员会执行的操作 - 例如,在用户登录时运行批处理或 powershell 文件,或者设置要运行的计划任务那个用户。

Have you thought about using PsExec from SysInternals? This will allow you to run a process remotely, and if you specify the same credentials as the remotely logged in user then it will "run in their rdp session" as you put it.

If you cannot do that because you cannot supply the right credentials, then the only real options you have left are to do what regular sysadmins would do - e.g. run a batch or powershell file upon user login, or set up a scheduled task to run for that user.

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