Get-ADUser命令将用户添加到根域安全组 [英] Get-ADUser command add user to root domain security group

查看:142
本文介绍了Get-ADUser命令将用户添加到根域安全组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,脚本专家!  使用以下命令作为安全组的根域,位于Child
域中只想启用用户添加。但不知怎的,我无法添加到组,键入正确的命令。如果你能提供帮助,我将不胜感激。


 $ OU =" OU =会计,DC =孩子, DC =域,DC =本地" 
$ Group =" CN = Group,OU = Groups,DC = rootdomain,DC = local"

Get-ADUser -SearchBase $ OU -SearchScope OneLevel -LDAPFilter"(&(!memberOf = $ Group)(!userAccountControl:1.2.840.113556.1.4.803:= 2))" | ForEach-Object {Add-ADPrincipalGroupMembership -Identity $ _ -MemberOf $ Group}

解决方案

仅运行Get-AdUser组件并查看返回的内容。 修复LDAP过滤器。


Get-ADUser -SearchBase


OU -SearchScope OneLevel -LDAPFilter'(!userAccountControl:1.2.840.113556。 1.4.803:= 2)'


你有一些错误,有些打字两次。 



Hey, Scripting Guy! With the following command as root domain to the Security Group, located in the Child domain only want to enable users to add. But somehow I could not add to the group, type the correct command. I would appreciate if you could help. 

$OU="OU=Accountant,DC=child,DC=domain,DC=local"
$Group="CN=Group,OU=Groups,DC=rootdomain,DC=local"

Get-ADUser -SearchBase $OU -SearchScope OneLevel -LDAPFilter "(&(!memberOf=$Group)(!userAccountControl:1.2.840.113556.1.4.803:=2))" | ForEach-Object {Add-ADPrincipalGroupMembership –Identity $_ -MemberOf $Group}

解决方案

Run only the Get-AdUser component and see what returns.  Fix the LDAP filter.

Get-ADUser -SearchBase


OU -SearchScope OneLevel -LDAPFilter '(!userAccountControl:1.2.840.113556.1.4.803:=2)'

You had some pieces wrong and some typed twice. 


这篇关于Get-ADUser命令将用户添加到根域安全组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆