[python-win32] Take Screenshot when you log in remotely [Win 7 Pro]

Ferdinand Sousa ferdinandsousa at gmail.com
Mon Jul 16 13:52:11 CEST 2012


Hi Tim,

Thanks a lot for the inputs. Earlier (Win Xp I think), I was told
(erroneously?) that using the /console switch with the mstsc command would
enable you to connect into a currently running local user session. Is this
info incorrect? Or is it that you are able to connect to the said session,
but it changes to a remote session? I would tend to think it is the latter.

Also, now with Win 7 (client is Professional and machine I'm connecting to
is also Professional) mstsc seems to no longer have the /console switch.

I guess I just have to bite the bullet and work with this. My **specific
issue** is that my scenario works pretty well with task scheduling and
leaving the local session locked. However, if I log in remotely using the
same user (session become remote I guess),  or even a different user
(disconnects the local user's session) the screenshot can no longer be
taken.

Best regards,
Ferdi


> ---------- Forwarded message ----------
> From: Tim Roberts <timr at probo.com>
> To: "python-win32 at python.org" <python-win32 at python.org>
> Cc: "image-sig-request at python.org" <image-sig-request at python.org>
> Date: Thu, 5 Jul 2012 10:24:51 -0700
> Subject: Re: [python-win32] Take Screenshot when you log in remotely [Win
> 7 Pro]
> Ferdinand Sousa wrote:
> >
> > I have written a script that uses the screenshot() function from the
> > ImageGrab module of the Python Imaging library and I would like to run
> > this script as a scheduled task.
> >
> > Now for the issues. In the task scheduler, if I select 'Run whether
> > user is logged on or not', it does run, but the scheduler shows it as
> > failed to run.  This happens both when logged in or if logged in and
> > session is locked
> >
> > So, I chose to use the 'Run only when user is logged on' option. Now,
> > this works well, when logged on as well as if the session is locked.
> > The problem is if I try to login remotely via RDP this stops working
> > the moment I disconnect.
>
> Right.  When you disconnect the session, there no longer is any screen
> to take a shot of.  Screenshots are implemented by calling the graphics
> driver.  A disconnected session does not have a graphics driver.
> Windows does not keep a backing store copy of a session's frame buffer
> anywhere.  When a disconnected session is reconnected, all of the
> applications are sent "paint" messages to force the screen to be
> repainted from scratch.
>
>
> > Is there any option I could use to make it work under 'Run whether
> > user is logged on or not' Task scheduler option?
> > Maybe I could reduce the privilege level needed to execute python.exe?
>
> That won't help.  What you ask is simply not possible.  The bits you
> want to grab do not exist.
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120716/06ea2088/attachment.html>


More information about the python-win32 mailing list