Skip to content

Deleting Business Rules

The following code sample deletes 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 'My Rule' 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)

# Delete the Business Rule
$rule.DeleteObject("ADM_DELETEOBJECTFLAGS_AUTO")

See also