Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bex 444 posts 555 karma points
    Sep 21, 2017 @ 08:34
    Bex
    0

    Multiple Umbraco sites password resetting.

    Hi

    This is somewhat related to this thread I posted a while ago:

    https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/84428-mass-admin-password-reset-locked-out-of-some-newer-sites

    I need to reset all the admin passwords on all our Umbraco sites and these range from version 4 to the very latest version 7 and we have ALOT, so I don't want to have to do them all manually.

    Previously I have used the following SQL script:

        DECLARE AllDatabases CURSOR FOR
    SELECT name
    FROM sys.databases
    WHERE (state=0)
    and (CASE
    WHEN state = 0 THEN OBJECT_ID( QUOTENAME( name ) + '.[dbo].[umbracouser]','U' )
    END IS NOT NULL)
    order by name;
    
    OPEN AllDatabases
    
    DECLARE @DBNameVar NVARCHAR(128),@Statement NVARCHAR(300)
    
    FETCH NEXT FROM AllDatabases INTO @DBNameVar
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
    PRINT N'CHECKING DATABASE ' + @DBNameVar
    
    SET @Statement = N'USE [' + @DBNameVar +']' + CHAR(13)
    + ' Update umbracouser set userpassword = ''[PASSWORD HERE]'' where
    username =''admin'' or userlogin =''admin'''
    
    PRINT N'Statement to run ' + @Statement
    
    EXEC sp_executesql @Statement
    
    
    FETCH NEXT FROM AllDatabases INTO @DBNameVar
    END
    
    CLOSE AllDatabases
    DEALLOCATE AllDatabases
    

    This understandably does not work with the newer Umbraco sites because of new encoding and possibly salting thr passwords on individual sites. I do not want to change any site settings ("uselegacyencoding") so my questions are:

    • At what version of U7 did the encoding change, and has it changed again at any point?
    • Can anyone think of an easier way of doing this for the U7 Sites?

    Thanks for any inspiration

    Bex

Please Sign in or register to post replies

Write your reply to:

Draft