windows - Python: How to get domain\username for logged in user -
in python how logged in username in domain\username format. following username:
import getpass import os; print(os.getlogin()) print(getpass.getuser())
here go :
import os domain = os.environ['userdomain'] print(domain)
(but see doest give fqdn, netbios name)
Comments
Post a Comment