Hello Pierre,
Thank you for specifying.
You can use a report that will be generated by the below script. For information on how to create reports, have a look at the following tutorial: https://www.adaxes.com/tutorials_Active ... Report.htm. On step 3, create a scope that will include objects in an Active Directory location (e.g. Organizational Unit).
function IsUserPropertiesValid($propertyPatternDN, $userPropertyList)
{
# Bind to the Property Pattern
$propertyPattern = $Context.BindToObjectByDN($propertyPatternDN)
foreach($item in $propertyPattern.Items)
{
# Get property entry
try
{
$propertyEntry = $userPropertyList.Item($item.PropertyName)
}
catch
{
continue
}
$propertyEntry.ControlCode = "ADS_PROPERTY_UPDATE"
# Get constraints
$constraints = $item.GetConstraints()
foreach($constraint in $constraints)
{
$errorMsg = $NULL
if ($constraint.Check($propertyEntry, $user, [ref]$errorMsg))
{
continue
}
return $False
}
}
return $True
}
try
{
$Context.DirectorySearcher.AppendFilter("(sAMAccountType=805306368)")
$searchIterator = $Context.DirectorySearcher.ExecuteSearch()
while ($Context.MoveNext($searchIterator))
{
$user = $Context.BindToObjectBySearchResult($searchIterator.Current)
# Get Property Patterns effective for the user
try
{
$propertyPatternDNs = $user.GetEx("adm-EffectivePropertyPatterns")
}
catch
{
continue
}
$user.GetInfo()
$userPropertyList = $user.PropertyList
foreach($propertyPatternDN in $propertyPatternDNs)
{
if (IsUserPropertiesValid $propertyPatternDN $userPropertyList)
{
continue
}
$Context.Items.Add($user)
break
}
}
}
finally
{
if ($searchIterator) { $searchIterator.Dispose() }
}