We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script Repository

Users who are members of each specified group

May 12, 2020 Views: 729

The script can be used to generate a report that will include users who are members of each group specified in a parameter. To run the script, create a report with an AD object picker parameter that will be used to specify the groups whose members will be added to the report.

Parameters:

  • $groupsParam - Specifies the name of the parameter used to specify groups with the param- prefix.
  • $groupsParamSeparator - Specifies a value that will be used to separate values of the parameter whose name is specified in the $groupsParam variable (e.g. semilocon). The separator should not be a comma as it is used in distinguished names (DNs).
Edit Remove
PowerShell
$groupsParam = "param-groups" # TODO: modify me
$groupsParamSeparator = ";" # TODO: modify me

# Get parameter value
$groupDNs = $Context.GetParameterValue($groupsParam)

# Build search filter
$filter = "(&(sAMAccountType=805306368)"
foreach ($dn in $groupDNs.Split($groupsParamSeparator))
{
    $filter += [Softerra.Adaxes.Ldap.FilterBuilder]::Create("memberOf", $dn)
}
$filter += ")"

$Context.DirectorySearcher.AppendFilter($filter)

# Generate report
$Context.Items.Add($Context.DirectorySearcher)

Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers