none
Outlook 2003 automatic profile config - query AD CN name RRS feed

  • Question

  • Hello, first of all I would like to apologise if this is in the wrong section.

     

    I use an outlook automatic configuration script to configure 2003 mail profiles on my organisations Domain, and the script work well. We recently created a forest trust with a separate organisation but when logging onto a machine in the trusted forest the script fails. I’ve been able to work out where it’s failing, but can’t piece together the code to resolve the problem.

     

    Part of the script checks that the user is mailbox enabled and it’s this bit that fails. If I substitute the line in the code below starting “Set objUser” with  “LDAP://cn=test user,OU=Test Users,dc=mydomain,dc=com"  it works. Therefore I’m wondering if there’s a way to query AD for the users CN name?

     

    '***********************************************

    ' This Section Adapted from:

    ' HasMailbox.vbs

    ' (c) 2003 Computech

    ' Written by Peter Verijke

    '***********************************************

     

     

    If ArgObj.Count < 1 Then

       Set objEnv = WshShell.Environment("PROCESS")

     

       sUserName = objEnv("USERNAME")

       sLogonServer = objEnv("LOGONSERVER")

    else

       sUserName = UCase(ArgObj(0))

    End If

     

    DCServer = RmChr(sLogonServer, "\")

    sUserLDAPName = QueryActiveDirectory(sUserName)

     

    Set objUser = GetObject("LDAP://" & DCServer + "/" & sUserLDAPName)

     

    Set objMailbox = objUser

    'check if user is mailbox enabled

    If objMailbox.HomeMDB = "" Then

       wscript.echo "No Mailbox - Quitting"

       WScript.Quit 1

    Else

       wscript.echo "Has Mailbox"

    End If

     

     

    Any help appreciated.

     

    Thanks,

     

    Paul.

    • Moved by Mike Feng Tuesday, August 16, 2011 5:51 AM VBS (From:Visual Basic General)
    Friday, August 12, 2011 2:25 PM

All replies