0 votes

I've found the report which shows all the users who do not have a line manager set.
Is there a way to report showing the user, preferably by department and section, and who their line manager is set to?
Thanks

by (700 points)
0

Hello,

Yes, this is possible. What attribute do you use to store the section?

0

Hi sorry for the delay in getting back to you. We use 'Description' for the secion.

0

Hello,

OK, got you. It is possible to generate such a report with the help of a script. We've assigned our script guys with the task to write the necessary script and will update this topic as soon as they come up with something.

0

Great, thanks.

1 Answer

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

Update 2018

Starting with version 2018.1, you can create custom reports and make them available in the Web interface. For details, have a look at the following tutorial: https://www.adaxes.com/tutorials_ActiveDirectoryManagement_CreateReport.htm.

Original

Hello Carole,

The following script builds the request that you requested and sends it by e-mail. Script parameters:

  • $to - specifies email addresses of the recipient(s) of the report;
  • $subject - specifies the email message subject;
  • $reportHeader - specifies the email message header;
  • $reportFooter - specifies the email message footer.

To run the report on demand, create a Custom Command for the Domain-DNS object type and execute it on any of your AD domains. To schedule it, you need to create a Scheduled Task configured for the Domain-DNS object type. To add the script to a Custom Command or Scheduled Task, use the Run a program or PowerShell script action.

$to = "recipient@domain.com" # TODO: modify me
$subject = "Management Report" # TODO: modify me
$reportHeader = "<h2><b>List of User Managers by Department and Section</b></h2>" # TODO: modify me
$reportFooter = "<hr /><p><i>Please do not reply to this e-mail, it has been sent to you for notification purposes only.</i></p>" # TODO: modify me

# Search users
$searcher = $Context.BindToObject("Adaxes://rootDSE")
$searcher.SearchFilter = "(&(sAMAccountType=805306368)(department=*)(description=*))"
$searcher.SearchScope = "ADS_SCOPE_SUBTREE"
$searcher.PageSize = 500
$searcher.SetPropertiesToLoad(@("department", "description", "manager", "objectGuid"))
$searcher.VirtualRoot = $True

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

    # Build department and section list
    $departmentList = @{}
    foreach ($userId in $users)
    {
        # Update department list
        $department = $userId.Properties["department"].Value
        $section = $userId.Properties["description"].Value
        if (!($departmentList.ContainsKey($department)))
        {
            $departmentList.Add($department, @{})
        }

        # Update section list
        $sectionList = $departmentList[$department]
        if (!($sectionList.ContainsKey($section)))
        {
            $sectionList.Add($section, @{})
        }

        # Get manager name
        $managerDN = $userId.Properties["manager"].Value
        if ($managerDN -ne $NULL)
        {
            $managerPath = New-Object -TypeName "Softerra.Adaxes.Adsi.AdsPath" -ArgumentList @($null, $managerDN)
            $managerDisplayName = [Softerra.Adaxes.Utils.ObjectNameHelper]::GetObjectName($managerPath, "IncludeParentPath")
        }
        else
        {
            $managerDisplayName = "No manager"
        }

        # Update manager list
        $userDisplayName = $Context.GetDisplayNameFromAdsPath($userId.AdsPath)
        $guid = [Guid]$userID.Properties["objectGUID"].Value
        $userLink = "<ul><a href='$webInterfaceAddress`ViewObject.aspx?guid=$guid'>$userDisplayName</a></ul>"
        $managerList = $sectionList[$section]
        if ($managerList.ContainsKey($managerDisplayName))
        {
            $managerList[$managerDisplayName] += $userLink
        }
        else
        {
            $managerList.Add($managerDisplayName, @($userLink))
        }
    }
}
finally
{
    $searchResult.Dispose()
}

# Build report

# Get the default Web Interface address
$webInterfaceAddress = "%adm-WebInterfaceUrl%"
if ([System.String]::IsNullOrEmpty($webInterfaceAddress))
{
    $Context.LogMessage("Default web interface address not set for Adaxes service. For details, see http://www.adaxes.com/help/?HowDoI.ManageService.RegisterWebInterface.html", "Warning")
}
$reportHeader += "<ol>"
foreach ($department in $departmentList.Keys)
{
    # Add department to the report
    $reportHeader += "<ul><b>$department</b></ul>"

    $sectionList = $departmentList[$department]
    $reportHeader += "<ol>"
    foreach ($section in $sectionList.Keys)
    {
        # Add section to the report
        $reportHeader += "<ul><b>$section</b></ul>"
        $managerList = $sectionList[$section]
        $reportHeader += "<ol>"
        foreach ($managerDisplayName in $managerList.Keys)
        {
            # Add manager to the report
            $reportHeader += "<ul><b>$managerDisplayName</b></ul><ol>"
            # Add users to the report
            $reportHeader += $managerList[$managerDisplayName]
            $reportHeader += "</ol><br/>"
        }
        $reportHeader += "</ol>"
    }
    $reportHeader += "</ol>"
}
$reportHeader += "</ol>"

# Send report
$htmlReport = $reportHeader + $reportFooter
$Context.SendMail($to, $subject, $NULL, $htmlReport)

Related questions

0 votes
1 answer

Given a subset of user accounts within our domain, is it possible to run a report showing all groups they are member of within the domain? For example, given the following users ... able to generate a single report in a xlsx or csv format that groups by User.

asked May 21, 2020 by sirslimjim (480 points)
0 votes
1 answer

Hello, I am having issues with Reports not matching the results in the Console and Web UI. Below, you can see that the Adaxes Console only has 8 Workstations listed, but on the ... UI. Any help is appreciated, let me know if there is any questions. Thank You!

asked Jul 23, 2023 by Edogstraus00 (490 points)
0 votes
1 answer

We manage employee user accounts in our on-premise Active Directory and synchronize them to Azure Active Directory using Azure AD Connect. We'd like to be able to generate ... if this is possible so we can easily identify user accounts that are truly inactive.

asked May 9, 2023 by RickWaukCo (320 points)
0 votes
1 answer

Is there a report, or a way to make a custom report, to show when a custom command was run and who it was run against? The Operation in the log is "Execute Deprovision User Account"

asked Apr 11, 2023 by stlouischiefs (20 points)
0 votes
0 answers

When I run the above script after selecting groups the custom field "Group" is not showing one of the selected groups and not all of the groups are being reported ... 2 specific security groups are appearing and neither in one that was included in the search

asked Nov 18, 2021 by A_Pastor (70 points)
3,549 questions
3,240 answers
8,232 comments
547,824 users