Hello,
Yes, sure. The following PowerShell script that you can use in your Custom Command outputs all users who are members of the group to the Execution Log of the operation. the Execution Log will be shown to the user when the Custom Command completes.
# Create LDAP filter to search for group members
try
{
$memberGuids = $Context.TargetObject.GetEx("adm-MembersGuid")
}
catch
{
$Context.LogMessage("The group doesn't have any members", "Information")
return
}
$filter = New-Object "System.Text.StringBuilder"
$filter.Append("(&(objectCategory=person)(objectClass=user)(|")
foreach ($memberGuid in $memberGuids)
{
$filter.Append([Softerra.Adaxes.Ldap.FilterBuilder]::Create("objectGuid", $memberGuid))
}
$filter.Append("))")
# Execute search
$searcher = New-Object "Softerra.Adaxes.Adsi.Search.DirectorySearcher" @($Null, $False)
$searcher.SearchParameters.BaseObjectPath = $Context.TargetObject.ObjectInfo.Path
$searcher.SearchParameters.Filter = $filter
$searcher.SearchParameters.PageSize = 500
$searcher.SearchParameters.SearchScope = "ADS_SCOPE_SUBTREE"
$searcher.SearchParameters.VirtualRoot = $True
$searcher.SearchParameters.PropertiesToLoad.Add("name")
$searcher.SearchParameters.PropertiesToLoad.Add("userPrincipalName")
$searchResultIterator = $searcher.ExecuteSearch()
try
{
$searchResults = $searchResultIterator.FetchAll()
}
finally
{
$searchResultIterator.Dispose()
}
# Display results
if ($searchResults.Length -eq 0)
{
$Context.LogMessage("The group doesn't have any members", "Information")
return
}
foreach ($searchResult in $searchResults)
{
$fullname = $searchResult.Properties["name"].Value
$username = $searchResult.Properties["userPrincipalName"].Value
$Context.LogMessage("$fullname ($username)", "Information")
}
To create a Custom Command that launches the script on a group:
- Create a new Custom Command.
- On the 2nd step of the Create Custom Command wizard, select the Group object type.
- On the 3rd step, add the Run a program or PowerShell script action and paste the above script in the Script field.
Alternatively, you can use the functionality built in Adaxes. One of Adaxes builtin reports, Group Members report, allows you to get a list of members of a group.
The list is presented in the form of an Active Directory object list, where you can select the columns to display and perform various operations on group members.
By the way, in mid-2014 we are going to release a version of Adaxes with a completely new look and feel of Adaxes Web Interface. In that version, in the Members / Member Of sections there will be tooltips appearing when you hover your mouse over group members. It will be possible to view detailed information on group members in such tooltips.