Bulk delete JIRA projects, groups, users

I am creating this questions in response to Atlassian's lack of bulk tools to process JIRA content. I will supply the solution so other people can learn from my experience.

1 answer

1 accepted

This widget could not be displayed.

Install the following from marketplace:

Download the latest CLI client from https://bobswift.atlassian.net/wiki/display/ACLI/CLI+Client+Installation+and+Use

Extract the contents inside the server in a folder.

Modify the file jira.bat so the --server, --user and --password fields are populated

java -jar "%dirPath%"/lib/jira-cli-6.0.0.jar --server http://server.dev.domain.com:80 --user sysadmin --password sysadmin %*

verify java.exe is in the Windows path (C:\Program Files\Atlassian\JIRA\jre\bin)

Notes:

  • Users that have contributed to the project will not be deleted from the script even if they are mentioned.
  • Do not delete users needed to login, such as sysadmin or IDs related to plugins.
  • Use the examples page to perform cleanup of projects, users and groups: https://bobswift.atlassian.net/wiki/display/JCLI/Examples
  • data from the export scripts will need to be cleaned up manually, only group name, userid or project key is needed
  • attachments are not deleted when a project is deleted via CLI at C:\Program Files\Atlassian\Application Data\JIRA\data\attachments.

Example CMD files

get all listed projects to CSV file

@echo off

rem remember the directory path to this bat file

set dirPath=%~dp0

call jira.bat --action getProjectList --outputFormat 2 --file groups-export.csv

pause

delete a list of projects from CSV file

@echo off

rem remember the directory path to this bat file

set dirPath=%~dp0

For /F "usebackq tokens=1  delims=," %%a in (projects-delete.csv) Do (

call jira.bat --action deleteProject --project "%%a" --continue

)

pause

Get list of groups to CSV file

@echo off

rem remember the directory path to this bat file

set dirPath=%~dp0

call jira.bat --action getGroupList --file groups_export.csv

pause

delete all listed groups from CSV file

@echo off

rem remember the directory path to this bat file

set dirPath=%~dp0

For /F "usebackq tokens=1  delims=," %%a in (groups_delete.csv) Do (

call jira.bat --action removeGroup --group "%%a" --continue

)

pause

get list of users to CSV file

@echo off

rem remember the directory path to this bat file

set dirPath=%~dp0

call jira.bat --action getUserList --name "@all" --outputFormat 2 --file users-export.csv --includeInactive

pause

delete users from a CSV file

@echo off

rem remember the directory path to this bat file

set dirPath=%~dp0

For /F "usebackq tokens=1  delims=," %%a in (users-delete.csv) Do (

call jira.bat --action removeuser  --userId "%%a" --continue

)

pause

  • Hi george,

I can't quite get the 'delete users from a CSV file' to function, are you able to provide further info of what should be directly entered into the CLI? (java.exe in in correct path, jira.bat file updated with necessary details)

Hello Cameron,

"delete users from a CSV file" is an example batch script file (.BAT or .CMD extension) that takes user names to delete from a CSV file called "users-delete.csv"

This CSV file is actually generated from the "get list of users to CSV file" script. You will need to masage the CSV file to remove any users you want to keep before moving to the delete phase, as well as remove any redundant data from it so the delete script can take only usersnames as input.

Edit1:

The script that exports users to CSV has many columns

User,Key,Name,Email,Time Zone,Avatar URL,Active,Groups

You need to remove every column exctept "User".

Edit2:

"get list of users to CSV file" scrip creates users-export.csv

This file has many columns.

User,Key,Name,Email,Time Zone,Avatar URL,Active,Groups

You need to remove every column except "User" then save the file as users-delete.csv

This new file can be used as input for "delete users from a CSV file" script.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

90 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you