I'm currently developing a Bot that takes and saves screenshots in certain steps of a process. However, when I deploy the Bot in a Virtual Machine (I'm using Remote Desktop Protocol), it works fine only if I have the RDP connection opened. Otherwise, if I close the window of the connection, the bot continues running (the session is sitll active) but it takes screenshots of the windows log-in menu, instead of the screens of the process.
If you minimize a Remote Desktop window (the window that displays the remote computer’s desktop), Windows switches the remote session to a GUI-less mode and does not display windows and controls. As a result, you will not be able to capture screenshots of the machine and you may find other functionality will fail, such as SendKeys and other functions that may require a GUI. Fortunately, Windows provides a way to enable the GUI through a registry setting. Below are steps to enable this setting.
On your local computer, close all open Remote Desktop sessions.
Launch the Registry editor (regedit.exe).
Navigate to the following Registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client
Create a DWORD value named RemoteDesktop_SuppressWhenMinimized and set it to 2
Now, if a machine is locked or the user is logged off, you also will not be able to take screenshots. It is possible to exit a Remote Desktop session without logging out as explained in this Product Support Community post:
The important point I want to explain is that if there is no GUI or the applications are not visible on the Desktop, screenshots are not possible. This is not a Pega Robotics defect / limitation. Rather, it is a limitation from Windows / Microsoft.