Hello,
Sorry for misleading you. The script in the post we've cited in the initial reply contains an error. This script should remedy the issue:
$ouDNs = @("OU=Unmanaged Accounts 1,DC=domain,DC=com","OU=Unmanaged Accounts 2,DC=domain,DC=com") # TODO: modify me
function GetUserSids($ouDNs)
{
$userSids = New-Object "System.Collections.Generic.HashSet[String]"
foreach ($ouDN in $ouDNs)
{
$ou = $Context.BindToObjectByDN($ouDN)
$userSearcher = New-Object "Softerra.Adaxes.Adsi.Search.DirectorySearcher" $NULL, $False
$userSearcher.SearchParameters.BaseObjectPath = $ou.AdsPath
$userSearcher.SearchParameters.PageSize = 500
$userSearcher.SearchParameters.SearchScope = "ADS_SCOPE_SUBTREE"
$userSearcher.SearchParameters.Filter = "(sAMAccountType=805306368)"
$userSearcher.SearchParameters.ReferralChasing = "ADS_CHASE_REFERRALS_NEVER"
$userSearcher.SetPropertiesToLoad(@("objectSid"))
$searcherResult = $userSearcher.ExecuteSearch()
$users = $searcherResult.FetchAll()
$searcherResult.Dispose()
foreach ($userID in $users)
{
$sidBytes = $userID.Properties["objectSid"].Value
$sid = New-Object "Softerra.Adaxes.Adsi.Sid" @($sidBytes, 0)
$userSids.Add($sid.ToString()) | Out-Null
}
}
return ,$userSids
}
$userSids = GetUserSids $ouDNs
$configurationSetSettingsPath = $Context.GetWellKnownContainerPath("ConfigurationSetSettings")
$admConfigurationSetSettings = $Context.BindToObject($configurationSetSettingsPath)
$admConfigurationSetSettings.SetUnmanagedAccounts(@($userSids))