123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
--------------------------------------------------------------------------------

LDAP / SiteServer Migration

--------------------------------------------------------------------------------

Description : This script will migrate LDAP and SiteServer user list to another LDAP SiteServer

<%
Option Explicit

Call MigrateMembers

Sub MigrateMembers

Dim strSourceLdapPath
Dim strTargetLdapPath
Dim strFontStyle

Dim oLDAP
Dim oADsSourceContainer
Dim oADsTargetContainer
Dim oADsNewUser
Dim oADsOldUser

On Error Resume Next

strFontStyle = "<font face=Tahoma size=1>"

'**********************************************************
' Enter the LDAP Source Members Path To Copy From...
'**********************************************************
' strTargetLdapPath = "LDAP://SourceLDAPMachine:389/dc=mycompany/dc=com"
strSourceLdapPath = "LDAP://Piett:1003/o=SRC/ou=members"

'**********************************************************
' Enter the LDAP Target Members Path To Copy To...
'**********************************************************
' strTargetLdapPath = "LDAP://TargetLDAPMachine:389/dc=mycompany/dc=com"
strTargetLdapPath = "LDAP://Xfernal:389/o=SRC/ou=members"

Set oLDAP = GetObject("LDAP:")
If Err.number <> 0 Then
Response.Write strFontStyle & Err.number & Err.description
End If

'**********************************************************
' This must be set to the Admin Account on the the LDAP Source
'**********************************************************
Set oADsSourceContainer = oLDAP.OpenDSObject(strSourceLdapPath, _<BR>cn=Administrator,ou=Members,o=SRC", "secret", 0)
If Err.number <> 0 Then
Response.Write strFontStyle & Err.number & Err.description
End If

'**********************************************************
' This must be set to the Admin Account on the the LDAP Target
'**********************************************************
Set oADsTargetContainer = oLDAP.OpenDSObject(strTargetLdapPath, _<BR>cn=Administrator,ou=Members,o=SRC", "password", 0)
If Err.number <> 0 Then
Response.Write strFontStyle & Err.number & Err.description
End If

'**********************************************************
' oLDAP is not needed anymore; destroy...
'**********************************************************
Set oLDAP = Nothing

Response.Write "<table border=1>"

For Each oADsOldUser In oADsSourceContainer
If LCase(oADsOldUser.Class) = "member" Then
Set oADsNewUser = oADsTargetContainer.Create("member", "cn=" & oADsOldUser.cn)

'***** You must at least migrate the GUID *****
oADsNewUser.Put "GUID", oADsOldUser.Guid
oADsNewUser.Put "givenName", oADsOldUser.givenName
oADsNewUser.Put "sn", oADsOldUser.sn
oADsNewUser.Put "userPassword", oADsOldUser.userPassword
oADsNewUser.Put "mail", oADsOldUser.mail

'***** You must at least migrate the GUID *****
' Add more variables if neccessary


'**********************************************************
' .SetInfo "sets" all the items we have "put" in the cache.
'**********************************************************
oADsNewUser.SetInfo

Response.Write "<tr><td>"

'This error description is: "Cannot create a file when that file already exists"
If Err.number = -2147024713 Then
Response.Write strFontStyle & "Member Already Exists."
End If

If Err.number <> 0 Then
Response.Write strFontStyle & Err.number & Err.description
End If

Response.Write strFontStyle & oADsOldUser.cn & vbCrLf
Response.Write "</td></tr>"

Set oADsNewUser = Nothing
End If
Next

Response.Write "</table>"

Set oADsSourceContainer = Nothing
Set oADsTargetContainer = Nothing
Set oADsOldUser = Nothing

Response.Write "Members Migrated..."
End Sub

%>
--------------------------------------------------------------------------------
 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG