Take Screenshot Errors out, message is Take screenshot: System.ComponentModel.Win32Exception (6)

My process encounters an error when triggered from the Orchestrator as per schedule. I could not get the actual error message, this is because the “Take Screenshot” activity that I had configured in the Catch block also errors out causing only the exception hit by the “Take Screenshot” activity to get recorded in the orchestrator logs. The error however, does not occur when the process is run from the Studio inside the VM. The error message that is given when the “Take Screenshot” activity errors out is

Take screenshot: System.ComponentModel.Win32Exception (6): The handle is invalid. at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation) at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation) at UiPath.Vision.UiImage.FromScreenRegion(Rectangle region) at UiPath.Vision.UiImage..ctor(Rectangle region, Int32 rotationDegree) at UiPath.Core.Image..ctor(Region screenRegion)

In an attempt to pin down the cause for the Take Screenshot error, I ran the process from the Orchestrator while being logged into the VM, the error did not occur and the process completed successfully. Based on previous posts in this forum I gather that this has got to do with the license. However, I don’t know much about this. Another thing I had noticed was this at the Start page of the Studio:
It had a warning at the foot bottom of the page:

“Detected Unattended Robot as the license type. Based on the terms and conditions, this license should only be used for troubleshooting purposes.”

My Studio version is as follows:

Studio version 2023.4.3
Enterprise License
User-mode Installation

Kindly assist me to solve this problem. Please let me know if you need more information from me. Thank you.

@RobinsonFrancis,

This could happen due to open connection to VM machine. When we manually login into the VM and just close it that time this error occures.

Try reproducing it by login into VM and just close without Log Out.

Solution would be log out from the server properly by clicking on Log out.

Thanks,
Ashok :slight_smile: