Page 1 of 1 1
Topic Options
#61421 - 2001-12-18 01:52 AM Shawn - Ou function
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
Shawn,
As i rebuild my test server, I've ran your Ou function, and it's not working as is.
In fact, The method you use is working when using WinNT:// (with some little tweaks), but not for LDAP:// (better for 9x support)
LDAP use a different name context
I'm looking on it, but for now i need to sleep

On the other hand, i'm finishing the little gift package

_________________________
? getobject(Kixtart.org.Signature)

Top
#61422 - 2001-12-18 03:17 PM Re: Shawn - Ou function
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Alex,

So what happens when you run this script ?


break on


$sysinfo = createobject("adsysteminfo")
if $sysinfo
?"username=" $sysinfo.username
else
?"trouble"
endif
exit 1

-Shawn

Top
#61423 - 2001-12-18 09:05 PM Re: Shawn - Ou function
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
you know what ? :
username=CN=Administrator,CN=Users,DC=Reseau,DC=Popov,DC=org
(tested on w2k syst)

Ok, after changing the admin location (and logoff/logon needed), here's the JACKPOT!!!!!
username=CN=Administrator,OU=Permanent Users,OU=Local,DC=Reseau,DC=Popov,DC=org

I let you finish this one

for information, the current AD tree is :

code:

Reseau.Popov.org
|
|--Local (OU)
| |
| '---Permanent Users (OU)
| |
| '---Temporary Users (OU)
|
'--all the stuff, as Users directory

Oh, I've changed my profile, as i'm doing some cleaning and get rid of this old nickname (but i don't want to reinstall 2k server )

[ 18 December 2001: Message edited by: Alex.H ]

_________________________
? getobject(Kixtart.org.Signature)

Top
#61424 - 2001-12-18 09:42 PM Re: Shawn - Ou function
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Brian Styles (ScriptLogic) did an excellent job of writing an OU parser using adsysteminfo and username. I think all that remains is to roll this stuff up into nice little InOU() and EnumOU() functions.

Would/should one combine user and computer OU enumeration into a single function or break them out into seperate functions - hmmm ?

Check-out Brians' post here

-Shawn

Top
#61425 - 2001-12-18 10:01 PM Re: Shawn - Ou function
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
Well, depends
We could add an optional $IsComputerName
by default, it's always equal to 0
If different, you got the point.

nah, damn smileys

Something else:
I can't get anything from this :
$root=Getobject("LDAP://CN="+"$Variable"+","+GetObject("LDAP://rootDSE").Get("defaultNamingContext"))
always return in @serror : "There is no such object on the server.", whatever i put in $variable (existing or not user, complete name or partial)
weird!
I'm looking in this way as i don't know if AdSystemInfo is 9x compatable (currently looking for)

[ 18 December 2001: Message edited by: Alex.H ]

_________________________
? getobject(Kixtart.org.Signature)

Top
#61426 - 2001-12-18 10:26 PM Re: Shawn - Ou function
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
AdSystemInfo - if it on your 9x box (which I suspect it isnt) would be located here in the registry:

HKEY_CLASSES_ROOT\ADSystemInfo

wintendo needs to have the ADSI runtimes for Win9x installed before you can do any of this AD magic (free from MS) ...

If memory serves, when I did try to install the ADSI runtimes for NT - the ADSystemInfo object still didn't get installed properly (everything else did) ... so just a heads-up on that.

ADSystemInfo was a tough nut to crack. For some reason, it isn't documented in the ADSI SDK and I remember having to do alot of web searching and forum hunting to find it (for use in our original InOU() functions posted in the beta forum) ... I think it might be a little like the ADSecurity.dll that ships as part of the ADSI reskit - included in Windows 2K but requires special handling for NT and 9x ... not sure on that - things might have changed since then.

-Shawn

Top
#61427 - 2001-12-18 10:45 PM Re: Shawn - Ou function
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
I search a little and found it, but in fact it's comming from Exchange Server (version with LDAP support). And yes, it's always hidden is some dark area.

I've found this in the 9x file :
nwapi32.dll, ntdsapi.dll
Seems the NT only NW:// and NTDS:// are also available under 9x
And after looking in BDR, HKClassRoot\AdSystemInfo is bind to this file : adsldp.dll
and yes, it's available in the 9x client part

I'm finishing something and i'll reboot to 98 to play with the AD client,

[ 18 December 2001: Message edited by: Alex.H ]

_________________________
? getobject(Kixtart.org.Signature)

Top
#61428 - 2001-12-19 12:58 AM Re: Shawn - Ou function
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
Finished playing
sometimes, i want to take a gun with "Dedicated to Micro$oft" written on it
as you guess, it's NOT WORKING for 9x system
If you have the method for NT4 system, i'll take it, as createobject("adsysteminfo") is working, but no more
the problem is to retreive returned object properties, as username return ""

Edit
Shawn, nothing to do with the current thread, but you should get a look here http://winservices.web.cern.ch/winservices/docs/ActiveDirectory/
/edit

[ 19 December 2001: Message edited by: Alex.H ]

_________________________
? getobject(Kixtart.org.Signature)

Top
#61429 - 2001-12-19 08:05 AM Re: Shawn - Ou function
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Alex,

There have been conversions from VBscript and this may just get you going in the right direction. Check out the Sub AddMailBox section.

Have fun!

- Kent

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1160 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.134 seconds in which 0.102 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org