Hi,
we save the start date of employees within adm-CustomAttributeDate1
and I would like to fetch them based on this field.
My criteria looks like this, however I get no response
New-AdmCriteria "user" {adm-CustomAttributeDate1 -occurredMoreThan 5}
Full script
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
$containerDN = "OU=XX,DC=XX,DC=XX"
# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")
$searcher = $service.OpenObject("Adaxes://$containerDN", $null, $null, 0)
$searcher.Criteria = New-AdmCriteria "user" {adm-CustomAttributeDate1 -occurredMoreThan 5}
$searcher.SearchScope = "ADS_SCOPE_SUBTREE"
try
{
# Execute search
$searchResultIterator = $searcher.ExecuteSearch()
foreach ($searchResult in $searchResultIterator.FetchAll())
{
$userPath = $searchResult.AdsPath
$user = $service.OpenObject($userPath, $null, $null, 0)
Write-Host $user.Name
}
}
finally
{
# Release resources
$searchResultIterator.Dispose()
}
What I want to achieve:
- When the start date is reached, add the user to a specific group
I also tried rule-based groups and business units, but none of them allow me to use the adm-CustomAttributeDate1
as search filter.