0 votes

Hello,

I have a report of computers in multiple groups that I used to create a chart count of "Computers" in certain security memberships relating to agent software.

image.png

Imagine Agent_App1, Agent_App2, Agent_App3 etc for the group names.

In the report, since I select all of the groups that are Agent Groups, I see all computers with any agent at all. In the report, I want to create seperate columns for each agent group, with the column reporting Yes or No (Not true or false, but you may provide that option as well) depending on if the computer in the column is a member of the group. I suspect that this needs to be created with a script, but I am unsuccessful in creating one based around the Adaxes Paramaters and guides. I tried searching other related scripts, but couldn't seem to get it.

Here is an example of the report. I created the columns, but they are blank as I did not set any settings on them. This is where I want Yes or No to populate in the columns if the computer is or is not a member of the group written in the script. image.png image.png

Any assistance is appreciated.

Thanks!

by (470 points)
0

Hello,

As far as we understand, the report should display computer objects that are members of at least one of three groups. The groups will be explicitly defined in the report and users will not be able to select the groups. The report will have three custom columns, one for each of the predefined groups, and the columns will contain Yes or No values depending on the computer membership in the corresponding group. If that is correct, please, clarify whether you need to select the location where the required computer objects reside. If this is not what you meant, please, provide us with all the possible details regarding the required report including the requirements for the report parameters.

0

Hello,

Bear with me while I answer your question and give you a fuller picture of my use case with screenshots of my current setup as it may help greatly understand and also understand a potential problem to consider with this approach.

"The report will have three custom columns, one for each of the predefined groups, and the columns will contain Yes or No values depending on the computer membership in the corresponding group."

Yes, your understanding is correct. I will actually have 7 different groups.

Here is an example, imagine the Green checkmarks as "Yes" and Red X's as "No" This is how the report would look: image.png

As far as group selections, When I click the chart I created on the main page, that displays a list of all agent groups and the sum, it populates all the groups to the report paramaters and selects them all.

image.png ^^^^Main Page Chart

image.png ^^^^When Title of chart Clicked

However, if I run the report manually from within the reports tab or Adaxes Console: image.png it appears I am not able to set multiple groups as the default selction. I was unable to locate this functionality when selecting the scope for "group Members." image.png ^^^^Settings of Group Membership

image.png ^^^^What the report looks like when clicked from the reports tab at the top of the page. NOTE: I can only select from the 3 groups noted as I am sure it is because that is how it was set, however, it is conflicting as I would also belive I can also select multiple groups if I wanted to based off the prior screenshot, but I am restricted to the 3 values.

Now if I remove the 3 pre-defined groups from the settings, I can now select multiple groups, but I do not want to select all of them each time. image.png

If I select specific group, it only allows for one Group. image.png

I am not able to find the setting to ensure all groups in the OU are selected each time. If this is a function, please let me know how I can achieve this.

However, I am not concerned about the columns being dynamic to the results. Not sure if they can hide and show themselves automatically based off the groups selected.

The report will only be used for an overview display of Yes/No values in the column next the machine. This allows me to also export this to CSV and verify agent lists against other systems. There will not be a time where this report only has 1 group selected. It is expected that all the groups in the OU are always selected on report generation, everytime the report is ran. So the idea is each time I create a new agent security group, I would go in and edit the chart and the report specific column to add the new group to the report and chart.

Sorry for the long read, but hopefully this prints the full picture to light.

Thanks!

1 Answer

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

Hello,

Thank you for the provided details. Unfortunately, there is no possibility to dynamically add/remove report columns depending on the number of groups selected in the report scope/parameter. As such, the only way to achieve the desired is to specify the correspondence of groups to custom report columns in the script that will generate the report. As the required groups will be specified in the script, the report will have no scope and no parameters. The downside of this approach is that to add/remove a group from the report, you will need to add/remove a custom column for the group and adjust the script used to generate the report. The below script can be used to generate such a report. In the script, the $groupsToColumns variable specifies a mapping of group distinguished names to custom column identifiers. For information on how to get a directory object DN, have a look at the following SDK article: https://www.adaxes.com/sdk/HowDoI.GetDnOfObject. To get a custom column identifier:

  1. In the Report-specific columns section, on the Columns tab, right-click the custom column.
  2. In the context menu, navigate to Copy and click Column ID.
  3. The column identifier will be copied to the clipboard.
$groupsToColumns = @{"CN=MyGroup1,OU=MyOU,DC=domain,DC=com" = "{06bdb1e9-c6de-4368-b33e-dd30d5683ac5}"
                     "CN=MyGroup2,OU=MyOU,DC=domain,DC=com" = "{f594ff89-17af-44c6-ab51-2cb1104c76fb}"
                     "CN=MyGroup3,OU=MyOU,DC=domain,DC=com" = "{0a201265-7113-4881-8c09-5818952b8913}"} # TODO: modify me

$memberGuidsBytes = New-Object System.Collections.ArrayList

foreach ($groupDN in $groupsToColumns.Keys)
{
    # Get member GUIDS for search
    $group = $Context.BindToObjectByDN("$groupDN")
    $groupMemberGuidsBytes = $group.GetEx("adm-DirectMembersGuid")
    $memberGuidsBytes.AddRange($groupMemberGuidsBytes)
}

# Search parameters
$criteria = New-AdmCriteria -Type "computer"
$searcher = $Context.CreateGuidBasedSearcher($memberGuidsBytes)
$searcher.Criteria = $criteria

try
{
   # Execute search
   $searchResultIterator = $searcher.ExecuteSearch()
   $searchResults = $searchResultIterator.FetchAll()
}

finally
{
   # Release resources
   if ($searchResultIterator) { $searchResultIterator.Dispose() }
}

foreach ($searchResult in $searchResults)
{
    $columnValues = @{}
    foreach ($groupDN in $groupsToColumns.Keys)
    {
        # Generate values for custom columns
        $group = $Context.BindToObjectByDN($groupDN)
        if ($group.IsMember($searchResult.AdsPath))
        {
            $columnValues.Add($groupsToColumns[$groupDN], "Yes")
        }
        else
        {
            $columnValues.Add($groupsToColumns[$groupDN], "No")
        }
    }

    # Add report items
    $Context.Items.Add($searchResult, $columnValues)
}

Related questions

0 votes
1 answer

We have the following script we need fixed to run within Adaxes to add true/false value to a customattribute for use in building dynamic distribution lists. $users = ... } else { Set-Mailbox -Identity $user.Name -CustomAttribute8 "Individual contributor" } }

asked Jul 13, 2022 by willy-wally (3.2k points)
0 votes
1 answer

Hello dear ADAXES community, what i wanted to do is, to have a custom report which does the following: get every group in a specific OU (the OU comes from an adaxes custom ... Add($Group.name) } } is this possible in such a way? thank you for your help

asked Sep 23, 2020 by m_st (200 points)
0 votes
2 answers

I am trying to create a report-specific column (DateTime - Regular Date) where I can extract the datetime from the description field of the user object using a regular ... () $line = $object.Get("description") $dateTime = ?? $Context.Value = $dateTime

asked Feb 27 by emeisner (60 points)
0 votes
1 answer

I'm trying to retrive the Microsoft 365 License product name in a report as the 'Office 365 License' attribute in Adaxes shows each individual licensed product e.g. ... 365 F3"} } $productnames = $productnames -join ", " $Context.Value = $productnames

asked Jul 27, 2020 by richarddewis (260 points)
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)
3,351 questions
3,052 answers
7,791 comments
545,095 users