Skip to content

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
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the Business Rule
$businessRulesPath = $admService.Backend.GetConfigurationContainerPath(
    "BusinessRules")
$businessRulesPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" `
    $businessRulesPath
$myRuleAdsPath = $businessRulesPathObj.CreateChildPath( `
    "CN=My Rule")
$rule = $admService.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