Esri Support has a nice Python snippet allowing you to pull a list of your Enterprise users and that last time they logged in.
import arcgis
import time
from arcgis.gis import GIS
gis = GIS("https://domain.mycorp.com/portal", username="user1", password="pass1", verify_cert=False)
print("connected")
a_users = gis.users.search(query='', max_users=200)
a_users
for a_user in a_users:
if a_user. lastLogin != -1:
last_accessed = time.localtime(a_user. lastLogin/1000)
print(str(a_user. fullName) + " was last active on: {}/{}/{}\n".format(last_accessed[0], last_accessed[1], last_accessed[2]))
else:
print(str(a_user. fullName) + " has never logged in.\n")
Is there something similar in the API that can be used to see that last time a user authenticated from ArcGIS Pro? It would allow us to easily enumerate which users are no longer using ArcGIS Pro or have never used it even though they are assigned a license.