Poweshell modifying AD account attributes

Source: Internet
Author: User

Poweshell modifying AD account attributes

In recent projects, you need to make changes to the high-volume ad user attributes, such as phones, phones, and other unique attributes. By the way, the user attributes for the Ad field information, easy to view.

1. General properties

650) this.width=650; "title=" 1.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M01/58/72/ Wkiom1swbksz-el0aaeqjl7rzl4089.jpg "alt=" Wkiom1swbksz-el0aaeqjl7rzl4089.jpg "/>

2. Address Properties

650) this.width=650; "title=" 2.png "style=" height:414px;float:none;width:430px; "src=" http://s3.51cto.com/wyfs02/ M02/58/6f/wkiol1swbwjc-6ukaac7tv6jauc083.jpg "width=" 312 "height=" 353 "alt=" wkiol1swbwjc-6ukaac7tv6jauc083.jpg "/ >

3. Phone attributes

650) this.width=650; "title=" 3.jpg "style=" height:373px;float:none;width:430px; "src=" http://s3.51cto.com/wyfs02/ M02/58/72/wkiom1swbkxdqd_haadba8e6kqu484.jpg "width=" 332 "height=" 302 "alt=" wkiom1swbkxdqd_haadba8e6kqu484.jpg "/ >

4. Organizational Properties

650) this.width=650; "title=" 4.png "style=" height:390px;float:none;width:430px; "src=" http://s3.51cto.com/wyfs02/ M00/58/6f/wkiol1swbwncmccwaacfp3b83nw654.jpg "width=" "height=" 253 "alt=" wkiol1swbwncmccwaacfp3b83nw654.jpg "/ >

----------------------------------------------------------------------------------------

Step 1, according to user requirements, we want to modify the existing AD account attributes, we need to add the following field values:

Display name------displayname

English abbreviation--- initials

Description--------Description

Office------office

Phone number----Officephone

Mobile phone----Mobilephone

Fax--------传真

Corporate--------Company

Department--------Department

Title--------Title

Managers--------Manager

Step 2, we first export the list of accounts with the relevant field properties from the ad . export the corresponding AD account list as a CSV file with the following command:

PS c:\users\administrator> get-aduser-filter *-properties * | where {$_. Userpr
Incipalname-ne $null} | Select-object Name,samaccountname,userprincipalname,dis
Playname,initials,description,office,officephone,mobilephone,fax,company,departm
Ent,title,manager | Export-csv-encoding utf8-notypeinformation C:\userinfo.csv

650) this.width=650; "title=" 1.jpg "alt=" wkiol1sv9e7zfejzaagif3lg9mc840.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 58/6f/wkiol1sv9e7zfejzaagif3lg9mc840.jpg "/>

Step 3, open the exported Excel table, edit, delete the system account, in contrast from the HR department to the person table, modify the corresponding person's attributes, modify the table in the following format.

650) this.width=650; "title=" 1.png "style=" HEIGHT:549PX;FLOAT:NONE;WIDTH:669PX; "alt=" Wkiom1sv9xpwckeiaakpkgo9-ac916.jpg "src=" http://s3.51cto.com/wyfs02/M00/58/72/ Wkiom1sv9xpwckeiaakpkgo9-ac916.jpg "width=" 846 "height=" 623 "/>

650) this.width=650; "title=" 2.png "style=" height:524px;float:none;width:671px; "alt=" Wkiol1sv99fbjlpkaaf9tlgteww573.jpg "src=" http://s3.51cto.com/wyfs02/M01/58/6F/ Wkiol1sv99fbjlpkaaf9tlgteww573.jpg "Width=" 701 "height=" 536 "/>

Step 4, import the edited Excel table, the command is as follows:

Import-csv-path C:\userinfo.csv | foreach {set-aduser-identity $_.name-displayname $_. Displayname-initials $_.initials-description $_.description-office $_.office-officephone $_.officephone- Mobilephone $_.mobilephone-fax $_.fax-company $_.company-department $_.department-title $_.title-manager $_.manager}

650) this.width=650; "title=" 1.jpg "alt=" wkiol1sv_tih4gniaagsyyjig2m075.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 58/6f/wkiol1sv_tih4gniaagsyyjig2m075.jpg "/>

Step 5, view the imported information, found that the text segment garbled, English text segment normal

650) this.width=650; "title=" 1.jpg "alt=" wkiom1sv_npygnb1aahp2x7qm-q193.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 58/72/wkiom1sv_npygnb1aahp2x7qm-q193.jpg "/>

Step 6, this is due to our import format problem, we re-modify the CSV file, after editing, note open the file with Notepad, and then select the "UTF-8" encoding to save the CSV file, in order to avoid garbled.

650) this.width=650; "title=" 1.png "style=" height:447px;width:678px; "alt=" Wkiol1sv_0yyx0xnaanb4kyhfgu934.jpg "src= "Http://s3.51cto.com/wyfs02/M02/58/6F/wKioL1Sv_0yyX0xNAANb4KYHFgU934.jpg" width= "959" height= "540"/>

Step 7, re-execute after modifying the ad command to view the ad account properties, found that both Chinese and English text fields are displayed normal.

650) this.width=650; "title=" 1.jpg "alt=" wkiom1sv_2ix38-0aahycv-qdte598.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 58/72/wkiom1sv_2ix38-0aahycv-qdte598.jpg "/>

This article is from the "Zhou Ping Microsoft Technology Exchange Platform" blog, please be sure to keep this source http://yuntcloud.blog.51cto.com/1173839/1601468

Poweshell modifying AD account attributes

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.