- Transfers the user content to the another user’s root folder under specified in
EmployeeArchiveFolderNameparameter. - Deletes the user.
Prerequisites
Windows
Install the latest version of dotnet core.MacOS & Linux
Install PowerShell. Run thepwsh command to test the installation.
Box CLI
To use the script, you will need the Box CLI installed and configured. You can get this done by going through our quick start guide. The user you use to login with should be the main Box admin or co-admin.Configure the script
-
Clone the
boxcliGitHub repository and cd into this example’s folder or download the files fromexamplesdirectory. -
Create the list of employees for deletion in
.csv. The header row should look like as follows:where:nameis the name of the user in Box.emailis the primary email address of the user in Box.
nameemailManaged User 1 [email protected]Managed User 2 [email protected]Managed User 3 [email protected]
List of parameters
Parameter | Description | Required | Default Value |
|---|---|---|---|
EmployeeList | Path to Employee List CSV with employees to be deleted. | Yes | - |
SkipTransferContent | Set this flag to skip transfer of user content before deletion when running the script. Otherwise user’s content will be transferred. | No | False |
NewFilesOwnerID | The ID of the user to transfer files to before deleting the user. If not specified, the script will prompt to input in the interactive mode, or use the current authenticated user ID to receive the content. | No | If not specified, the script will prompt to input in the interactive mode, or use the current authenticated user ID. |
EmployeeArchiveFolderName | The name of a folder, where users’ content will be moved to if SkipTransferContent is set to False. If a folder with this name already exists in the user’s NewFilesOwnerID root folder, it will be used. Otherwise, a new one will be created. | Yes | Employee Archive |
DryRun | A flag that determines the script should be run in a mode, where no delete/create/update calls will be made, only read ones. | No | False |
Define script parameters
You can the following options to pass parameters.- Use hardcoded value in script. To use this option, update all required parameters listed in the script parameters section before running.
-
Run script with parameters.
You can specify parameters while providing the command. For example:
orIf you don’t specify parameters, the script will prompt you to enter it.
Run the script
Now all you need to do is run the script.-
Run the Powershell command.
-
Run the script:
When all parameters are defined, you will see following output to confirm the script started:
Logging
Logs are stored in alogs folder located in the main folder.
You have access to these log files:
Users_Deprovision_all.txtthat contains all log entriesUsers_Deprovision_errors.txtthat contains only errors.
