简体   繁体   English

将OU的所有成员移至new-distributiongroup

[英]move all member of OU to new-distributiongroup

I'm trying to set up some new distributiongroups and want to fill them with all members of an specific OU. 我正在尝试建立一些新的通讯组,并希望用特定OU的所有成员来填充它们。

$allMemberofTestOU = get-qadgroup $ouNameT | get-qadmemberof

but my exchange management shell dont know this cmdlet. 但是我的交换管理外壳不知道此cmdlet。 i dont know why. 我不知道为什么。

I dont get the point how i can do this, i guess - simple, thing. 我不明白我该怎么做,这很简单。

Long Version: 长版:

I have many OU which named like OU-ProgramName-** and want to move all of these members to an new distributiongroup name VL-ProgramName-**. 我有许多OU,其名称类似于OU-ProgramName-**,并希望将所有这些成员移动到新的通讯组名称VL-ProgramName-**。

At the beginning, i get the content from a textfile with all Programnames and want to loop via ForEach (works). 一开始,我从具有所有程序名的文本文件中获取内容,并希望通过ForEach循环(有效)。

Question: 题:

I need help at getting all members of an OU and copy them to a new distributiongroup. 我需要获得OU的所有成员并将其复制到新的通讯组的帮助。

Best regards from germany 来自德国的问候

Paul 保罗

Edit: 编辑:

I built another way to do the job. 我建立了另一种方式来完成这项工作。 Im new to powershell, so i dont know if im doing it the right way. 我是Powershell的新手,所以我不知道即时通讯方式是否正确。

 $OU = "CN=*-$ouName,OU=Prodfarm-Anwendungen,OU=LRA-CTRX,DC=kreis-gr,DC=de”                        
 $AD = New-Object System.DirectoryServices.DirectorySearcher([ADSI]"LDAP://$OU")                                         

 # Testfarm

    $newGroupT = "VLP_"+ $ouName + " Test C65"
        $Users = $AD.FindAll() | %{$_.Properties.samaccountname} | Sort-Object 
            $Users | New-Distributiongroup -Name $newGroupT -Members $_

All Get-QAD* CMDLets are part from the Quest ActiveRoles Management Shell plugin. 所有Get-QAD* CMDLets都是Quest ActiveRoles Management Shell插件的一部分。 There was a free version out there before Quest was bought by Dell. 在戴尔收购Quest之前,那里有一个免费版本。 The free version is the reason why some blog posts refer to use them. 免费版本是某些博客文章引用使用它们的原因。 However after the merge the free version was pulled from the Quest/Dell website and you can buy this plugin now directly from Dell/Quest here . 但是,合并后,免费版本已从Quest / Dell网站中提取,您现在可以在此处直接从Dell / Quest购买此插件。

So your issue could be solved with two possible solutions: 因此,可以通过两种可能的解决方案解决您的问题:

1.) If you have installed the plugin, then you didn´t add the Quest ActiveRoles AD management snap-in at first via: 1.)如果您已安装插件,则首先没有通过以下方式添加Quest ActiveRoles AD管理管理单元:

Add-PSSnapin Quest.ActiveRoles.ADManagement

2.) The Quest ActiveRoles AD management snap-in isn´t installed. 2.)未安装Quest ActiveRoles AD管理插件。 If you wish to use the last known "free" version you can find that in the internet for example here . 如果您希望使用最后一个已知的“自由”的版本,你可以找到在互联网上,例如在这里 Keep noted that nobody knows if this is the original version! 请注意,没有人知道这是否是原始版本! Keep also noted that the free version is a very old version as the current one is version 1.7. 还请注意,免费版本是一个非常旧的版本,因为当前版本是1.7版。 So you might also buy the new and latest one from Quest/Dell. 因此,您也可以从Quest / Dell购买新的和最新的。

Update: 更新:

Here is a script I´m using which can add all users from a given OU to a given AD group . 这是我正在使用的脚本,可以将给定OU中的所有用户添加到给定AD组中 I run it via the Windows Scheduler and an task account. 我通过Windows Scheduler和一个任务帐户运行它。 Once it run, it is adding all users from the given OU to an given AD group, means its auto updating the groups. 一旦运行,它将所有用户从给定的OU添加到给定的AD组,这意味着它会自动更新组。 You might adjust that one so that it fits your needs. 您可以调整它,使其适合您的需求。 Its a little bit advanced coding as it send out an error email if something failed, writes a log and used a function. 它有点先进的编码,因为如果出现故障,它会发送错误电子邮件,编写日志并使用功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Powershell 获取OU中所有服务器的lastlogonDate - Powershell get lastlogonDate of all servers in OU 获取所有包含相同名称 OU=NEEDOU 的 OU 的用户。 从某个数据库 - Get all users that consist bunch of OU with the same names OU=NEEDOU. From a certain database 将OU的所有用户也添加到安全组中 - Add ALL users of a OU to a security group also the ones in a security group 如何获取带参数(说明为空白)的广告中的所有OU-没有说明? - How to get all OU in Ad with parameter (description blank ) - without description? 查询AD以查找名称为TC的OU中的所有计算机 - Query AD to find all the Computer in an OU with TC in their Name Powershell 脚本必须以人类可读的格式显示所有工作站 - Powershell script has to show all workstations ou in human readable format 尝试使用调用命令获取与 OU 相关的所有 GPO - trying to get all the GPO's related to the OU with invoke command 如何使用 windows 命令将所有文件从父文件夹中移动到新的子文件夹中? - How to move all files excecpt one from parent folder into a new child folder using windows command? 批处理文件以在文件夹中创建新的子文件夹,将文件移动到目录中所有文件夹的新创建的子文件夹 - batch file to create new subfolder in folder, move file to newly created subfolder, for all folders in directory 在另一个子 Ou 中创建子 OU - Creating child OU inside another child Ou
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM