Can I change my own password in Active Directory using Powershell

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

I tried net user, dsquery and powershell commands but all the "Access Denied" errors. I think they all require admin rights.

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

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

+3


source to share


1 answer


If you have the Active Directory PowerShell module installed, it's a fairly simple task using Set-ADAccountPassword.

You can use the -Server parameter to provide a different domain controller name from each domain to set a password for that Domain.



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

      

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

+7


source







All Articles