PowerShell changes the properties of the ad user

Source: Internet
Author: User
Tags samaccountname


Requirement: Change password on next login is enabled in the user attribute of the specified OU. When this option is enabled, the user's password expires.

#Subject: Get The Passwordexpired property of the users and Set Changepasswordatlogon to Yes. #Date: 2017/05/26import-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}


This article is from the "Work Memo" blog, so be sure to keep this source http://michael2017.blog.51cto.com/151632/1931524

PowerShell changes the properties of the ad user

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.