Enabling and disabling business rules

The following code sample shows how to enable and disable a business rule.

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

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

# Bind to the business rule
$businessRulesPath = $service.Backend.GetConfigurationContainerPath(
    "BusinessRules")
$businessRulesPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" `
    $businessRulesPath
$myRuleAdsPath = $businessRulesPathObj.CreateChildPath( `
    "CN=My Rule")
$rule = $service.OpenObject($myRuleAdsPath, $null, $null, 0)

# Enable the business rule
$rule.Disabled = $False
$rule.SetInfo()

# Disable the business rule
$rule.Disabled = $true
$rule.SetInfo()

See also