Using the Perforce visual client (P4V/P4Admin, 2010.2 and later)
In P4V, select the "Tools | Administration..." menu item. The P4Admin tool will open.
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.
If Perforce hangs, perform use the command line client below.
Using the command line (P4) client (2010.2 and later)
Determine the pending changes that are owned by this user and delete them:
p4 changes -s shelved -u user_name
p4 shelve -d -f -c change_number
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 command to delete the client hangs, go to the Perforce root directory on the Perforce server (seen as "Server root:" in p4 info), find the client name under the client subdirectory of the server.locks directory, and delete this file.
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.