Searching and modifying group object information
Searching Active Directory for the presence of a group is similar to searching users and groups. A cmdlet called Get-ADGroup
from the Active Directory module can be used to get group object information.
For example, we can use the following command to get display names of all groups in Active Directory:
Get-ADGroup -Filter * | select Name
By specifying asterisk (*) as an argument to the -Filter
parameter, we are querying all groups in Active Directory and then displaying the value of the Name
property using the select
statement.
To search for a specific group by name, we can pass the name of the group to the -Filter
parameter, as shown in the following command:
Get-ADGroup -Filter "Name -eq 'Test Group1'"
This command searches Active Directory for groups with the name that exactly matches Test Group1
and returns the group object if present; otherwise, no output is seen.
There is another parameter that helps in performing the search operation...