0 votes

I created a scheduled task (to export data) with a domain as its activity scope, runs perfectly. I modified it to use a Business Unit as its activity scope, now it doesn't run. There are no exceptions and there is no log summary, which makes it appear the task didn't even 'fire'. I also tried initiating it manually using "Run Now" and I can see attempts to run, but still not output nor are any entries/exceptions created in the log. I thought maybe in the "Assignment Options", the property "This Business Unit object" under "Make the task effective for" should be checked, but the property is not editable in the dialog.

by (270 points)
0

Hello,

Can you post here or send us the Membership Rules of your Business Unit?

0

(|(&(sAMAccountType=805306368)(employeeType=*Contractor*))(&(sAMAccountType=805306368)(employeeType=*WC Employee*))(&(sAMAccountType=805306368)(employeeType=*Agency Temp*))(&(sAMAccountType=805306368)(employeeType=*Volunteer/Partner*))(&(sAMAccountType=805306368)(!(termFlag=*))(!(userAccountControl=*Disabled*))))

0

Hello,

OK, understood, so the Business Unit is query-based. And what about the scope of the query? Is it set to All Domains or to a particular domain, OU or Container?

0

It's set to All Domains

0

Hello,

Hmm ... That's strange. What version of Adaxes (including the build number) are you running? Can you post here or send us a screenshot of the actions / conditions and assignments of your Scheduled Task?

Also, can you make sure that the task wasn't triggered by checking its Activity History? For information on how to view the Activity History of a Scheduled Task, see the following help article: http://www.adaxes.com/help/?ManageSched ... story.html.

0

Here is how the task is configured.

This is what the task is doing

Import-Module Adaxes
$filePath = '<filepath here># TODO: modify me

# Get domain name
$domainName = $Context.GetObjectDomain('%distinguishedName%')

# Get all users in the target OU and export properties to a file
Get-AdmUser -Filter * -SearchBase '%distinguishedName%' -SearchScope Subtree -AdaxesService localhost -Server $domainName -Properties employeeID, mail, department, wctitle, displayName, telephoneNumber, superUID, buildingName, locationFloor, roomNumber | `
    Select-Object -Property DistinguishedName, employeeID, mail, ssn, department, wctitle, displayName, telephoneNumber, superUID, buildingName, locationFloor, roomNumber | Export-Csv $filePath -NoTypeInformation

Here's the Adaxes console version (does that equate to the version of Adaxes that's running)?

Yes, I had already checked the Activity History and despite its schedule, there are no entries for any runs since I ran it manually on 03/23/2015.

0

The previous image was from the client running on my machine. Here's what's installed on the server.

1 Answer

0 votes
by (216k points)
selected by
Best answer

The reason why your Scheduled Task is not triggered is because it is configured for the Domain-DNS object type, but your Business Unit includes Users only.

Based on the LDAP filter that you use for your Business Unit, it doesn't include any domains, and thus there is not a single Domain-DNS object in the Business Unit that the Scheduled task can be triggered on.

The best way to resolve the issue would be not to use a Business Unit, but rather have the LDAP filter hard-coded directly in the script. If you are OK with such a solution, we'll help you to modify your script.

0

Ahhh, this task has gone through a few iterations of design. Initially I designed to task to just see if I could export all users in two domains (one is a 'child') by using the DomainDNS. When I discovered Business Units, I thought that would be an easy way to filter. I guess not.

So I wouldn't be able to select Business Unit instead of Domain-DNS as the object instead of Domain-DNS? Please explain how to use one Task get all users fitting the criteria in the query from two domains.

0

Hello,

We suggest changing the script used in your Scheduled Task. The following version of your script generates a report on all members of the Business Unit whose name is specified by $businessUnitName with properties specified in $propertiesToExport and saves the report into a CSV file specified by $csvFilePath.

$businessUnitName = "My Business Unit" # TODO: modify me
$csvFilePath = "\\Server\share\report.csv"
$propertiesToExport = @(
    "distinguishedName", 
    "employeeID", 
    "mail", 
    "ssn", 
    "department", 
    "wctitle", 
    "displayName", 
    "telephoneNumber", 
    "superUID", 
    "buildingName", 
    "locationFloor", 
    "roomNumber"
) # TODO: modify me

# Find the Business Unit
$businessUnitsPath = $Context.GetWellKnownContainerPath("BusinessUnits")
$searcher = $Context.BindToObject($businessUnitsPath)
$searcher.SearchFilter = "(&(objectCategory=adm-BusinessUnit)(name=$businessUnitName))"
$searcher.PageSize = 500
$searcher.SearchScope = "ADS_SCOPE_SUBTREE"

try
{
    $searchResult = $searcher.ExecuteSearch()
    $objects = $searchResult.FetchAll()

    if ($objects.Length -gt 1)
    {
        $Context.LogMessage("Found more than one Business Unit with name '$businessUnitName'.", "Warning")
        return
    }
    if ($objects.Length -eq 0)
    {
        $Context.LogMessage("Business Unit '$businessUnitName' does not exist.", "Error")
        return
    }

    # Get the Business Unit Members
    $unit = $Context.BindToObject($objects[0].AdsPath)
    $members = $unit.Members()

    $report = @()
    for ($i = 0; $i -lt $members.Count; $i++)
    {
        $member = $members.GetObject($i)
        $reportRecord = New-Object PSObject
        foreach ($propertyName in $propertiesToExport)
        {
            try
            {
                $value = $member.Get($propertyName)
            }
            catch
            {
                $value = "" # The property is empty
            }

            $reportRecord | Add-Member -Name $propertyName -Value $value -MemberType NoteProperty
        }
        $report += $reportRecord
    }
}
finally
{
    $searchResult.Dispose()
}

$report | Export-Csv $csvFilePath -NoTypeInformation

You can leave your Scheduled Task configured for the Domain-DNS object type and include any of your domains in the Activity Scope of your Task. The domain that you include in the Activity Scope is irrelevant, because the script generates a report on members of a Business Unit, and the Business Unit name is hard-coded in the script. The users that will be included in the report will be determined by membership in the Business Unit, and a domain is necessary merely to trigger the Scheduled Task.

0

Results look good!!! I'll let it run scheduled a few times and then I can further tweak it for similar exports. Thanks so much for your assistance.

0

Well I commented too soon. The output is off by two (console vs. CSV).

0

Hello,

The output is off by two (console vs. CSV).

What do you mean exactly? Does the Administration Console show 2 more members of the Business unit that do not show up in the CSV file, do we get you right?

0

It's the reverse, the output contains more than the Console. I ran it again and now it's one off. I'm going to do a comparison to determine which user is missing, and also test with another BU.

0

I tested with a different OU and the number of output results were the same. Closing this thread, but I'll log the output discrepancy on the other business unit as a support request. Thanks for the assistance.

Related questions

0 votes
1 answer

Hi We have a set of business rules which are used for creating new distribution lists, these rules all have the same activity scope of a number of OUs, but the number of OUs ... when a new OU is created, it's not missed from the activity scope. Thanks Matt

asked May 12, 2022 by chappers77 (2.0k points)
0 votes
1 answer

I have a scheduled task that exports the members from a Business unit. However the number of members in the Business Unit (4648), does not equal the number of rows ... of where else I could look to determine the discrepancy, I would greatly appreciate it.

asked Aug 11, 2016 by sandramnc (870 points)
0 votes
1 answer

In the query portion of creating a business unit: Group Query Section $rules = $unit.GetMembershipRules() $rule = $rules.Create("ADM_BUSINESSUNITMEMBERSHIPTYPE_QUERY") $rule.Exclude = $false ... by. Sorry if this is specified somewhere, but I couldn't find it.

asked Jun 4 by ajmilic (100 points)
0 votes
1 answer

This search script works well. Thank you. I would like to search for all scheduled tasks based on Activity Scope. I would like to delete all scheduled tasks that are ... be assigned over a specific user. What would be the best approach under this circumstance?

asked Apr 11 by Moodie007 (60 points)
0 votes
1 answer

My scheduled task currently: Checks for staff in a particular OU that do not have an O365 license Adds a license Resets their AD Password Moves them to an OU based off ... scheduled task moves them out of the OU that the business rule is looking at. Thanks

asked Apr 15, 2020 by russmerriman (40 points)
3,588 questions
3,277 answers
8,303 comments
548,094 users