DELETE USER FROM CRM – via SQL commands (DATABASE)
I would like to delete CRM User and not disable the user.
Because of that I must to remove the current user from some CRM tables.
This is unsupported
way for the resolution. Be sure to take a backup of both config DB and CRM DB.
The unsupported command helps to remove this CRM user
- Select SystemUserId from systemuser table
Run the next command:
select SystemUserId from SystemUser where
DomainName like '%Test\Test%'
Save the guid for all other commands.
- Run
the next commands in the orgaxniation Db for instance TEMP_MSCRM
DELETE dbo.SystemUserProfiles where
SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.UserSettingsBase where SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.QueueMembership where
SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.TeamMembership where
SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.xnes_auditBase where
xnes_user = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.xnes_crmlogBase where
xnes_owner = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.SystemUserRoles where
SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE SystemUserBase
where SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
- Run the next command in MSCRM_CONFIG DB
delete
SystemUserOrganizations where CrmUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
Needs to IISRESET CRM
front servers.
The reason is changes in
MSCRM_CONFIG DB
Enjoy,
Rami Heleg
That is highly non recomended and also not needed. The users in CRM are mapped with the user object on active directory. If for some reason you have deleted the user from AD and want to create it you just need to create a dummy user, map the user in crm against that dummy user, save, and then revert to the created user with the same logon name.
ReplyDeleteHo would all the records owned by user X be in CRM if you delete the user? will you also delete all the records?
Anything is possible in IT and with direct access to a DB, but just because you can doesn't meen you should!
if you have this need, just rethink it and adapt, because in a near future you will be in the cloud and there you won't delete users.