PowerShell daily AD Management-1

Source: Internet
Author: User

PowerShell is now used more and more frequently, such as the administrator to maintain the ad, the new OU will need to batch enable users, of course, this is a graphical interface can do, in exchange for a request, in AD management often encountered the thing is to query OU, users, If the number of users is very large, this is not easy for the graphical interface, such as the need to query all the OU in the domain, or the user under an OU, PowerShell can easily count these huge information

Chapter Content

1. Query all OUs in the domain, export the name attribute

2. Querying all users under an OU

3. Query individual user attributes and intercept the values you want

Next, I'll show you how to use PowerShell to complete ad daily administration, and I'll comment after each command


1.ou is the most common contact in AD management, first attach a command to view OUs within a domain

Get-adorganizationalunit-filter *-searchbase "ou= company, dc=comlan,dc=com"

Get-adorganizationalunit: Viewing AD organizational units
Filter: Filters The items, here we filter all OUs
Searchbase: Search for which OUs are specifically found

These parameters are frequently used query parameters


1.1, the Red tick section is the name attribute, and if you want to display only the name of the OU, you need it.

650) this.width=650; "title=" ou name attribute. PNG "alt=" Wkiol1dxc8_weesgaabb7cgxa1k379.png "src=" http://s4.51cto.com/wyfs02/ M00/82/7e/wkiol1dxc8_weesgaabb7cgxa1k379.png "/>

1.2 Using the pipe +select-object can only display the name, if you want to display multiple names after the name of the "," property values can be, such as Select-object name,objectguid, in fact, FL can also display these names OH

650) this.width=650; "title=" displays only the name. PNG "alt=" Wkiom1dxddojqxd3aaalmu37uti482.png "src=" http://s3.51cto.com/wyfs02/M01/82/80/ Wkiom1dxddojqxd3aaalmu37uti482.png "/>

1.3 Often after the query, the leader asked to export the form sent to him, these in PowerShell is very simple, the previous command plus a pipe character |-notypeinformation-encoding UTF8, this parameter will set the character encoding to UTF8, Otherwise it will show garbled

650) this.width=650; "title=" Export. PNG "style=" Float:none; "alt=" Wkiol1dxekcgwsroaaadu0cwhvc924.png "src=" http://s5.51cto.com/wyfs02/M01/82/7F/ Wkiol1dxekcgwsroaaadu0cwhvc924.png "/>

650) this.width=650; "title=" exports the content. PNG "style=" Float:none; "alt=" Wkiom1dxetizmqkyaaao6n5z_bw719.png "src=" http://s1.51cto.com/wyfs02/M02/82/80/ Wkiom1dxetizmqkyaaao6n5z_bw719.png "/>


2. Query the Sub-OU under the user, for example, to view the OU technology 2, put the Query OU in the parameters of the first, in turn small to large

650) this.width=650; "Title=" OU. PNG "style=" float:left; "alt=" Wkiom1dxew2zkntyaaait3724ys681.png "src=" http://s2.51cto.com/wyfs02/M01/82/80/ Wkiom1dxew2zkntyaaait3724ys681.png "/>





Get-aduser-filter *-searchbase "ou= technology 2, ou= Technology Department, ou= Company, dc=comlan,dc=com" |FL Name

650) this.width=650; "title=" the user name queried. PNG "alt=" Wkiol1dxfrmsgnlqaaafppxftxo958.png "src=" http://s3.51cto.com/wyfs02/M02/82/7F/ Wkiol1dxfrmsgnlqaaafppxftxo958.png "/>

3. View the user's properties
-properties is the View property * represents all attributes, if you want to intercept an attribute, such as a mobile phone

650) this.width=650; "Title=" Property view. PNG "alt=" Wkiom1dxf6awey5aaaaydqczn-k717.png "src=" http://s1.51cto.com/wyfs02/M01/82/80/ Wkiom1dxf6awey5aaaaydqczn-k717.png "/>

650) this.width=650; "Title=" mobile. PNG "alt=" Wkiom1dxgeniltg0aaag_elpsoy040.png "src=" http://s1.51cto.com/wyfs02/M01/82/80/wKiom1dXgEniLTG0AAAG_ Elpsoy040.png "/>


This article is from the "11663406" blog, please be sure to keep this source http://11673406.blog.51cto.com/11663406/1787198

PowerShell daily AD Management-1

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.