PowerShell Combat first time managing ad group objects

Source: Internet
Author: User
Tags samaccountname

From today onwards we began the actual combat series, first from the ad, followed by the Exchange and Lync Series, the SharePoint family of Coke has long been published, Haha. 1. List members of a group

Get-adgroupmember GroupName | Format-table Name

2. Get security within a domain-universal group

Get-adgroup–ldapfilter "(& (Objectcategory=group) (grouptype:1.2.840.113556.1.4.803:=-2147483640))"- Properties * | Select Name, distinguishedname, Description | Export-csv "Security-universal group. CSV"-notypeinformation-encoding UTF8

3. Get security within a domain-global group

Get-adgroup–ldapfilter "(& (Objectcategory=group) (grouptype:1.2.840.113556.1.4.803:=-2147483646))"- Properties * | Select Name, distinguishedname, Description | Export-csv "Security-global group. CSV"-notypeinformation-encoding UTF8

4. Get security within domains-local domain groups

Get-adgroup–ldapfilter "(& (Objectcategory=group) (grouptype:1.2.840.113556.1.4.803:=-2147483643))"- Properties * | Select Name, distinguishedname, Description | Export-csv "Security-local domain group. CSV"-notypeinformation-encoding UTF8

5. Get members within a group

Get-adgroupmember Csadministrator | Select Name, distinguishedname | Export-csv csadministrator.csv-notypeinformation-encoding UTF8

6. Move users of Group A to Group B

Get-adgroupmember A_group | Select sAMAccountName | ForEach {add-adgroupmember b_group-members $_.samaccountname}

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.