Bulk Move/delete security groups/mail groups

Source: Internet
Author: User

There is a requirement: the user has some mail groups do not want, want to delete, he himself tidied up the mail group of the Chinese name and Mail Group e-mail address, can be easily processed by a command.

The operation is very simple, you can look at the code comments

#导入一个csv, file, CSV file requires the first line to write mail, each of the following lines is an e-mail address import-csv c:\333.csv|foreach{$mail =$_.mail Set Variable, Get distinguishedname$zumingxxxx = (get-adgroup-properties mail-filter {mail-eq $mail}) for this group of mail addresses. distinguishedname# Display group name, prevent Misoperation Echo $zumingxxxx # Move security group or mail group to a specific OU move-adobject-identity $zumingxxxx-targetpath < #被移动的地址 #>-server bj-wtlad01# or you can choose to remove directly with the Force parameter, but this is not recommended, and the operation fails. #remove-adgroup $zumingxxxx}


This article is from the "Nine uncle-Microsoft Private Cloud" blog, please make sure to keep this source http://jiushu.blog.51cto.com/972756/1709873

Bulk Move/delete security groups/mail groups

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.