Script repository
The script generates a report containing objects located in the OUs selected in a report parameter. To execute the script, create a report with a Directory object picker parameter. The report should have no scope.
Parameters
$ousParam- the name of the Directory object picker parameter used to select the OUs to search in. The name should be specified with the param- prefix.$ousParamSeparator- the separator specified for the parameter values.$searchCriteria- the criteria used to find objects to be included into the report. For details on possible approaches, see How to build criteria.
$ousParam = "param-searchOUs" # TODO: modify me
$ousParamSeparator = ";" # TODO: modify me
$searchCriteria = New-AdmCriteria "computer" # TODO: modify me
# Get parameter value.
$ouDNs = $Context.GetParameterValue($ousParam)
# Specify search filter
$Context.DirectorySearcher.AddCriteria($searchCriteria)
foreach ($dn in $ouDNs.Split($ousParamSeparator))
{
# Add items to the report
$Context.DirectorySearcher.BaseObjectPath = $dn
$Context.Items.Add($Context.DirectorySearcher)
}
Comments 0
You must be signed in to comment.