Deleting security roles
The following code sample deletes a security role.
[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 security role
$securityRolesPath = $admService.Backend.GetConfigurationContainerPath( `
"AccessControlRoles")
$securityRolesPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" `
$securityRolesPath
$roleAdsPath = $securityRolesPathObj.CreateChildPath("CN=My Role")
$role = $admService.OpenObject($roleAdsPath, $NULL, $NULL, 0)
# Delete the role
$role.DeleteObject("ADM_DELETEOBJECTFLAGS_AUTO")
See also
- Managing security roles
- Binding to Adaxes-specific objects
- Managing Adaxes-specific objects
- IADsDeleteOps
- Online script repository