Username of the current user (python geoprocessing tool)

Discussion created by mbhansen on Jan 14, 2013
Latest reply on Jan 24, 2020 by notoriusjackdevtrial
Is there a way to get the username of the current user within a python geoprocessing tool?

The username must be the name of the user logged on to my IIS web application with an ArcGIS Web Adapter.

The python script is published to an ArcGIS Server 10.1 with Active Directory and Web Tier authentication.

I have tried:

import getpass

However, this always returns "arcgis" (properly the ArcGIS Server service user identity).