简体   繁体   English

我可以使用Powershell在Active Directory中更改自己的密码吗?

[英]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 . 我正在尝试使用PowerShell在AD中更改自己帐户的密码 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". 我尝试了net user,dsquery和powershell cmdlet,但是所有这些都出错了“Access is denied”。 I think all of those requires admin rights. 我认为所有这些都需要管理员权限。

Is there a way to change my own password using powershell or cmd ? 有没有办法使用powershell或cmd更改我自己的密码?

Why I am doing that? 为什么我这样做? We have 8 different AD domains and I have an account in each. 我们有8个不同的AD域,每个域都有一个帐户。 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. 如果安装了Active Directory PowerShell模块,则使用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. 您可以使用-Server参数从每个域提供不同的域控制器名称,以在该域上设置密码。

$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. 使用这种方式设置ADUserAccountPassword将提示您输入旧密码,然后提示每个域控制器的新密码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我的计算机不是域成员时,非管理员如何使用 PowerShell 更改我的活动目录密码? - How can I, a non-administrator, change my active directory password using PowerShell, when my computer is not a member of the domain? 如何使用Powershell更改Active Directory中的显示名称? - How can I change the display name in Active Directory with powershell? 使用Powershell列出活动目录用户显示名称,OU和上次密码更改日期 - list active directory User Display Name, OU and last password change date using powershell 使用PowerShell的Active Directory更改网页字段 - Active Directory Change Webpage field using PowerShell Powershell中的Active Directory密码到期 - Active Directory password expiration in powershell 我可以使用PowerShell SecureString更改服务器管理员密码吗? - Can I change the server administrator password using PowerShell SecureString? Active Directory更改密码权限 - Active Directory Change Password Permissions 如何使用Powershell从csv文件更新Active Directory中的更多数据行? - How can I update more data rows in Active Directory from a csv file using Powershell? 如何使用PowerShell将Active Directory用户排序为互斥组? - How can I sort Active Directory users into mutually exclusive groups using PowerShell? 如何在PowerShell中将所有Active Directory计算机读入阵列? - How can I read all Active Directory computers into an array in PowerShell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM