Can I change my own password in Active Directory using Powershell

RkApps0 picture RkApps0 · Aug 14, 2014 · Viewed 20.2k times · Source

I am trying to change password for my own account in AD using powershell. My account is just a regular account (no domain admin rights)

I tried net user, dsquery and powershell cmdlets, but all of them errors out "Access is denied". I think all of those requires admin rights.

Is there a way to change my own password using powershell or cmd ?

Why I am doing that? We have 8 different AD domains and I have an account in each. With different password expiration policies it is very difficult to remember all the passwords. So I want to do a script that connects to each domain with my user account in that domain and changes the password. I'll repeat that for all the domains.

Answer

CitizenRon picture CitizenRon · Aug 14, 2014

If you have the Active Directory PowerShell Module installed, this is a pretty easy task using Set-ADAccountPassword.

You can use the -Server parameter to supply a different Domain Controller name from each Domain to set the password on that Domain.

$DomainControllers = "Domain1DC","Domain2DC","Domain3DC"
$MyName = "MyUserName"
ForEach ($DomainController In $DomainControllers) {
    Set-AdAccountPassword -Identity $MyName -Server $DomainController
}

Set-ADUserAccountPassword used this way will prompt you for the old password then the new password for each domain controller.