GetComputerRole

Gets the computer role that logically contains this role assignment.

Syntax

IComputerRole GetComputerRole()

Return value

The ComputerRole instance containing this role assignment.

Discussion

The role assignment contains information about an Active Directory object that has been assigned to a computer role.

Exceptions

GetComputerRole throws an ApplicationException if no computer role is found, multiple computer roles are found, or an error occurs when accessing Active Directory.

Example

The following code sample illustrates using this method in a script:

...
IComputerRole compRole = objZone.GetComputerRole(strName);
if (compRole != null)
{
  Console.WriteLine("Computer role " + strName + " already exists.");
}
...