Share via


ExcludedUserAccountCollection object

The ExcludedUserAccountCollection object contains a collection of ExcludedUserAccount objects that represent users for which new end-user licenses and client licensor certificates cannot be issued. You can retrieve this collection by calling the UserAccounts property on the ExclusionPolicy object.

Members

The ExcludedUserAccountCollection object has these types of members:

Methods

The ExcludedUserAccountCollection object has these methods.

Method Description
Add Adds an object to the collection (inherited from IList).
Clear Removes all objects from the collection (inherited from IList).
Contains Determines whether the collection contains a specific object (inherited from IList).
CopyTo Copies the collection elements to an array, starting at a specified index (inherited from ICollection).
IndexOf Retrieves the index of a specific object in the collection (inherited from IList).
Insert Inserts an object in the collection at the specified index (inherited from IList).
Refresh Refreshes the collection from the collection saved on the server.
Remove Removes the first occurrence of the specified object from the collection (inherited from IList).
RemoveAt Removes the object at the specified index from the collection (inherited from IList).

Properties

The ExcludedUserAccountCollection object has these properties.

Property Description
Count
Retrieves the number of objects contained in the collection (inherited from ICollection).
Enabled
Specifies or retrieves a Boolean value that indicates whether the collection is enabled.
Item
Specifies or retrieves the object at the specified index (inherited from IList).

Examples

DIM config_manager
DIM admin_role

' *******************************************************************
' Create and initialize a ConfigurationManager object.

SUB InitObject()

  CALL WScript.Echo( "Create ConfigurationManager object...")
  SET config_manager = CreateObject _
    ("Microsoft.RightsManagementServices.Admin.ConfigurationManager")      
  CheckError()
    
  CALL WScript.Echo( "Initialize...")
  admin_role=config_manager.Initialize(false,"localhost",80,"","","")
  CheckError()

END SUB

' *******************************************************************
' Exclude user accounts.

SUB ExcludeUser()

  DIM exclusionPolicy
  DIM excludedUser
  DIM excludedUserColl   

  ' Retrieve the ExclusionPolicy object.
  SET exclusionPolicy = config_manager.Enterprise.ExclusionPolicy
  CheckError()

  ' Create an ExcludedUserAccount object.
  SET excludedUser = CreateObject( _
    "Microsoft.RightsManagementServices.Admin.ExcludedUserAccount")
  CheckError()

  ' Set the user ID.
  excludedUser.UserId = "someone@example.com"
  CheckError()

  ' Identify the excluded public key.
  excludedUser.PublicKey = "D3QgTm9y1ujYqiy4tocvmnyvnlp" _
        & "kthp5+TrtF94qJN/I38bxALpAj9ExB4Do6P+rHWvMR+0HztV7Yelo" _
        & "B3r2IlX2lQYe7mxZwnF2D5/7GUzPj5hKxCT/By55tX3Bzs4Eno7cX" _
        & "fTeJ6mnMDO+KyjNoObg9kPRCy2hmHhj2ftRvLk="
  CheckError()

  ' Retrieve the ExcludedUSerAccountCollection object.
  SET excludedUserColl = exclusionPolicy.UserAccounts
  CheckError()

  ' Enable the collection.
  excludedUserColl.Enabled = TRUE

  ' Add the new user account to the collection.
  excludedUserColl.Add( excludedUser )
  CheckError()

END SUB

' *******************************************************************
' Error checking function.

FUNCTION CheckError()
  CheckError = Err.number
  IF Err.number <> 0 THEN
    CALL WScript.Echo( vbTab & "*****Error Number: " _
                       & Err.number _
                       & " Desc:" _
                       & Err.Description _
                       & "*****")
    WScript.StdErr.Write(Err.Description)
    WScript.Quit( Err.number )
  END IF
END FUNCTION

Requirements

Minimum supported client
None supported
Minimum supported server
Windows Server 2008
Assembly
Microsoft.RightsManagementServices.Admin.dll

See also

Active Directory Rights Management Services Scripting API Reference