在PowerShell远程活动的用户会话启动程序 [英] Start a program in active user session with PowerShell remoting

查看:354
本文介绍了在PowerShell远程活动的用户会话启动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能检测到特定的用户有一个打开的会话的计算机上,并在会话打开过程,使应用程序可以使用PowerShell远程用户进行互动呢?

Is it possible to detect that a specific user has an open session on a computer and to open a process in that session so that the application can be interacted with by the user using PowerShell remoting?

我怎么会到处去检测哪些用户会在机器上打开,他们的状态(活动,空闲,断开,等...)?我怎么会在推出这些会议中的一个应用程序?

How would I go around detecting which users have sessions open on the machine and what their state is (active, idle, disconnected, etc...)? How would I launch an application within one of those sessions?

更新
我发现,你可以找出一个进程正在运行中的会话ID:

UPDATE
I have found that you can identify the session ID a process is running in:

PS > ( Get-Process notepad ).SessionId
1

我似乎无法找到无论如何要指定会话ID,当你虽然启动一个进程。

I can't seem to find anyway to specify the session ID for a process when you start it though.

推荐答案

PowerShell的不能做到这一点,但微软(previously sysinternal的)工具PSEXEC可以做到这一点。看看-i参数:

Powershell cannot do this, but microsoft's (previously sysinternal's) tool PSEXEC can do this. Take a look at the -i parameter:

 -i         Run the program so that it interacts with the desktop of the
            specified session on the remote system. If no session is
            specified the process runs in the console session.

这篇关于在PowerShell远程活动的用户会话启动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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