Enabling and disabling security roles
The following code sample shows how to enable and disable a security role.
[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 security role
$securityRolesPath = $service.Backend.GetConfigurationContainerPath( `
"AccessControlRoles")
$securityRolesPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" `
$securityRolesPath
$roleAdsPath = $securityRolesPathObj.CreateChildPath("CN=My Role")
$role = $service.OpenObject($roleAdsPath, $null, $null, 0)
# Enable the role
$role.Disabled = $false
$role.SetInfo()
# Disable the role
$role.Disabled = $true
$role.SetInfo()
See also
- Managing security roles
- Binding to Adaxes-specific objects
- Managing Adaxes-specific objects
- IADs
- Online script repository