AD 2003 Question

Discussion in 'Software' started by Arroryn, Oct 11, 2007.

  1. Arroryn

    Arroryn we're all dooooooomed Moderator

    4,015
    193
    209
    If facsimiletelephonenumber is the LDAP field name for the fax in an AD user, what is the field for the user's alias called? Is it initials?

    (sorry if this sounds blunted... I'm acting as a secretary for our programmer, who can't be bothered to log on and post himself!)
     
    Certifications: A+, N+, MCDST, 70-410, 70-411
    WIP: Modern Languages BA
  2. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    172
    211
    I have code that will list all the Attributes against the user accounts in your Domain:

    Code:
    Set objUserClass = GetObject("LDAP://schema/user")
    Set objSchemaClass = GetObject(objUserClass.Parent)
    
    WScript.Echo "Mandatory attributes:"
    For Each strAttribute in objUserClass.MandatoryProperties
        Set objAttribute = objSchemaClass.GetObject("Property",  strAttribute)
        If objAttribute.MultiValued Then
            WScript.Echo "," & strAttribute & "," & objAttribute.Syntax & ",Multivalued"
        Else
            WScript.Echo "," & strAttribute & "," & objAttribute.Syntax & ",Multivalued"
        End If
    Next
    
    WScript.Echo VbCrLf & "Optional attributes:"
    For Each strAttribute in objUserClass.OptionalProperties
        Set objAttribute = objSchemaClass.GetObject("Property",  strAttribute)
        If objAttribute.MultiValued Then
            WScript.Echo "," & strAttribute & "," & objAttribute.Syntax & ",Multivalued"
        Else
            WScript.Echo "," & strAttribute & "," & objAttribute.Syntax & ",Multivalued"
        End If
    Next
    
    Stick it into a VBS file. Its an old one, so I never put my standard output stuff on it, put run it from the command line ("cscript test.vbs > test.csv") and it will send it into a csv file for you.

    Im not sure what attribute you mean by alias to be honest. If you mean their pre-windows 2000 username then its SAMACCOUNTNAME, if you mean their UPN then its USERPRINCIPALNAME, Displayname is DISPLAYNAME.
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  3. Arroryn

    Arroryn we're all dooooooomed Moderator

    4,015
    193
    209
    Thanks for that Fergal, I will put it to our programmer.

    By Alias, I mean the 'Alias' field in the 'Exchange General' area of a user record.
     
    Certifications: A+, N+, MCDST, 70-410, 70-411
    WIP: Modern Languages BA
  4. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    172
    211
    ah. I believe, offhand, thats mailnickname. Let me check my archives.
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  5. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    172
    211
    yep. mailnickname by the looks of things.
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  6. Arroryn

    Arroryn we're all dooooooomed Moderator

    4,015
    193
    209
    Hi Fergal, we've done a test and mailnickname works perfectly.

    I've also been told that bit of code you gave is ace. Rep given where deserved :D
     
    Certifications: A+, N+, MCDST, 70-410, 70-411
    WIP: Modern Languages BA
  7. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    172
    211
    No problem. I started out with VBScript, working exclusively with AD. It was my baby, and my specialty. Getting less so now, since my new job doesnt have me looking at AD at all (Shame really. I enjoyed it).
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.