Hi Guys,
Today I am going to tell you some simple SQL query to reset/update the Episerver Commerce Manager admin password.
This is useful when you forgot the admin password or you pulled the latest database copy from the production server and you don't have the admin password.
So for this, you need to find two values-
- Database Name - This is the name of your commerce database.
- Application Name - This is the name of application that is stored in the commerce database.
To pull the name of the application from commerce database you have to follow these simple steps-
- Open the SQL Server Management Studio and connect your SQL server instance(If you are using visual studio local IIS Express then navigate to App_Data folder and double click on "EcfSqlConnection****".mdf file and it will open the database for you)
- Expand the "Tables" folder and look for "dbo.Application" table.
- Right-click on this table and click "Select Top 1000 Rows". Please refer below screenshot for your reference.
- On successful execution of this query you will see the "ApplicationName". Please note down this because we need it in our password reset query. Please refer below screenshot for your reference.
Now we are almost done with our requirement gathering.
So now again go back to the SQL Server Management Studio and select the commerce database.
Right-click on the database and click"New Query". The query editor will open so copy and paste the below query in this editor and update the highlighted values that gathered in the above steps.
SQL query for Reset/Update the password
USE [EcfSqlConnection_0fc2aba3]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[aspnet_Membership_SetPassword]
@ApplicationName = N'EPiServerCommerceManager3',
@UserName = N'admin',
@NewPassword = N'password1',
@PasswordSalt = N'salt',
@CurrentTimeUtc = N'1/1/2019',
@PasswordFormat = 0
SELECT 'Return Value' = @return_value
GO
FYI - Please update the "NewPassword" with your desired password. For this example, I am using password1.
Thanks for reading this blog post I hope it helps
Thanks and regards
Ravindra S. Rathore