Powershell Query Domain Groups
The get adgroup cmdlet gets a group or performs a search to retrieve multiple groups from an active directory.
Powershell query domain groups. To query ad groups and group members you have two powershell cmdlets at your disposal get adgroup and get adgroupmember. This command gets all groups that have a groupcategory of security but do not have a groupscope of domainlocal. For example to add the maximus account from the contoso domain to the local administrators group run the command.
If you have the activedirectory module you can issue this. You can use the same command to add domain accounts to local groups. By using ldap filters etc that d be helpful.
Get adgroupmember looks inside of each group and returns all user accounts groups contacts and other objects that exist in that group. I m currently looking for some assistance in generating a ldap query or a powershell command to separately list. That is is the stock code for doing this.
Listing the members is not required since i want to exclude these groups from another process. You can identify a group by its distinguished name dn guid security identifier sid security accounts manager sam account name or canonical name. 1 all domain admins only 2 exchange admins can any one provide some assistance.
Also two resources for you to make it easy. You can also specify the name of the domain in fqdn format. Regards shiv shivanand sinanan i can t explain that.
I d like to identify a more efficient method for identifying large ad groups with powershell say more than 5000 users. Add localgroupmember group administrators member contoso maximus you can also use the same command to add domain groups to a local group. Get aduser all properties txt that enumerates all the properties i saw in my domain.