Run ITAM API asynchronous report endpoints using PowerShell
Use the PowerShell script attached to this article to run an IT Asset Management (ITAM) report asynchronously through the Flexera One API. The script starts the report, monitors its execution status, and retrieves the completed report results.
The script uses the following ITAM API endpoints:
Prerequisite
Your Flexera One user account must have permission to make ITAM API calls.
To verify your permissions, in Flexera One, go to Administration > Identity Management > User Management.
If you are not an administrator, confirm that the View IT assets & call APIs permission under IT Asset is enabled for your account.
Run the report using the PowerShell script
-
Download and run the PowerShell script:
- Download the
async-reports.ps1script. - Open the script file and copy its contents.
- Open PowerShell.
- Paste the copied script contents into PowerShell.
- Press Enter to run the script.
- Download the
-
Enter the
authHostvalue for your Flexera One zone:- NAM:
login.flexera.com - EU:
login.flexera.eu - APAC:
login.flexera.au
Press Enter after entering the correct value.
- NAM:
-
Enter the
apiHostvalue for the same Flexera One zone:- NAM:
api.flexera.com - EU:
api.flexera.eu - APAC:
api.flexera.au
Press Enter.
- NAM:
-
Enter the
refreshToken:Enter your active refresh token and press Enter.
If you need to generate a refresh token, see Generating a refresh token .
You can also watch the tutorial for generating a Flexera One refresh token .
-
Enter the
orgId:When you are signed in to Flexera One, you can find your organization ID in the URL. For example:
https://app.flexera.com/orgs/{OrgID}/landingEnter the organization ID and press Enter.
-
Enter the
reportId:-
For custom reports, locate the report ID at the end of the report URL. For example:
https://app.flexera.com/orgs/{OrgID}/slo/Suite/Reports/View/{ReportID} -
For out-of-the-box reports, retrieve the report ID using the Report index API.
Press Enter and allow the script to run.
-
After the report completes, the script retrieves all available result pages and creates an output directory in the location where you ran the script.
The directory uses the following naming format:
report-{reportId}-job-{jobId}-results
Each page of report results is saved as a separate JSON or CSV file, depending on the selected output format. For example:
report-{reportId}-job-{jobId}-page-1.json
When processing is complete, PowerShell displays the number of page files and rows saved to the output directory.