ADAM LDIF Installer





7
Date Submitted Thu. Jan. 11th, 2007 9:12 AM
Revision 1 of 1
Scripter Casper42
Tags ActiveDirectory | AD | ADAM | vbs
Comments 0 comments
I wrote this script to ease installation of LDIF files into ADAM (Active Directory Application Mode). Some .NET portal vendors choose a hybrid of SQL and ADAM for their applications, ours did just that. When developing portlets, they must be registered in ADAM to be made available to the portal.

In the course or portlet development it was a pain to locate the directory the LDIF file (description file) lived and then to execute the LDIF installer - so I made it easy - a generic LDIF installer script. It uses the common OpenDialog to allow for searching for the file and then installing it once the file is selected - a real time-saver.

I will have more AD type goodies for you soon...(LDIFs are also used for creating or manipulating User and Computer accounts in AD)

'This installer is for a quick import of LDIF Files into ADAM
'Developed by Jeremy Edmiston | Point Loma Nazarene University
'Created 6/30/05 Revised 12/23/06

'Notes:
'   This installer will prompt for an LDIF file, then import
'   the file contents into ADAM.


'Instantiate WSH Script
set wshShell = Wscript.createobject("wscript.shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Check Windows Directory
if objFSO.folderexists("C:\Windows") then
        ADAM= "C:\Windows\ADAM\"
        'Call the first SubRoutine to start Installer
        BrowseWithcommonDialog
elseif objFSO.folderexists("C:\WINNT") then
        ADAM= "C:\WINNT\ADAM\"
        'Call the first SubRoutine to start Installer
        BrowseWithcommonDialog
else
        msgbox "Cannot find ADAM"
end if

'SubRoutines *******************************************************************

Sub BrowseWithCommonDialog()

        Set objDialog = CreateObject("UserAccounts.CommonDialog")
        objDialog.Filter = "LDIF Files|*.ldf"
        objDialog.FilterIndex = 1
        objDialog.InitialDir = "."
        nResult = objDialog.ShowOpen

        If nResult = 0 Then
                MsgBox "Cancel"
        Else
                'msgbox objdialog.filename
                InstallLDF(objDialog.FileName)
        End If

        'For Hardcoded Installer
        'InstallLDF("W2Statements.ldf")
       

End Sub

Sub InstallLDF(LDIF)

        wshShell.run "%COMSPEC% /k " & ADAM & "ldifde.exe  -i -f " & """" & LDIF & """" & " -c ""CN=Schema,CN=Configuration,CN=X"" ""#schemaNamingContext"" -k -s localhost -v"

end sub
 

Jeremy Edmiston

Comments

There are currently no comments for this snippet.

Voting