Created
November 14, 2018 13:47
-
-
Save egde/4319a8fd9ad92e872569e2d5a8f795a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define LDAP search root, the Global catalog of the domain | |
$sLDAPSearchRoot="LDAP://YOUR.CORP.ORG" | |
# The Groupname to looking for | |
$sGroupName="AD_GROUPNAME" | |
# The query string | |
$sSearchStr ="(&(objectCategory=group)(name="+$sGroupName+"))" | |
# Get the search object | |
$oSearch=New-Object directoryservices.DirectorySearcher($oADRoot,$sSearchStr) | |
# Looking for the group | |
$oFindResult=$oSearch.FindAll() | |
$oGroup=New-Object System.DirectoryServices.DirectoryEntry($oFindResult.Path) | |
$oGroup.member | Out-GridView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment