windows 在远程服务器中使用 AutoIt _ScreenCapture_Capture 创建屏幕截图不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7514062/
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 18:07:59  来源:igfitidea点击:

Creating screenshot with AutoIt _ScreenCapture_Capture in remote server does not work

windowsscriptingscreenshotautoit

提问by Andriusa

I have a farm of virtual windows servers and they are autonomously running various desktop applications and I want to have easy way to see what's going on on each server without connecting through RDP. So I have created a simple AutoIt script which automatically runs every minute and creates a screenshot of virtual servers desktop:

我有一个虚拟 Windows 服务器群,它们自主运行各种桌面应用程序,我希望有一种简单的方法来查看每台服务器上发生的情况,而无需通过 RDP 进行连接。所以我创建了一个简单的 AutoIt 脚本,它每分钟自动运行一次并创建虚拟服务器桌面的屏幕截图:

#NoTrayIcon
#include <WinAPI.au3>
#include <ScreenCapture.au3>
#include <WindowsConstants.au3>

$LocalIP = _getLocalIP()
_ScreenCapture_Capture($CmdLine[1] & "\network\shared\screenshot_" & $LocalIP & ".jpg")

...

...

The problem I am having is that screenshot only displays desktop with apps when I am connected to it through RDP, once I close it - screenshot will appear black and only mouse pointer is visible.

我遇到的问题是,当我通过 RDP 连接到桌面时,屏幕截图仅显示带有应用程序的桌面,一旦我关闭它 - 屏幕截图将显示为黑色并且只有鼠标指针可见

Is there any way I can create screenshot even if RDP session is closed? Is that possible?

即使 RDP 会话关闭,有什么方法可以创建屏幕截图?那可能吗?

回答by Gal

Like mentioned in previous replies - this is probably due to the machine being locked. You can try to use a script that will unlock the remote station, and then perform a screen capture. Have a look at this post in autoit forum

就像之前的回复中提到的 - 这可能是由于机器被锁定。您可以尝试使用解锁远程站的脚本,然后执行屏幕捕获。看看这个帖子在 autoit 论坛