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 ...
-
13th June 2007, 05:25 PM #1 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...
-
-
IDG Tech News
-
13th June 2007, 05:40 PM #2 Re: User container attributes - Some help pls
-
-
13th June 2007, 06:51 PM #3 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");
-
-
13th June 2007, 07:04 PM #4 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?
-
-
13th June 2007, 07:57 PM #5 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..
-
-
13th June 2007, 09:33 PM #6 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:
Similar Threads
-
By Dos_Box in forum Windows
Replies: 6
Last Post: 11th September 2007, 11:17 AM
-
By tosca925 in forum How do you do....it?
Replies: 2
Last Post: 8th June 2007, 03:15 PM
-
By tscnmuk in forum Windows
Replies: 1
Last Post: 14th May 2007, 07:20 AM
-
Replies: 5
Last Post: 9th May 2007, 05:45 PM
-
By speckytecky in forum How do you do....it?
Replies: 3
Last Post: 16th June 2006, 12: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
-
Forum Rules