How to add a Sitecore admin programmatically

Created: 1 Oct 2019, last update: 30 Jan 2022

Sitecore user admin programmatically

I have added some user related script to https://github.com/jbluemink/Sitecore-Admin-Scripts-for-Development-and-Deploying you can use it and extend it for Automate repetitive tasks. Because of security, it is not the intention to keep them permanently on production, but you probably understand that.

AddAdminUser.aspx
Script for programmatically adding a Sitecore user with administrator rights. Place this script in the webroot instead of the admin folder. Also handy, if you have temporally no access to the admin account and want an extra account with full admin rights.

AddEditorUser.aspx

Script for programmatically adding a Sitecore user, sample script how to add a Sitecore user programmatically and assign roles.

ResetAdminPassword.aspx

Script for programmatically unlock and reset the Sitecore admin password, place this script in the webroot instead of the admin folder. Instead of resetting the admin password with a SQL script, you can better use this. The SQL scripts you can find on the internet depend on the hash algorithm configured. In addition, you can configure directly the wanted password instead of default b. If your account is just locked and you know the password, you can use the out of the box admin tool /sitecore/admin/unlock_admin.aspx