Pre-requisites Before Scripting for Delegation of Roles

Declarations of Global objects

'Defines the client Interface for getting the INamespace Object
'for a given DMSServer, ADServerOrTreeName, User and

'EncryptedPassword. Keeps a cache of these combinations

'Defined In DRADClientlib. It Implements INamespace.

Dim g_objNameSpaceCache As New ADNamespaceCache

'The Base Interface for Handling all Role Operations

Dim g_objNameSpace As INamespace

Get the encrypted password of the user who is connecting to the Domain

'Class which implements methods for encryption/decryption of passwords
'Required to get the Namespace object from the ADNamespaceCache

Dim objCipher As ComCipher

'get comcipher to encrypt the password

Set objCipher = New ComCipher

'This Encryption Key is used for the purpose of encryption/decryption

'This key is always a constant and has to be used wherever encryption/decryption is needed

objCipher.Init "35B37ED0-7564-11d2-8584-0080C87CDC9C"

'Get the encrypted password
Dim strEncryptedPassword As String

strEncryptedPassword = objCipher.EncryptString("password")

Connect to DMS with the credentials

Set g_objNameSpace = g_objNameSpaceCache.Get("Trade", "", "drc_nb\administrator", strEncryptedPassword)