Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Get-ADUser command add user to root domain security group

$
0
0

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}




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>