Sitecore Account Password Reset

One comment

Each time we migrate to new version of Sitecore or move to different environment ( AWS to Azure ), we wanted to clear unused user accounts and to reset passwords of Sitecore users.

I thought it would be helpful for Sitecore folks to use below script to quickly reset pwd and export it.


#Be careful - default account pwds shouldn't be reset
$accUsr = @('sitecore\ServicesAPI', 'sitecore\Admin','sitecore\coveouser')
$userInfo = @()
$pwdStr = 'PwdSalt123@43'

#Filter Sitecore domain users.. If you custom domains, you can also filter through it.
Get-User -Filter "sitecore\*" | ForEach-Object{
    if($accUsr -notcontains $_.Name){
        #New PWD EMAILID + SALT
        $newPWD = $_.Profile.Email.Split('@')[0] + $pwdStr
        #Reseting New Pwd
        $_ | Set-UserPassword -NewPassword $newPWD -Reset
        #Custom Object to export it
        $userInfo += @{Name =  $_.Name; Email =$_.Profile.Email;Pwd = $newPWD}
        Write-Host $_.Name, $_.Profile.Email, $newPWD
    }
    
}

#Custom Object to export it
$props = @{
        Title = "User pwds"
        InfoTitle = "Total $($userInfo.Count) items found!"
        InfoDescription = "User Pwds"
        PageSize = 2500
    }
    [string[]] $columns = "Name"
    [string[]] $columns +=  "Email"
    [string[]] $columns +=  "Pwd"
    
    $userInfo | Show-ListView @props -Property $columns

1 comments on “Sitecore Account Password Reset”

  1. Long time supporter, and thought I’d drop a comment.

    Your wordpress site is very sleek – hope you don’t mind me asking what theme
    you’re using? (and don’t mind if I steal it? :P)

    I just launched my site –also built in wordpress like yours– but the theme slows (!) the site down quite a
    bit.

    In case you have a minute, you can find it by searching for “royal cbd” on Google (would appreciate any feedback)
    – it’s still in the works.

    Keep up the good work– and hope you all take care of yourself during the coronavirus scare!

    ~Alex

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.