DESCRIPTION
Corporate policy may demand all newly created user should be located in special OU This script demonstrates how to arrive to it.
Note: ARS 6.0.4 is required. Check "wait while post-event handlers complete operation" checkbox on policy entry UI.
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.
'**************************************************************************
Option Explicit
'-- distinguished name of special OU
Const strAnotherOUDN = "OU=Special,DC=foo,DC=com"
'**************************************************************************
' EVENT HANDLERS
'**************************************************************************
Sub onPreCreate(Request)
'-- trigers for user object only ----------------
If (LCase(Request.Class) <> "user") Then Exit Sub
Dim strCN, strNewDN
'-- get cn --------------------------------------
strCN = Request.Get("cn")
'-- construct new dn for user object ------------
strNewDN = "CN=" & strCN & "," & strAnotherOUDN
Call Request.PutEx(ADS_PROPERTY_UPDATE, "distinguishedName", strNewDN)
'-- inform Web Interface that dn is changed
Call Request.PutOutControl(EDS_CONTROL_OBJECT_DN, 3, strNewDN)
End Sub ' onPreCreate
'***** END OF CODE ********************************************************