May 29, 2012

Reset the admin passord

To reset the 'admin' password to 'b' the easest way is to execute this SQL script on the core database:

UPDATE [aspnet_Membership] SET Password='qOvF8m8F2IcWMvfOBjJYHmfLABc=' 
WHERE UserId IN (SELECT UserId FROM [aspnet_Users] WHERE UserName = 'sitecore\Admin')

EDIT: Gary Jutras have propose an improved version of this sql. Thank you for it.
UPDATE dbo.aspnet_Membership 
SET [Password]='qOvF8m8F2IcWMvfOBjJYHmfLABc=', [PasswordSalt]='OM5gu45RQuJ76itRvkSPFw==', 
[IsApproved] = '1', [IsLockedOut] = '0'
WHERE UserId IN (SELECT UserId FROM dbo.aspnet_Users WHERE UserName = 'sitecore\Admin') 

11 comments:

  1. Hi,

    I tried this script for a different username, but I am still unable to logon.

    Any suggestions? Thank You.

    Malcolm Swan

    ReplyDelete
  2. Maybe things have changed in the two years since this was posted, but it looks like Sitecore uses unique salts for their passwords. So even if you're just resetting the password to "b" the hashed result will be different for everyone.

    ReplyDelete
  3. I can't say how many times this has saved my shiny metal posterior but thanks again. I owe you a few.

    ReplyDelete
  4. Should actually be UPDATE dbo.aspnet_Membership
    SET [Password]='qOvF8m8F2IcWMvfOBjJYHmfLABc=', [PasswordSalt]='OM5gu45RQuJ76itRvkSPFw==', [IsApproved] = '1', [IsLockedOut] = '0'
    WHERE UserId IN (SELECT UserId FROM dbo.aspnet_Users WHERE UserName = 'sitecore\Admin') to also set salt and make sure not locked out

    ReplyDelete
  5. Yes good idea to update the IsLockedOut also. Thanks for the tips

    ReplyDelete
  6. getting
    Incorrect syntax near 'Password'.

    ReplyDelete
    Replies
    1. I'm guessing you copied the script SET... and not the
      UPDATE [aspnet_Membership]

      Delete
  7. Correct syntax is
    UPDATE dbo.aspnet_Membership
    SET [Password]='qOvF8m8F2IcWMvfOBjJYHmfLABc=', [PasswordSalt]='OM5gu45RQuJ76itRvkSPFw==',
    [IsApproved] = '1', [IsLockedOut] = '0'
    WHERE UserId IN (SELECT UserId FROM dbo.aspnet_Users WHERE UserName = 'sitecore\Admin')

    ReplyDelete