简体   繁体   中英

Can I change my own password in Active Directory using Powershell

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM