0

I'm trying get screen capture through a SSH connection. In this SSH connection, I'm using the normal user. (in my case its PC)

I found that after executing this command:

screenshot-cmd -o test.jpg

and the same is with

screencapture test.jpg

the jpg file I got is all black. If I do this in the normal way (not through SSH), then I can get the screen capture successfully.

I tried to do it with task scheduler it works good, but it shows the command window, so I checked the option Run whether user is logged in or not and it doesn't show the command window at all, but then I have the problem with the black image.

What could be causing this?

I already googled for hours but didn't find something to work.

New contributor
RoseTeq is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2

2 Answers 2

0

Since you only need to be able to see the desktop, not to hide the window altogether, disable "Run whether user is logged in or not" and instead set your Task Scheduler task to open:

cmd /C start /min cmd /C "screencapture test.jpg"

The first cmd /C allows you to call start, which takes the /min flag to run a program minimized.

The second cmd /C runs the script or command that you want to run.

As far as using "Run whether user is logged in or not", in my experience it works oddly. Even when a user is logged in, it does not simply run the script in the same way as it would if the box were not checked. My best guess is that because of this behavior, the task did not have permission to view the screen. (It makes perfect sense, since you do not want to make it too easy to secretly run a task that spies on the user.) So instead of trying to get "Run whether user is logged in or not" to work as you would want, it makes sense to simply run the script minimized.

(Special thanks to JosefZ: How do I get task scheduler to run my batch file minimized)

2
  • Thanks @Michael, It works great, but one small problem, that the cmd window shows for a second in the taskbar and that is also something i don't really want.
    – RoseTeq
    Commented 2 days ago
  • You're welcome. I'm glad you found a better solution. 😁 Commented yesterday
0

After trying a few suggestions I found the right answer for me.

I created a batch file with the following args

start /b "screencapture test.jpg"

and then i called it with a vb script file.

So I just scheduled a task to run the .vbs file, and NOTHING is shown even for a split second.

Thanks for all who tried to help me!!

New contributor
RoseTeq is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .