Tim thank you for responding. I did some reading and now I am more familiar with windows services. Basically yes I want to create a service to do the following:
1) Track logon time - send info to remote mongoDb 2) Track plugged/unplugged devices, battery level and some apps - send info to remote mongoDb 3) Track logoff time - send info to remote mongoDb So far I can track logon/logoff, plugged devices and battery level at logon/logoff by adding my script to the Users Local Group Policy, scripts (Logon/Logoff) section. I would like to write a service that every 2-5 min checks from devices, battery level and apps and sends the data to remote MongoDb. Then at logoff records the time and send it to the remote MongoDb instance. Thank you again for your help, sorry for the confusion! -----Original Message----- From: python-win32 [mailto:python-win32-bounces+jrodriguezorjuela=luc....@python.org] On Behalf Of Tim Roberts Sent: Thursday, June 09, 2016 12:26 PM To: Python-Win32 List Subject: Re: [python-win32] Track-session-events Rodriguez Orjuela, Jose Luis wrote: > > > I am writing a python script to track laptop usage. So far I am able > to do simple stuffs username, machine, logon time, ip address, etc. > Now I am trying to capture user logoff and sessions changes (screen > lock). Related to user sessions I found a great blog ( > http://timgolden.me.uk/python/win32_how_do_i/track-session-events.html > #isenslogon > <http://timgolden.me.uk/python/win32_how_do_i/track-session-events.htm > l%23isenslogon> > ) that explores some of this things but I haven't been able to > identify the key parts that I can use in my case. I am looking to > capture logoff datetime as well as screen lock and store it in a > remote DB. Here is a fragment of the code in the blog that I am trying > to use to accomplish this. It would be great if someone can guide me > in the right direction. > I'm confused. What do you want to know? The code you posted is from a Windows service, which gets launched when the machine boots up and continues to run until the power turns off. That's the only way you can catch logoffs and session changes. Are you writing a service? -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32