Back to User management: Other
DESCRIPTION
Starting version 6.0, the ActiveRoles Server began support of Exchange 2007 for user mailbox creation, moving, deletion. For other Exchange tasks (establish email address for user, contact, or group) the ARS still rely on Recipient Update Service (RUS) of earlier version of Exchange.
Thus, if you don't have earlier version of Exchange (2000 or 2003) installed in your environment, or if you don't have RUS enabled on Exchange, you can't establish e-mail addresses for user, contacts, groups.
This script sample demonstrates a workarround.
Note This code may use functions from the ARS Script Policy Best Practices. Please, follow the link to obtain instructions and code for those functions.
SCRIPT
'*********************************************************************************
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
' WARRANTIES OF MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
' PLEASE CONTACT QUEST PROFESSIONAL SERVICES.
'*********************************************************************************
'
' This code is published on the ActiveRoles Script Center:
' http://communities.quest.com/docs/DOC-9991
'
' This code may use functions from the ARS Script Policy Best Practices:
' http://communities.quest.com/docs/DOC-10016
'
' Please, follow the link to obtain instructions and code for those functions.
'*********************************************************************************
Option Explicit
'***********************************************************************************
'** CUSTOMIZABLE SETTINGS.
'** Change the following 2 settings to values applicable to your environment
'***********************************************************************************
'-- Domain DNS name is used to constuct SMTP addresses
Const strDNSName = "foo-company.com"
'-- Distinguished name of Exchange Default Global Address List
Const strDefaultGALDN = "CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=foo-company,DC=com"
'***********************************************************************************
'** SUBROUTINES
'***********************************************************************************
Function GetAttribute(ByRef Request, ByVal strName)
Dim Value
On Error Resume Next
Value = Request.Get(strName)
On Error GoTo 0
GetAttribute = Value
End Function
Function Execute(ByRef Request)
'-- Optimization: procceed for specific classes only
If ((LCase(Request.Class) <> "user") And _
(LCase(Request.Class) <> "contact") And _
(LCase(Request.Class) <> "inetorgperson") And _
(LCase(Request.Class) <> "group")) Then Exit Function
'-- Optimization: procceed for specific Exchange tasks only
If ((CBool(GetAttribute(Request, "edsaEstablishEmail")) <> True) And _
(CBool(GetAttribute(Request, "edsaEstablishGroupEmail")) <> True)) Then Exit Function
'-- Get necessary attribute values
DirObj.GetInfoEx Array("displayName", "mailnickName", "targetAddress"), 0
Dim strAlias, strMail
'-- Get alias, constuct e-mail address
strAlias = GetAttribute(DirObj, "mailnickName")
strMail = strAlias & "@" & strDNSName
'-- Fill display name if it is empty
If (IsEmpty(GetAttribute(Request, "displayName"))) Then
DirObj.Put "displayName", strAlias
End If
'-- Add proceed object to default GAL
DirObj.Put "showInAddressBook", strDefaultGALDN
'-- Fill another attributes
Select Case (LCase(Request.Class))
Case "user", "contact", "inetorgperson"
DirObj.PutEx ADS_PROPERTY_APPEND, "proxyAddresses", Array(GetAttribute (DirObj, "targetAddress"), "smtp:" & strMail)
DirObj.Put "mail", GetAttribute(DirObj, "targetAddress")
Case "group"
DirObj.PutEx ADS_PROPERTY_APPEND, "proxyAddresses", "SMTP:" & strMail
DirObj.Put "mail", strMail
End Select
'-- Apply changes
DirObj.SetInfo
End Function
'***********************************************************************************
'** EVENT HANDLERS
'***********************************************************************************
Sub onPostCreate(Request)
Execute(Request)
End Sub
Sub onPostModify(Request)
Execute(Request)
End Sub
'****************** END OF CODE ****************************************************
'***** END OF CODE ***************************************************************
COMPATIBILITY
Script compatible with the following version(s): <Not specified>