Bulk Password (unique) Change

I'm going to be migrating 200 users from one Forest to another Forest using ADMT (Active Directory Migration Tool). I need to reset all passwords on these accounts to a unique password (each account password needs to be unique). Does anyone have a Powershell script to do this or any other ideas? I was thinking I could create a CSV file with the LogonName & Password for each user and import?
603currierAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

FOXActive Directory/Exchange EngineerCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MilesLoganCommented:
BULK AD is a GUI tool that will do this also .
http://www.wisesoft.co.uk/software/bulkadusers/default.aspx
McKnifeCommented:
A batch would also do if 8 random characters were secure enough.
For /f %a in (user list.txt) do net user %a /random >output.txt

Open in new window

Nadav SolomonCommented:
Enjoy, to make the change only on specific OU or what ever change the LDAP query.

#users not to change the passwond
$excludedUsers = "administrator","username2exclude"
$outputfile = "c:\users.csv"
#password data
$length = 8
$includeNumber = $true
$includeSign = $true
$includeUpperCase = $true
###########################################################################################
$excludedUsers = $excludedUsers.tolower()

Set-Content -Path $outputfile -Value "User,Password"

function create-randomPassword()
{
    param(
        [int]$length = 8,
        [bool]$includeNumber = $true,
        [bool]$includeSign = $true,
        [bool]$includeUpperCase = $true
    )
    $password = @()
    1..$length | %{
        if($includeUpperCase)
        {
            $password += [char]$(Get-Random -Minimum 65 -Maximum 90)
            $includeUpperCase = $false
        }elseif($includeNumber)
        {
            $password += $(Get-Random -Minimum 0 -Maximum 9)
            $includeNumber = $false
        }elseif($includeSign)
        {
            $password += [char]$(Get-Random -Minimum 33 -Maximum 47)
            $includeSign = $false
        }else{
            $password += [char]$(Get-Random -Minimum 97 -Maximum 122)
        }
    }
    $password -join ""
}

([adsisearcher]"(&(objectcategory=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))").FindAll() | %{
    $user = [adsi]$_.path
    if(-not $excludedUsers.Contains($user.sAMAccountName.tolower()))
    {
        #change the function call as you need 
        $pwd = create-randomPassword -length $length -includeNumber $includeNumber -includeSign $includeSign -includeUpperCase $includeUpperCase
        Add-Content -Path $outputfile -Value "$($user.sAMAccountName),$pwd"  
        $user.setPassword($pwd)
        $user.setInfo() 
        
        $user.sAMAccountName
    }
}

Open in new window

603currierAuthor Commented:
Thanks! I'll give this a try as it seems to best fit my need.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.