Powershell变更AD用户的属性
#Subject: Get the passwordexpired Property of the users and Set ChangePasswordAtLogon to yes.#Date:2017/05/26
Import-Module ActiveDirectory
# 0 is Disable ChangePasswordAtLogon
# 1 is Enable ChangePasswordAtLogon
$Myou="OU=testou,OU=MY_USER,OU=Beijing,DC=CCTV,DC=China"
Get-ADUser -SearchBase "$Myou" -Filter *-Properties * | select Name,PasswordExpired,sAMAccountName | ForEach-Object { Set-ADUser-identity $_.sAMAccountName -ChangePasswordAtLogon 1 }
页:
[1]