Partager via


ConfigurationManager.Initialize method

The Initialize method initializes the administration environment, connects to the AD RMS server, and retrieves the appropriate role.

Syntax

ConfigurationManager.Initialize( _
  ByVal isHttps, _
  ByVal clusterName, _
  ByVal portNumber, _
  ByVal userDomain, _
  ByVal userId, _
  ByVal password _
)

Parameters

isHttps [in]

A Boolean value that indicates whether the connection is secure HTTP. If this value is True, specify 443 for the portNumber parameter.

clusterName [in]

A String value that contains the name of the AD RMS service that the client connects to.

portNumber [in]

An Integer value that contains the port number through which the client connects. To connect to a remote server by using a Secure Socket Layer (SSL) connection, specify 443 for this parameter and set the isHttps parameter to True.

userDomain [in]

A String value that contains the user account domain name or an empty string. If this value is empty, the current domain name is used.

userId [in]

A String value that contains the user account ID. If this value is empty, the logon user account name is used.

password [in]

A String value that contains the user account password or an empty string. If the userID parameter is not empty, the correct password for that account must be specified. If the userID parameter is empty, the password is ignored and the logon user credentials are used.

Return value

This method returns an integer value that identifies an appropriate role. The role is determined by the access control list on the AD RMS Administration website. This role value can be a bitwise-combination of the following flags.

0x0

No role is defined.

RoleAuditor

0x1

The auditing role is defined.

RoleTemplateEditor

0x2

The rights template editing role is defined.

RoleAdministrator

0x4

The administrator role is defined.

Remarks

The following objects are configured during the initialization process depending on the role value returned by the AD RMS server.

Object Description
AuditReport If the role is Administrator (0x4) or Auditor (0x1), this object is initialized.
ClusterInformation If the role is any value other than None (0x0), this object is initialized.
Enterprise If the role is Administrator (0x4), this object is initialized.
RightsTemplatePolicy If the role is Administrator (0x4) or TemplateEditor(0x2), this object is initialized.

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

' *******************************************************************
' 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

' *******************************************************************
' Generate a runtime error.

SUB RaiseError(errId, desc)
  CALL Err.Raise( errId, "", desc )
  CheckError()
END SUB

Requirements

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

See also

ConfigurationManager