Hi @Sunnywaygis,
Well usually I would use the below code to get the users but going over 10 000 there seems to be some hard limit so you can use the below code and specify the users manually or get them through a rest query,
I would also query and use the users one at a time because you are downloading a lot of objects. but the below code will download all the users of a enterprise we also add the portal_id for AGOL otherwise you get public content and the !_esri to ignore Esri built in users.
user_manager = arcgis.gis.UserManager(con)
portal_id = 0123456789ABCDEF # for arcgis enterprise only
users_count = user_manager.advanced_search(query=f"{portal_id} AND !_esri", return_count=True)
users = []
for user_num in range(1,users_count +1):
try:
user = user_manager.advanced_search(query=f"{portal_id} AND !_esri",start=user_num, max_users=1)
users.append(user)
except Exception as e:
print(f"User {user_num} failed")
for user in users:
print(user)