[python-win32] Automating logon/logoff
Matt Herbert (matherbe)
matherbe at cisco.com
Thu Oct 18 15:42:53 CEST 2007
> -----Original Message-----
> From: Tim Golden [mailto:mail at timgolden.me.uk]
> Sent: Thursday, October 18, 2007 3:07 AM
> To: Matt Herbert (matherbe)
> Cc: python-win32 at python.org
> Subject: Re: [python-win32] Automating logon/logoff
>
> Matt Herbert (matherbe) wrote:
> > Hello all,
> >
> > I am stumped trying to figure out how I can automate the
> login/logoff
> > procedure on Windows. Here is what I know so far. First, I
> can logoff
> > the system pretty easily using win32api.ExitWindowsEx() function.
> > Second, I can auto logon the system (after a reboot) using
> the special
> > registry keys (DefaultUserName, DefaultPassword, DefaultDomain).
> > Third, I will have to wrap everything up in a service, so I can be
> > running at the desktop and the logon screen.
> >
> > So the hard part that I can't figure out, is how do I
> programmatically
> > initiate a logon, after a logoff? Here is the rough
> sequence of events
> > I want to achieve:
> >
> > 1 MyPyService is running (at desktop)
> > 2 User requests an automated test
> > 3 MyPyService starts the test
> > 4 MyPyService logs the user off
> > 5 MyPyService wait's for something to happen
> > 6 MyPyService logs a user on
>
> I may be misunderstanding, but following the information here:
>
> http://msdn2.microsoft.com/en-us/library/aa378750.aspx
>
> I added, in addition to the keys you mention above:
>
> AutoAdminLogon = 1
> AutoLogonCount = 1
>
> I logged out and -- sure enough -- it logged me back in as me.
>
> Is that what you were after?
>
> TJG
>
Thomas, I've seen this. The problem is, I can't "hold off" the logon.
It automatically logs the user in right away. I need to be able to
hold off the logon, until I've verified that I have established a
network connection during step 5. That may take anywhere from a couple
of seconds, to a couple of minutes (worst case).
Thanks
-Matt
More information about the python-win32
mailing list