Facing Issue while taking the Screenshots via Unattended BOT in Virtual Machine

Hello everyone,

I’m facing an issue while taking the Screenshots via unattended BOT in Virtual Machine. It is giving me this exception.

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)

Please try to help me ASAP.

Thanks.

This means that someone has logged into the server via RDP and then just closed the RDP window. You have to SIGN OUT from the start menu.

So now, log into the server via RDP (using the same account you’re running the automation with) and then sign out from the start menu. Now run the automation.

1 Like

For your reference:

@pratik.pandya Just Log in to the RDP → Click on Left corner Window Icon → Sign Off!

Execute the process again from orchestrator or Trigger!

Regards,
Ajay Mishra

Why do you just copy the answer someone else gave?

Hey @postwick Apology,

Cause the answer was same!

Any issues then I can delete the post?

Best Regards,
Ajay Mishra

@postwick Thanks for replying.

I have tried accessing the RDP and then sign out from the Start Menu but after I sign out, my ROBOT is also disconnected from that machine then I’m not able to run the BOT from the orchestrator.

Help me on this…!!!

That means when you installed Robot you did not select service mode, so it’s running in user mode. Reinstall and make sure to select service mode.