Retrieve the list of users with licenses
Information
You can download the script for retrieving the list of users from this link.
Prerequisites
- The Active Directory module for PowerShell installed on Windows Server.
- A working Axidian Access server.
- The user on whose behalf the script will be run must have the minimal global Inspector rights in the Axidian Access system.
How the script works
The script generates a CSV-format table with the following columns:
- <UserName>,
- <true>,
- <false>,
where true\false are the columns with the corresponding license name.
The array of licenses whose presence is checked for the user is the list of all registered licenses.
The operation of the script consists of several stages:
- An array of licenses loaded into the system is generated using the
/license/getAllLicensesmethod. - Using the
/api/v5/policy/getmethod, information about the policy is requested. - From the scope property, information about the configured
objects is requested using the
/api/v5/userCatalog/getObjectsmethod. - From the obtained objects, users are requested:
- Using the PowerShell cmdlet
Get-ADGroupin the functiongetUsersCNof the file Base/AdditionalFunctions/GetUsers.ps1 for an Active Directory group. - Using the PowerShell cmdlet
Get-ADUserin the functiongetUsersOUof the file Base/AdditionalFunctions/GetUsers.ps1 for an Active Directory organizational unit.
- Using the PowerShell cmdlet
- Using the
license/getCatalogObjectLicensesmethod, the presence of the user's licenses is requested and compared with the overall array of licenses. - Using the
addDataToCSVfunction of the file Base/AdditionalFunctions/CsvReport.ps1 a table in CSV format is assembled.
Configuration
For the script to work, you need to configure the Config.ps1 file, which is located in the root of the folder with the script.
In the file:
$serverUrl— URL of the Axidian Access server. Required parameter.$logsOnFile— enabling\disabling logging to a file. Required parameter. Enabled by default.$logsOnConsole— enabling\disabling logging to the console. Required parameter. Disabled by default.$apiVersion— version of the API used in the script. Required parameter. Default value: v5.$policyIds— policy identifiers, from whose scope the users are requested.$csvPathToReport— path to the CSV report file. By default the file is created in the script folder at the path Reports\Statistics.
Example of execution
- To run the script, execute the file main.ps1.
- During the execution of the script, a CSV-format file will be created at the path from the
$csvPathToReportvariable.