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

Tim Roberts timr at probo.com
Sat Apr 11 14:09:20 EDT 2020


On Apr 11, 2020, at 6:32 AM, Waseem Afser <waseem.afser at gmail.com> 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 query that can return the name of all logged in users:

https://stackoverflow.com/questions/5218778/how-do-i-get-the-currently-logged-username-from-a-windows-service-in-net <https://stackoverflow.com/questions/5218778/how-do-i-get-the-currently-logged-username-from-a-windows-service-in-net>
— 
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/20200411/af66fea4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3279 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-win32/attachments/20200411/af66fea4/attachment.bin>


More information about the python-win32 mailing list