Ying Li at myITforum.com

PowerShell & System Center

PowerShell script to modify user properties in Active Directory

Here is a PowerShell script to modify user properties in Active Directory such as telephone number or employeeid, etc.

In some case you will need to extend your AD schema first – like to add the employeeid field.

$rootdn=([adsi]"").distinguishedName
$ou=[adsi]("LDAP://ou=x,ou=y,ou=z,"+ $rootdn)
$user=$ou.psbase.children.find("cn=Li\, Ying \ ")
$user.put("telephonenumber","xxx-xxx-xxx")
$user.setinfo()

With a little bid more work, we could make this to work for multiple users – ever has a need to update telephone number for 1000 users in AD?

Posted: Sep 10 2007, 04:18 PM by yli628 | with no comments
Filed under:

Comments

No Comments