The script generates a report containing objects located in the OUs selected in a report parameter. Objects are added to the report based on a search filter. For information on creating reports, see the Create Report tutorial.
Parameters:
- $ousParam - Specifies the name of the object picker parameter used to select the OUs to search in. The name should be specified with the param- prefix.
- $ousParamSeparator - Specifies the separator defined for the parameter values.
- $searchFilter - Specifies the LDAP search filter used to find objects to be included into the report.
PowerShell
$ousParam = "param-searchOUs" # TODO: modify me
$ousParamSeparator = ";" # TODO: modify me
$searchFilter = "(objectCategory=computer)" # TODO: modify me
# Get parameter value
$ouDNs = $Context.GetParameterValue($ousParam)
# Specify search filter
$Context.DirectorySearcher.AppendFilter($searchFilter)
foreach ($dn in $ouDNs.Split($ousParamSeparator))
{
# Add items to the report
$Context.DirectorySearcher.BaseObjectPath = $dn
$Context.Items.Add($Context.DirectorySearcher)
}