Skip to content

IAdmManagedDomain

The IAdmManagedDomain interface provides methods for adding and removing managed domains from Adaxes. The interface also allows you to check the accessibility of a domain and change the credentials Adaxes uses to perform operations within a domain.

Inheritance: The IAdmManagedDomain interface inherits from the IAdmTop interface.

Note

To use the IAdmManagedDomain interface, you need to bind to the object representing the domain in Adaxes. All domains managed by Adaxes are located on the Adaxes Configuration Server (AD LDS). To bind to a domain object, you need to specify its ADS path consisting of the domain name specified as DC=domainname and the path to the Managed Domains container, where domainname is the fully qualified name of the domain (e.g. example.com).

How
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$domainName = "example.com"

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Build ADS path to the managed domain
$managedDomainsPath = $admService.Backend.GetConfigurationContainerPath("ManagedDomains")
$managedDomainsPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" $managedDomainsPath
$managedDomainPath = $managedDomainsPathObj.CreateChildPath("DC=$domainName")

# Bind to the domain
$managedDomain = $admService.OpenObject($managedDomainPath, $NULL, $NULL, 0)
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const String domainName = "example.com";

        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Build ADS path to the managed domain
        string managedDomainsPath = admService.Backend.GetConfigurationContainerPath(
            "ManagedDomains");
        AdsPath managedDomainsPathObj = new AdsPath(managedDomainsPath);
        AdsPath managedDomainPath = managedDomainsPathObj.CreateChildPath("DC=" + domainName);

        // Bind to the domain
        IAdmManagedDomain managedDomain = (IAdmManagedDomain)admService.OpenObject(managedDomainPath.ToString(), null, null, 0);
    }
}

Methods

  • Method

  • Description

  • Register()

  • Adds the managed Active Directory domain to Adaxes or changes the credentials used to access the domain if it is already managed.

  • Unregister()

  • Removes a managed domain from Adaxes.

Properties

  • Property

  • Description

  • Status

  • Gets the state of a managed Active Directory domain.

  • LogonName

  • Gets the username of the account that Adaxes uses to perform operations within the domain.

Details

Register()

Adds the managed Active Directory domain to Adaxes or changes the credentials used to access the domain if it is already managed.

void Register(String username, String password)

Parameters

  • username - Specifies the username of the account used by Adaxes to perform operations within the domain. The username should be provided in the user@domain.com or DOMAIN\user format.
  • password - Specifies the password to use with the username provided.

Remarks

When the username and password parameters are set to NULL, the credentials of the Adaxes service account are used. The service account is specified during installation of the Adaxes service.

Examples

The following code sample adds an Active Directory domain to Adaxes.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$domainName = "example.com"
$username = "administrator@example.com"
$password = "secret"

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the 'Managed Domains' container
$managedDomainsPath = $admService.Backend.GetConfigurationContainerPath("ManagedDomains")
$managedDomainsContainer = $admService.OpenObject($managedDomainsPath, $NULL, $NULL, 0)

# Create a new managed domain
$managedDomain = $managedDomainsContainer.Create("adm-ManagedDomain", "DC=$domainName")
$managedDomain.SetInfo()

# Provide logon information
$managedDomain.Register($username, $password)
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
         const String domainName = "example.com";
         const String username = "administrator@example.com";
         const String passowrd = "secret";

         // Connect to the Adaxes service
         AdmNamespace adsNS = new AdmNamespace();
         IAdmService admService = adsNS.GetServiceDirectly("localhost");

         // Bind to the 'Managed Domains' container
         string managedDomainsPath = admService.Backend.GetConfigurationContainerPath("ManagedDomains");
         IADsContainer managedDomainsContainer = (IADsContainer)admService.OpenObject(
             managedDomainsPath, null, null, 0);

         // Create a new managed domain
         IAdmManagedDomain managedDomain = (IAdmManagedDomain)managedDomainsContainer.Create(
             "adm-ManagedDomain", "DC=" + domainName);
         managedDomain.SetInfo();

         // Provide logon information
         managedDomain.Register(username, passowrd);
    }
}

The following code sample changes the credentials used for a managed AD domain.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$domainName = "example.com"
$username = "administrator@example.com"
$password = "secret"

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Build ADS path to the managed domain
$managedDomainsPath = $admService.Backend.GetConfigurationContainerPath("ManagedDomains")
$managedDomainsPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" $managedDomainsPath
$managedDomainPath = $managedDomainsPathObj.CreateChildPath("DC=$domainName")

# Bind to the domain
$managedDomain = $admService.OpenObject($managedDomainPath, $NULL, $NULL, 0)

# Provide logon information
$managedDomain.Register($username, $password)
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const String domainName = "example.com";
        const String username = "administrator@example.com";
        const String passowrd = "secret";

        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Build ADS path to the managed domain
        string managedDomainsPath = admService.Backend.GetConfigurationContainerPath(
            "ManagedDomains");
        AdsPath managedDomainsPathObj = new AdsPath(managedDomainsPath);
        AdsPath managedDomainPath = managedDomainsPathObj.CreateChildPath("DC=" + domainName);

        // Bind to the domain
        IAdmManagedDomain managedDomain = (IAdmManagedDomain)admService.OpenObject(
            managedDomainPath.ToString(), null, null, 0);

        // Provide logon information
        managedDomain.Register(username, passowrd);
    }
}

Unregister()

Removes a managed domain from Adaxes.

void Unregister()

Examples

The following code sample removes an Active Directory domain from Adaxes.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$domainName = "example.com"

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Build ADS path to the managed domain
$managedDomainsPath = $admService.Backend.GetConfigurationContainerPath("ManagedDomains")
$managedDomainsPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" $managedDomainsPath
$managedDomainPath = $managedDomainsPathObj.CreateChildPath("DC=$domainName")

# Bind to the domain
$managedDomain = $admService.OpenObject($managedDomainPath, $NULL, $NULL, 0)

# Remove the domain
$managedDomain.Unregister()
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const String domainName = "example.com";

        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Build ADS path to the managed domain
        string managedDomainsPath = admService.Backend.GetConfigurationContainerPath(
            "ManagedDomains");
        AdsPath managedDomainsPathObj = new AdsPath(managedDomainsPath);
        AdsPath managedDomainPath = managedDomainsPathObj.CreateChildPath("DC=" + domainName);

        // Bind to the domain
        IAdmManagedDomain managedDomain = (IAdmManagedDomain)admService.OpenObject(
            managedDomainPath.ToString(), null, null, 0);

        // Remove the domain
        managedDomain.Unregister();
    }
}

Status

Gets the state of a managed Active Directory domain.

Examples

The following code sample outputs the status of all domains managed by Adaxes.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object("Softerra.Adaxes.Adsi.AdmNamespace")
$admService = $admNS.GetServiceDirectly("localhost")

# Get a list of managed domains
$managedDomains = $admService.GetManagedDomains()

foreach ($domain in $managedDomains)
{
    # Name
    Write-Host "Domain name: " $domain.Name

    # Status
    Write-Host "Domain status: " -NoNewline
    Switch ($domain.Status)
    {
         "ADM_MANAGEDDOMAINSTATUS_INACTIVE"
         {
             Write-Host "The domain is not operational because it is initializing or an internal error has occurred."
         }
         "ADM_MANAGEDDOMAINSTATUS_UNREGISTERED"
         {
             Write-host "The domain is not accessible to the Adaxes service as administrative credentials were not provided."
         }
         "ADM_MANAGEDDOMAINSTATUS_OPERATING"
         {
             Write-Host "The domain is fully operational and accessible to the Adaxes service."
         }
    }
    Write-Host
}
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
         // Connect to the Adaxes service
         AdmNamespace adsNS = new AdmNamespace();
         IAdmService admService = adsNS.GetServiceDirectly("localhost");

         // Get a list of managed domains
         IADsCollection managedDomains = admService.GetManagedDomains();

         foreach (IAdmManagedDomainInfo domain in managedDomains)
         {
             // Name
             Console.WriteLine("Domain name: {0}", domain.Name);

             // Status
             Console.Write("Domain status: ");
             switch (domain.Status)
             {
                 case ADM_MANAGEDDOMAINSTATUS_ENUM.ADM_MANAGEDDOMAINSTATUS_INACTIVE:
                     Console.WriteLine("The domain is not operational because it is " +
                                       "initializing or an internal error has occurred.");
                     break;
                 case ADM_MANAGEDDOMAINSTATUS_ENUM.ADM_MANAGEDDOMAINSTATUS_UNREGISTERED:
                     Console.WriteLine("The domain is not accessible to the Adaxes service " +
                                       "as appropriate credentials were not provided.");
                     break;
                 case ADM_MANAGEDDOMAINSTATUS_ENUM.ADM_MANAGEDDOMAINSTATUS_OPERATING:
                     Console.WriteLine("The domain is fully operational and " +
                                       "accessible to the Adaxes service.");
                     break;
              }
              Console.WriteLine();
         }
    }
}

LogonName

Gets the username of the account that Adaxes uses to perform operations within the domain.

  • Type:
  • String
  • Access:
  • Read-only

Requirements

Minimum required version: 2009.1

See also