This script generates a CSV file with a list of users who have been inactive for a number of days. It performs the following steps:
-
Looks for the users who have the role
user.
The script does not consider other roles, such as AppUser.
-
Uses to check if the user performed any actions for a specified number of days. The default list of event types includes:
LOGIN,UPLOAD,COPY,MOVE,PREVIEW,DOWNLOAD,EDIT,DELETE,UNDELETE,LOCK,UNLOCK, NEW_USER. You can modify this list in the script settings.
-
Adds users who didn’t perform any actions to a
.csv file with inactive users. You can use this file as input for other scripts, for example to .
Prerequisites
Windows
Install the latest version of .NET core.
macOS & Linux
Install PowerShell. Run the pwsh command to test the installation.
Depending on the directory you are
running the command in, the output may differ.
For example:
PowerShell 7.2.5
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS /Users/user/repos/boxcli/examples>
Box CLI
To use the script, you need the Box CLI
installed and configured. You can do this by following
our . The user you use to login with should
be the main Box admin or co-admin.
-
Clone the
boxcli GitHub repository and cd into this example’s folder or download the files from the examples directory.
git clone https://github.com/box/boxcli.git
cd boxcli/examples/Inactive\ Users\ Report/
-
Set the number of days you want the script to scan for user events. If you don’t specify this value or leave the default, the script will prompt you to enter it.
-
(Optional) To change the report output file name, define the
ReportOutputFile parameter.
$ReportOutputFile = $ReportName + ".csv"
-
(Optional) To change event types, define the list for
eventType parameter.
$eventType = "LOGIN,UPLOAD,COPY,MOVE"
Run the script
Run the Powershell command.
Run the script.
./Inactive_Users_Report.ps1
When the script run is completed, you will see the following
output or a similar one.
Looking for users inactive for more than 3 days.
Found 6 users.
Found 7 events in last 3 days
Enterprise has: 0 App user, 6 regular users. With 1 admin role, 5 user roles.
Need to check 5 users (regular user, with user role) for inactive.
Found 5 users inactive for more than 3 days.
Report is available at InactiveUsers.csv
Logging
Logs are stored in the logs folder located in the main folder.
You have access to these log files:
Inactive_Users_Report_all.txt - contains all log entries
Inactive_Users_Report_errors.txt - contains only errors.
Last modified on March 19, 2026