This article explains how to get the licensed user count in Confluence using Confluence Command Line Interface (CLI).
Use the getServerInfo action to get the number of licensed users with the outputFormat parameter. This is applicable for Confluence v7.1 and higher.
Run the CLI action as follows:
--action getServerInfo --outputFormat 2
You can verify the value of Current licensed users from the output of the CLI action as shown: