Tuesday, January 26, 2010

DNN – Reset password in the database

I always forget the password that I use with my development edition of DNN. And because DNN is running locally I dont have access to an SMTP server for DNN to send me the password in the mail.

So here is a simple script that you can run on the database to reset the password.

Declare @UserName NVarChar(255)
Declare @NewPassword NVarChar(255) 
Declare @PasswordSalt NVarChar(128) 
Declare @Application NVarChar(255) 

Set @UserName = 'host'
Set @NewPassword = 'host'


Set @Application = (SELECT [ApplicationID] FROM aspnet_Users WHERE UserName=@UserName) 
Set @PasswordSalt = (SELECT PasswordSalt FROM aspnet_Membership WHERE UserID IN (SELECT UserID FROM aspnet_Users WHERE UserName=@UserName))

Exec dbo.aspnet_Membership_ResetPassword @Application, @UserName, @NewPassword, 10, 10, @PasswordSalt, -5

Courtesy of : https://support.ihostllc.net/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=39

No comments: