+ Post New Thread
Results 1 to 6 of 6
Scripts Thread, User container attributes - Some help pls in Coding and Web Development; I've been cracking away at my script for creating users folders, etc.. and I've opted to make life even harder ...
  1. #1
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    User container attributes - Some help pls

    I've been cracking away at my script for creating users folders, etc.. and I've opted to make life even harder for myself by making the thing create a security group and dump OU members into it as well before sorting out permissions on the shared folder...

    Yeah I know!


    Anyway, one major stumbling block in all of this is that I can't work out what the object references are in the user object.

    The key one that's giving me a major headache is the one under "Logon User name"... I had thought it was sAMAccountName but that is actually the container name... (nearly a day wasted on that!).

    So... any help much appreciated...

  2. #2

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,820
    Thank Post
    110
    Thanked 590 Times in 511 Posts
    Blog Entries
    1
    Rep Power
    226

    Re: User container attributes - Some help pls

    I think it's 'cn'.

  3. #3

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115

    Re: User container attributes - Some help pls

    I think you're overlooking some other problem. sAMAccountName is a text attribute and it is what works in a logon box. The following snippet is JS but this kind of thing definitely should work and it's basically the same calls in VBS:

    UserObj = GetObject("LDAP://cn=fred,cn=Users, ...

    UserAcc = UserObj.Get("sAMAccountName");

  4. #4

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115

    Re: User container attributes - Some help pls

    This works for me. JS again - it happily prints sAMAccountName for the Administrator account.

    Code:
    var oADroot = GetObject("LDAP://RootDSE")
    var oUser   = GetObject("LDAP://CN=Administrator,CN=Users," + oADroot.Get("defaultNamingContext"));
    
    WScript.Echo("User logon: " + oUser.Get("sAMAccountName"));

    And if that's not what you meant, were you looking for the UPN i.e. the userPrincipalName attribute? What are you actually trying to do with whatever you're looking for in a user container?

  5. #5
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: User container attributes - Some help pls

    Had a chance to eat something, watch some CSI and let the brain idle for a bit and it's probably not a biggie..

    The bit of code I was having problems with was referencing the sAMAccountname but that is not the same thing as the container name which is what you need to use in an LDAP reference.

    Normally these are one and the same thing but you can edit the login name and not touch the container name and vice versa.... confused? well I was..

    Anyways... Geoff provided the answer... I needed to reference objectUser.cn and bingo I get the right value... Obvious when you think about it


    The script I'm writing btw, is this one..
    http://www.edugeek.net/index.php?nam...ewtopic&t=6898

    ... just come a little closer to be being done


    Thanks all..

  6. #6

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115

    Re: User container attributes - Some help pls

    Ohhh.. I geddit.. essentially the difference between the account name e.g. "Joe E Bloggs" and whatever you picked for the logon e.g. "jbloggs".

SHARE:
+ Post New Thread

Similar Threads

  1. User areas + User share permissions.
    By Dos_Box in forum Windows
    Replies: 6
    Last Post: 11th September 2007, 12:17 PM
  2. Clear User accounts password attributes on mass.
    By tosca925 in forum How do you do....it?
    Replies: 2
    Last Post: 8th June 2007, 04:15 PM
  3. Exchange Attributes
    By tscnmuk in forum Windows
    Replies: 1
    Last Post: 14th May 2007, 08:20 AM
  4. Replies: 5
    Last Post: 9th May 2007, 06:45 PM
  5. User profiles
    By speckytecky in forum How do you do....it?
    Replies: 3
    Last Post: 16th June 2006, 01:11 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •