I want to find the users who are using ArcGIS 10.2 license with python script. Also, what kind of license they are using. Is it possible to get the number of users which are connected to ArcGIS server but inactive or not using it so that I can disconnect those user to free the license for the other users who really need it.
Adding to MC5's answer, I get this info using the LMUTIL.EXE in the license manager ..\bin folder.
Here is the DOS command I use: lmutil lmstat -a -c @LMservername
Regarding "inactive" licenses, there is no way to get anything like this using Flexera. I've tried and ESRI has confirmed it is not possible. All the LM will tell you is who is connected and the time of connection. Inactivity is subjective.
At the risk of being vague: ArcGIS (as of 10.1) uses FlexNet Publisher License Manager v11.9. See the License Manager Reference Guide. There doesn't appear to be a programmatic API, though there is an audit log. In prior versions of the license manager my colleagues used to use BAT or Perl to examine the license manager logs, I'm not clear if the new license manager's log is plain text to allow that. Maybe check the Flexera website to see if they describe an API to their product.