PowerShell: Find All Groups Containing A Specific String
Maybe your like
Written by
Aleksander Nordgarden-Rødnerin
PowerShellSometimes, you need a list of all groups whose name contain a specific string, whether that is in the beginning, middle, or end of the group name. As we’ve seen previously, looking up groups in PowerShell is done with the Get-ADGroup command. Adding the -filter parameter allows us to find groups that satisfy our needs. Using asterisks as wildcards, we can specify whether the string should be at the start, middle, or end:
Get-ADGroup -Filter "Name -like 'Beginning*'" Get-ADGroup -Filter "Name -like '*Middle*'" Get-ADGroup -Filter "Name -like '*End'"If we add a pipe and “select” followed by the name of a property outputs results that satisfy the filter, showing the specified property only. It might look something like this:
PS C:\Users\USER> Get-ADGroup -Filter "Name -like 'adm*'" | select name name ---- administrators admins administrative_usersThe same method can be applied to the Get-ADUser query, to find users whose name satisfy the Filter criteria.
filterget-adgroupget-adgroupmemberget-aduserPowerShell Outlook: Mark deleted messages as read Do you 10Q?Comments
By posting a comment, you consent to our collecting the information you enter. See privacy policy for more information.Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
More posts
-
Describing a problem is half the battle
14/08/2023 -
Verify what RSAT features are installed
07/08/2023 -
State of the Blog 2023
26/06/2023 -
Installing ADUC from PowerShell
19/06/2023
Tag » Active Directory Search Group Name Contains
-
Listing All Groups In AD Containing A Given String - TechNet - Microsoft
-
Searching AD Groups, Users, And Computers Using Wildcards
-
How To Get List Of Active Directory Group Names Beginning With ...
-
Get-ADGroup -Filter | Syntax Examples - Easy365Manager
-
Script To Find AD Users That Are Members Of ANY Group That Contains ...
-
How Can I Find Out Which Active Directory Groups I'm A Member Of?
-
Add An Active Directory Group In BeyondInsight - BeyondTrust
-
Get-ADGroupMember: Find AD Users Fast With PowerShell
-
How To Write LDAP Search Filters | Atlassian Support
-
Create Groups Via Active Directory - Tableau Help
-
Active Directory Group Management Best Practices - Netwrix
-
How To Check AD Group Membership? - TheITBros
-
Active Directory Explorer - How Can I Search If A Group 'contains' A ...
-
Get Members Of An Active Directory Group And Export To CSV Using ...