0 votes

I have report which is listing all the users. I have a parameter for departments which is used as filters and it is a checkbox list. I am using this in report so we can filter the users based on the selceted departments and it is working well.

The report is using script to use the parameter and filter the users as per selected departments. This parameter is now manually populated with values of all departments we have so far. Is there a way in script I can dynamically get a list of departments and populate this parameter.

by (500 points)

1 Answer

0 votes
by (301k points)

Hello,

Yes, it is possible. Unfortunately, we do not have the exact script, but the following one should be helpful: https://www.adaxes.com/script-repository/update-custom-command-parameter-values-based-on-unique-property-values-s527.htm.

0

Thank you instead of Custom command parameter I will need to use smimilar method for my report parameter right

0

Hello,

Yes, that is correct.

0

This script should be part of the report were I am trying to populate the parameter?

Can it run outside Adaxes environment in Powershell with Adaxes powershell module ?

0

Hello,

This script should be part of the report were I am trying to populate the parameter?

No, it will not work as part of the report. It must be a separate script.

Can it run outside Adaxes environment in Powershell with Adaxes powershell module ?

You can have it as an external script executed in Windows PowerShell. However, you will need to use the ADSI provider. Adaxes PowerShell module does not have cmdlets that might be used for the task.

0

I am trying to use this script to populate a parameter in the report, just want to understand where should the script reside in Adaxes, will this need to be a custom command

0

Hello,

If you want to be able to execute the script manually in Adaxes, using a custom command is the only option.

0

Thank you for this info I will try the custom command method.

In terms of ADSI, the method to load ADSI in Powershell and use it would this be the way below [Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

0

Hello,

If your script is executed in a custom command, scheduled task of business rule, there is no need to call the method as well as connect to Adaxes service. You can just update the script we referenced previously according to the type of the parameter you have.

0

Thanks So I ma now using the script, but I have modified the TODO sections of script

$commandDN = "CN=Active Users report,CN=Users,CN=BC Custom Reports,CN=Reports,CN=Reports Root,CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes" # TODO: modify me
$parameterName = "param-departmentauto" # TOOD: modify me
$propertyName = "department" # TOOD: modify me 

 # Bind to the custom command
$command = $Context.BindToObjectByDN($commandDN)
$Context.LogMessage($command, "Information")
# Get parameter
$parameters = $command.Parameters
$parameter = $parameters | Where {$_.Name -eq $parameterName}
if ($NULL -eq $parameter)
{
    $Context.LogMessage("Parameter '$parameterName' not found in Custom Command '$commandName'.", "Warning")
    return
}

But I keep getting parameter not found message. I do notice that the object is bound in initial output of $command

I have verified that I am using the right parameter name that is defined in the report under parameters section

Screenshot of report parameter below image.png

0

Hello,

The script we referenced is just an example. You cannot directly use it for reports and it is expected to fail. Here is another example that might be helpful: https://www.adaxes.com/script-repository/add-value-to-drop-down-list-parameter-s632.htm. Pay attention that this script is intended for external execution. In your case (using a custom command), a lot of code will be gone from the script.

0

Just to provide clarity which I missed in my previous message, I am using the script in a custom command. Running it from the custom command itself.

Custom command setup image.png

Custom command with script: image.png

Script used in Custom command for testing:


$commandDN = "CN=Active Users report,CN=Users,CN=BC Custom Reports,CN=Reports,CN=Reports Root,CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes" # TODO: modify me
$parameterName = "param-departmentauto" # TOOD: modify me
$propertyName = "department" # TOOD: modify me

# Bind to the custom command
$command = $Context.BindToObjectByDN($commandDN)
$Context.LogMessage($command, "Information")
# Get parameter
$parameters = $command.Parameters
$parameter = $parameters | Where {$_.Name -eq $parameterName}
if ($NULL -eq $parameter)
{
    $Context.LogMessage("Parameter '$parameterName' not found in Custom Command '$commandName'.", "Warning")
    return
}

return 

Current error when running the script from editor image.png

0

Hello,

As it was mentioned in the previous post, your script will always fail and that is expected. You are trying to use the approach which only works for custom commands with a report. Have a look at another example we referenced. It should be helpful.

0

I see okay got it, thank you. I notice the other script uses ADSI. Can this script be created as custom command and then use a business rule to schedule or trigger this.

Overall here is our goal We want to maintain a list of unique departments within Adaxes. Currently we are achieving this through property patterns, where we have a list of department values which we enforce on user object creation form.

Now the idea is to make this automated where we update that property pattern and then our report parameter where we are using department parameter gets updated automatically.

This is the first step in achieveing this goal where I will first learn to auto populate the report parameter in a automatd fashion, if this goes well then the second step is to provide a mehtod in Adaxes UI for our helpdesk team to update the property pattern which is our primary source for all list of departments.

I am still learning ADSI combination with powershell so I will try to use the example script you have provided, will comment back with more questions. As always appreciate Adaxes supports quick responses.

0

Hello,

Can this script be created as custom command and then use a business rule to schedule or trigger this.

Yes, it is possible, that exactly what we mentioned when referenced the script.

Related questions

0 votes
1 answer

I see the script for generating a report of users enrolled, but what I'd like to do is run a script that can populate a user attribute with Yes/No or True/False if they are or are not enrolled. Is there an existing script that accomplishes this? Thanks

asked Nov 19, 2024 by msheppard (790 points)
0 votes
1 answer

Is it possible to create a business unit and have it auto populate with group owners in a specific OU. I've tried a few scripts to get propertie adm-managedbylist but none have worked so far.

asked Nov 18, 2024 by C27 (20 points)
0 votes
1 answer

The use case we are looking for is providing a list of titles for users to choose from when initiating a re-hire. We already have a title property pattern established and would ... that we can manage the list in one place. Let me know and as always, thanks.

asked Nov 22, 2024 by msheppard (790 points)
0 votes
1 answer

Here is my issue, When I use this code: $DNs = %param-GroupsInRole% $Groups = $DNs -split "|" %Param-GroupsInRole% can have multiple groups. When setting up the parameter I am ... I just need to be able to do a foreach with the groups picked by the initiator.

asked Mar 23, 2023 by mightycabal (1.1k points)
0 votes
1 answer

Occationally Service Desk staff need to clear a DNS record when a desktop has been reimaged but is keeping the same name as loses the ability to manage its original DNS ... running in ADAXES. Can I just install the applet on the ADAXES server using powershell?

asked Jan 17, 2023 by stevehalvorson (130 points)
3,677 questions
3,361 answers
8,494 comments
549,328 users