Re: [python-win32] User login details when running a service

2020-04-12 Thread Waseem Afser
I was kind of blank when I started off with the link you provided but with some searching i got into a post which got Queries and i used it this way : objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator") strComputer = "." objSWbemServices =

Re: [python-win32] User login details when running a service

2020-04-11 Thread Tim Roberts
On Apr 11, 2020, at 6:32 AM, Waseem Afser wrote: > > Is there any possible method to get the logged in user's username from a > windows service ? Your assumption that there is only one "logged in user” is false, which is why the information you seek is not readily available. There is a WMI

[python-win32] User login details when running a service

2020-04-11 Thread Waseem Afser
Is there any possible method to get the logged in user's username from a windows service ? FYI: getpass.getuser() and other similar methods return the computer name instead of the username of the user when the script runs as a service. ___ python-win32