Hello,
We need a script which liste all business rule from a root container and for each business rule we want to change some parameters
To be clear, in the script below I juste want to render dynamic the variable $containers, currently we need to edit the scipt every time we add/remove a container.
$containers = @(
"CN=xxx1",
"CN=xxx2",
"CN=xxx3",
)
# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")
foreach ($container in $containers)
{
$rules = $service.OpenObject("Adaxes://xxxxx:1251/$container,CN=Business Rules,CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes", $null, $null, 0)
foreach ($rule in $rules)
{
#$rule.Name
if ($rule.Name.StartsWith("CN=Update - "))
{
$ExecutionMoment = $rule.ExecutionMoment
$ObjectType = $rule.ObjectType
$OperationType = $rule.OperationType
if ($ExecutionMoment -ine "ADM_BUSINESSRULEEXECMOMENT_AFTER")
{
$rule.ExecutionMoment = "ADM_BUSINESSRULEEXECMOMENT_AFTER"
}
if ($ObjectType -ine "user")
{
$rule.ObjectType = "user"
}
if ($OperationType -ine "set properties")
{
$rule.OperationType = "set properties"
}
$rule.SetInfo()
}
}
}
If you read the history, i put an image which descript the need, I just want to set a variable with "OAIVS" and get all "subtree" BusinessRule.
Let me know if need more details