Take Screenshot error when running in background on vm

Hello,

When I tested “Take Screenshot” activity locally it worked fine, but when I tried to run it in background on a vm, I got the following exception:

Take Screenshot: System.ComponentModel.Win32Exception (0x80004005): 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.Core.Image…ctor(Region screenRegion)

I tried changing hight, width, depth from orchestrator, but it didn’t solve the problem. Is this problem caused by new updates because I’ve seen some solutions saying that for this type of exception I should uninstall and install everything again.

Thank you!

1 Like

@cnicomaria

Welcome to community

Is your bot is running as a Unattended bot license?

Thanks

Yes, my robot is Unattended.

@cnicomaria

which studio version? Is it community or enterprise?

Thanks

Studio pro 2020.10.2 community license

Pablito can you please help?

Studio Pro 2020.10.2 Community License
Orchestrator 2020 Community License
User Mode Robot (I’ve checked the service, screenshot below with what I can see on our VM)
Unattended robot (resolutions set + login to console - set to no)

Error getting only when running from Orchestrator (for Take Screenshot activity - the one from this post)

Can you, please confirm that the only solution for us to make it work is to acquire the EE and use the MSI installer? (maybe to opt for the trial version meanwhile?)

Thank you!

Pablito, loginerror can one of you please answer to us?

Thank you!

@claudia.kiss

Can you try a new flow and place the take screenshot activity

Try to publish this and run, if you experiencing same error, please share the screenshot, from logs

This will help to debug the issue

Thanks

As stated in the post, this is what we get:
Take Screenshot: System.ComponentModel.Win32Exception (0x80004005): 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.Core.Image…ctor(Region screenRegion)

But only if we try to run from Orchestrator and simulate an error to be caught by the Global Handler (where the Take Screenshot activity is located) we receive it.

Hi

What I See about this issue is PC is “locked” and robot cannot access to Desktop. If you are using Teamviewer, AnyDesk or Similar, make sure PC is not locked (Windows + L)

1 Like

I have the same issue.
image

Btw this is an attended VM. When I run it in the Assistant it works.

But starting from Orch will let it fail with that message. Is that really intended?

But I need that screenshot on that VM. How is that possible then?