Taking Screenshot while VM is locked

Hi Team,

I was trying to take a screenshot in web automation.

It works fine when I open the machine and run it. However when I run when windows screen of prod machine is locked, it throws following exception.

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)

Is there a way to take screenshot in simulate way that is even if the screen is locked.

Please help.

Thanks & Regards,
Jeevan.

Hi @Jeevan_Reddy ,

If you disconnect and let the bot run then it will else if you lock or minimize the vm while running it would fail as the screen is not active. For that case any UI Activity would fail. You have to disconnect then it can take .

cheers

Hi @Jeevan_Reddy,

You can use the Take Screenshot activity in the exception block or use the global exception handler to catch unexpected issues. Whenever an exception occurs it will take a screenshot and save it in the given folder.

I had the same issue few days before, if you specify the area of which you want to take the screenshot in the take screenshot activity it won’t work. Just drag and drop the take screenshot activity.

The only thing here is it will capture the whole screen and it will save it as you have specified within the screenshot activity

image

As you can see from the image above I am capturing a screenshot of my file explorer and have not indicated what area to take so it captures the whole screen. This perfectly works in unattended mode and under a lockscreen. Tested and verified

Hello Ishan,

Agree But as per the business requirement I am suppose to capture only one table no all the screen.

Any suggestion on how i can achieve this.

Thanks!

Hello Anil,

But Its a prod machine and its configurations are set in that ways for which we cant change.

The screen lock is set that way.

Any other ways to handle this.

Thanks & Regards,
Jeevan.

Hi @Jeevan_Reddy

If its prod machine then why are you logging in or keeping thw window minimized?. Are you trying to debug?

Ideally the bot would login and logout and you need not open any window. Am i missing something here?

Cheers

Hello @Anil_G ,

I am not logging in. The Bot only logging in to the machine.

While taking the screenshot it throws an error.
System.ComponentModel.Win32Exception (0x80004005):

In take screenshot activity i have specified the element.

In attended mode it works fine but in unattended mode it throws error.
Thanks.

Hi @Jeevan_Reddy

Is the bot installed in service mode?

try enabling the log into console on robot settings in orchestrator and check if that solves

Cheers