windows 保持远程桌面会话“活跃”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5528412/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:32:46  来源:igfitidea点击:

Keeping remote desktop session "alive"

windowsautomationrdpautoit

提问by lysergic-acid

I'm using AutoIt to automate GUI operations (connecting to the machine that's running the to-be-automated app, using RDP). Whenever I minimize the RDP window (using mRemote) no further AutoIt commands are performed.

我正在使用 AutoIt 来自动化 GUI 操作(使用 RDP 连接到运行要自动化的应用程序的机器)。每当我最小化 RDP 窗口(使用 mRemote)时,不会执行进一步的 AutoIt 命令。

Maybe the RDP session is marked "inactive" when I minimize the window (I don't know if that's true, nor how to configure this behavior, if so). I'm thinking about 2 options to overcome this:

当我最小化窗口时,可能 RDP 会话被标记为“非活动”(我不知道这是否属实,也不知道如何配置此行为,如果是的话)。我正在考虑 2 个选项来克服这个问题:

  1. Running my process as some elevated user (or a service).
  2. Finding this configuration which controls whether session is marked inactive and override it.
  1. 作为某个提升的用户(或服务)运行我的进程。
  2. 查找此配置以控制会话是否标记为非活动并覆盖它。

How to keep remote desktop session "alive" when the RDP window gets minimized?

当 RDP 窗口最小化时,如何保持远程桌面会话“活动”?

回答by Alexey Ivanov

We had the same problem with RDP. A workaround we used was to open another remote desktop session to connect to the same server:

我们在 RDP 上遇到了同样的问题。我们使用的解决方法是打开另一个远程桌面会话以连接到同一台服务器:

  1. You connect to severwith RD.
  2. From RD of step 1, you connect to serveronce again.
  1. 您连接到severRD。
  2. 从步骤 1 的 RD,您server再次连接到。

This way the 2nd session will be still "active" when you minimize or even disconnect your first RD session. Of course your Remote Desktop server has to support multiple connections from the same user.

这样,当您最小化或什至断开第一个 RD 会话时,第二个会话仍将处于“活动状态”。当然,您的远程桌面服务器必须支持来自同一用户的多个连接。

回答by msl

You might want to attach your current RDP session to the CONSOLE. In such case even after disconnection the UI will be still active.

您可能希望将当前的 RDP 会话附加到 CONSOLE。在这种情况下,即使在断开连接后,UI 仍将处于活动状态。

TSCON {sessionid | sessionname} /DEST:CONSOLE

回答by Andrey Regentov

The accepted answer doesn't work if there is no rdp session at all, and you still want automate it through AutoIt.

如果根本没有 rdp 会话,则接受的答案不起作用,并且您仍然希望通过 AutoIt 使其自动化。

They sayin this case you should not use WinActivate and use ControlSend in AutoIt scripts instead, and it would work smoothly. And yes, that works, checked it myself.

他们说在这种情况下你不应该使用 WinActivate 而是在 AutoIt 脚本中使用 ControlSend,它会顺利运行。是的,这有效,我自己检查过。

回答by 9ikhan

My nightly regression suite used to fail on my local machine because enterprise rules locked the machine automatically after 14 mins of inactivity. So I wrote a small vbScript program to press "PrintScreen" key every 12 mins and it really solved the problem. Though this was not on RDP, but executing something similar on remote machine would help.

我的夜间回归套件曾经在我的本地机器上失败,因为企业规则在 14 分钟不活动后自动锁定机器。所以我写了一个小的 vbScript 程序每 12 分钟按一次“PrintScreen”键,它确实解决了问题。虽然这不在 RDP 上,但在远程机器上执行类似的操作会有所帮助。