Author Posts

August 18, 2015 at 1:42 am

How to add or remove Entire Directory users from any group in Active Directory powershell.
I am creating script to Add or remove user in AD groups.
My script is working for same domain. but If user is exist in another domain or forest, i am not able to perform action onto that.
Please help me on this.

August 18, 2015 at 3:54 am

When working with group members from another domain, or when working with groups in another domain, you need to fetch the user object or group first. There is an MSDN article that explains why and has some example code:

Adding Removing Members from Another Forest or Domain

August 18, 2015 at 4:01 am

try this:

Add-ADGroupMember -Identity 'somegroup_in_domain_1' -Members (get-aduser -Filter * -Server "domain_controller_2")