0 votes

Hi,

In the SDK I find information on how to use Powershell to read and create scripts in custom commands and business rules, but I can not find the same for reports.

How can I access the report configuration objects to extract information like the embedded scripts for the report and custom columns?

-- Morten A. Steien

by (300 points)
0

Hello Morten,

Sorry for the confusion, but we are not sure we understand what exactly you are trying to achieve. Please, describe the desired workflow in all the possible details with live examples.

0

For Custom Commands it is documented in the SDK here: https://www.adaxes.com/sdk/DefiningActionsAndConditions/ The Managing Reports section do not have similar information (that I can find ).

This is (the relevant part of) the script that I use for Custom Commands to save the script(s) to a file. I need to make a similar script for Reports

$ActionTypes = ("Conditions", "Actions", "ElseIfConditionedActions", "ElseActions")
foreach ($ActionType in $ActionTypes) {
  foreach ($Action in $ActionSet.$ActionType) {
    $NotFound = $true
    if ($Action.Class -eq "adm-ScriptCondition") {
      $ActionCommand = $Action.GetCondition()
      $NotFound = $false
    }
    if ($Action.Class -eq "adm-RunScriptAction") {
      $ActionCommand = $Action.GetAction()
      $NotFound = $false
    }
    if ($NotFound) { continue }
    $ScriptContent = $ActionCommand.Script
    $ScriptContent | Out-File -FilePath ($BaseDirectory + "$ScriptName`.ps1") -Encoding utf8
  }
}

1 Answer

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

Hello Morten,

Thank you for clarifying. You need to bind to the report and then use the corresponding properties to obtain the script used to generate the report. The script will look like below. You can check section API documentation\ADSI provider\Reports of our SDK for details.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$reportDN = "CN=My Report,CN=Reports,CN=Reports Root,CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes" # TODO: modify me

# Connect to Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Get report generator
$report = $service.OpenObject("Adaxes://$reportDN", $null, $null, 0)
$reportConfig = $report.GetConfiguration()

# Get report script
 $reportScript = $reportConfig.Generator.Script
0

Perfect! Thank you for your excellent help. :)

Related questions

0 votes
1 answer

I'm in the process of creating a Web interface for requesting IT accounts. Upon submission, I want to run a Powershell script that will create an item in a Sharepoint task list.

asked May 14, 2021 by sandramnc (870 points)
0 votes
1 answer

I added the Password last set field to the Admin view but when I click on edit it allows the admin user to change the value. Adaxes correclty handel Bad Password time and Bad password ... last set, so I guest there is a way but I can not find it. Thanks you

asked Dec 19, 2019 by tomlaf (60 points)
0 votes
1 answer

The checkbox is not selected (False) by default.

asked May 30, 2022 by john.harding (70 points)
0 votes
1 answer

Hi All, I am currently using the 30 day free trial of Adaxes and seeing if we can use it to achieve our method of user provisioning. I am looking into server-side ... variable value within an SQL query Can this be achieved? Any help is much appreciated, Thanks

asked Feb 1 by Lewis (40 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 (110 points)
3,549 questions
3,240 answers
8,232 comments
547,814 users