Using the P4Admin Tool
As a Perforce user with 'super' privileges, start P4Admin or from P4V select the "Tools | Administration..." menu item.
Select the "Users & Groups" tab.
Right click on the user that you would like to delete and select the "Delete user 'user_name'", where "user_name" is the name of the user account to be deleted. The "Delete User" dialog is displayed.
This dialog will list the owned changes and workspaces that will also be deleted with the user account.
There are two options in this dialog:
Delete shelved files in user's pending changelists: Removes any files shelved to any pending changelist (Default is unselected).
Remove all permissions assigned to this user from the Perforce data base: Any "user" based protections assigned to this user are removed from the protections table, and any group memberships are revoked (Default is selected).
Click the "Delete" button to delete the user with the selected options.
Using the P4 command line client
Determine the pending changes that are owned by this user and delete them:
p4 changes -s shelved -u user_name
Shelves can be deleted:
p4 shelve -d -f -c change_number
or you can choose to retain shelves by deleting the client workspace that contains the shelved files using the '-Fs' flag to 'p4 client -d -f' as detailed below.
p4 changes -s pending -u user_name
p4 change -d -f change_number
Determine the clients owned by this user and delete them:
p4 clients -u user_name
p4 client -d -f client_name
If the client has shelved files, you can preserve the shelf content and delete the client using the '-Fs' option:
p4 client -d -f -Fs client_name
Delete the user from all groups that the user belongs to:
p4 groups -u username
Note: One way to speed this process is to use a command line utility such as grep to extract the name automatically. For example:
p4 group -o group_name | grep -v user_name | p4 group -i
If you do not have the spec depot turned on (See the Perforce System Adminstrator's Guide) save a copy of the group prior to making the change:
p4 group -o group_name > group_name.old
Remove any lines from the protections table that directly reference the user being deleted:
Delete the user:
p4 user -d -f user_name
Note: Deleting a user does not affect file revision history.
Note: If you see this error message:
User username has file(s) open on 1 client(s) and can't be deleted.
It may be this user has some opened files associated with another user's client workspace or an unauthorised user took over an ownership of a client you are trying to delete. Run this command to see what files remained opened with this user:
p4 opened -u user_name
Follow the instructions in this Knowledge Base article on Reverting Another User's Files , then try deleting the user account again.