We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script repository

Add value to drop-down list parameter

July 08, 2021 Views: 1158

The script adds a new value to a specific drop-down list parameter of a report. The script should be executed in Windows PowerShell. When prompted, specify the credentials of the Adaxes service account.

Parameters:

  • $serviceHost - Specifies the host name of the computer where Adaxes service is installed.
  • $reportDN - Specifies the distinguished name (DN) of the report to update. For information on how to get the DN, see Get the DN of a directory object.
  • $parameterId - Specifies the identifier of the report drop-down list parameter to update. For information on how to obtain identifiers of report parameters, see View information on report parameters.
  • $valueToAdd - Specifies the value to add to the parameter.
Edit Remove
PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$serviceHost = "localhost" # TODO: modify me
$reportDN = "CN=My Report,CN=Reports,CN=Reports Root,CN=Configuration Objects,"+
    "CN=Adaxes Configuration,CN=Adaxes" # TODO: modify me
$parameterId = "ADAXESPARAMID:{3664233f-3c73-4cae-8bef-50ded4ee0d0c}" # TODO: modify me
$valueToAdd = "My value" # TODO: modify me

# Prompt for credentials.
$credential = Get-Credential

# Connect to the Adaxes service.
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly($serviceHost)

# Retrieve report configuration.
$report = $admService.OpenObject("Adaxes://$reportDN", $credential.UserName, $credential.GetNetworkCredential().Password, 0)
$configuration = $report.GetConfiguration()

# Get the parameter.
$reportParameters = $configuration.Parameters
$parameter = $reportParameters | Where {$_.ID -eq $parameterId}

# Add parameter value.
$newParameterValue = $parameter.CreateValue()
$newParameterValue.Value = $valueToAdd
$parameter.Values += $newParameterValue

# Update report.
$configuration.Parameters = $reportParameters
$report.SetConfiguration($configuration)
Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers