Skip to content

Creating Property Pattern containers

The following code sample creates a container for Property Patterns.

[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 'Property Patterns' container
$propertyPatternsPath = $admService.Backend.GetConfigurationContainerPath(
    "PropertyPatterns")
$propertyPatternsContainer = $admService.OpenObject($propertyPatternsPath,
    $NULL, $NULL, 0)

# Create container
$myContainer = $propertyPatternsContainer.Create("container","CN=My Container")
$myContainer.SetInfo()ode

The following code sample creates a Property Pattern in a specific container.

[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 'My Container' container
$propertyPatternsPath = $admService.Backend.GetConfigurationContainerPath(
    "PropertyPatterns")
$propertyPatternsPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath"`
    $propertyPatternsPath
$myContainerAdsPath = $propertyPatternsPathObj.CreateChildPath("CN=My Container")
$myContainer = $admService.OpenObject($myContainerAdsPath, $NULL, $NULL, 0)

# Create Property Pattern
$pattern = $myContainer.Create("adm-PropertyPattern", "CN=My Pattern")

$pattern.ObjectType = "user"
$pattern.Description = "My description"
$pattern.Disabled = $False

$pattern.SetInfo()

See also