首页 > 代码库 > Powershell变更AD用户的属性
Powershell变更AD用户的属性
需求:将指定OU的用户属性中“下次登陆时更改密码”启用。该选项启用后用户的密码即过期。
#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 }
本文出自 “工作备忘录” 博客,请务必保留此出处http://michael2017.blog.51cto.com/151632/1931524
Powershell变更AD用户的属性
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。