Page 1 of 1 1
Topic Options
#32115 - 2002-11-09 06:22 AM Enumerate the properties of an AD object?
braunsky Offline
Fresh Scripter

Registered: 2002-11-09
Posts: 6
Loc: San Diego
First off, my name is thaddeus, and I'm a newbie (I'm sure all you 12-step folks are saying 'Hello Thaddeus!') This is one of the best moderated discussion groups I've seen in a long time. Congrats to all the experienced ones out there who give, give, give...

What I was hoping to find out is how can I get a list of modifiable properties for an AD object returned to either an array, a text file, or a database? If I have a user name, I would like to programmatically list out all available proprties for that user so I can then pick what I want to change and then change it. I would also like to do this same process given a known computer name. From some sample scripts, I have been able to change things like login script, description, etc., but I had to manually snatch them from an example script. I want to be more self sufficient and have a list of all properties in front of me...any ideas here?
_________________________
---Thaddeus

Top
#32116 - 2002-11-09 07:25 AM Re: Enumerate the properties of an AD object?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Here's a start: http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=13;t=000139#000003
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32117 - 2002-11-09 09:07 AM Re: Enumerate the properties of an AD object?
braunsky Offline
Fresh Scripter

Registered: 2002-11-09
Posts: 6
Loc: San Diego
Howard,

Thank you...that makes some very long lists, but very useful, too. How would I print the current values for a user or a machine? $property.???

Also, when I change providers from LDAP to WinNT, I get very different output. WinNT output seems extremely abbreviated compared to the EXTENSIVE list LDAP provides. I also notice some fields "missing" when using WinNT (ie - I don't see a surname field when using WinNT). Any thoughts on this? Is it just the provider limitation?

Thanks again for the great help...
_________________________
---Thaddeus

Top
#32118 - 2002-11-09 09:11 AM Re: Enumerate the properties of an AD object?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The number of properties and their names vary between providers.

Download the ADSI help file from Microsoft. It will answer most of your question.
[URL=http://www.microsoft.com/windows2000/techinfo/howitworks/activedirectory/adsilinks.asp]http://www.microsoft.com/windows2000/techinfo/howitworks/activedirectory/adsilinks.asp[/ URL]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32119 - 2002-11-09 04:18 PM Re: Enumerate the properties of an AD object?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
braunsky,
To understand the depths of ADSI, I suggest you purchase a book or two on the topic. There is way too much detail to try and cover in this thread. Unfortunately, the books lack KiX examples so you would need to translate VBScript.

With your question "How would I print" please elaborate. Are you asking how to get the info from the screen to the printer? If so, use file I/O to send the output to a file and then open the file in your favorite editor and print it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#32120 - 2002-11-12 06:10 AM Re: Enumerate the properties of an AD object?
braunsky Offline
Fresh Scripter

Registered: 2002-11-09
Posts: 6
Loc: San Diego
Well, here's what I've got so far. I looked all over the 'Net, and found a ton of stuff on M$oft's site; actually, they had the best stuff once I read through the fluff. Man, what a convoluted mess this AD stuff is. It took a while, but I can now list out the things that can be changed for AD via a Kix script...Whew!!

Here's an example on how I get my list of changeable properties for a single user account...hope this helps out others!!

$A = GetObject("WinNT://thebraunhome.fan/administrator,user")
EnumObjProps($A)

Function EnumObjProps($object)
Dim $Class, $Schema, $Value, $property, $cont

$Class = GetObject($object.schema)
? "Class: " + $Class.Name
? "GUID: " + $Class.GUID
? "Implemented by: " + $Class.CLSID

If $Class.Container
? ? "Container Object"
? "Class Contains:"
For Each $cont In $Class.Containment
? " " + $cont
Next
Else
? ? "Leaf Object"
EndIf

? "Mandatory Properties in this Class: "
For Each $property In $Class.MandatoryProperties
? " " + $property
Next

? ? "Optional Properties in this Class: "
For Each $property In $Class.OptionalProperties
? " " + $property; + " " + $property.item
Next
EndFunction


;Examples:

;$A = GetObject("WinNT://myComputer,computer")
;EnumObjProps($A)

;$A = GetObject("WinNT://myDomain/user1,user")
;EnumObjProps($A)

;$A = GetObject("LDAP://us-tyco-e/CN=BULLOCKHA,OU=test,OU=9826,OU=NCS,OU=Machines,DC=us,DC=tycoelectronics,DC=com")
;EnumObjProps($A)
_________________________
---Thaddeus

Top
#32121 - 2002-11-12 03:01 PM Re: Enumerate the properties of an AD object?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See also Kixforms: Manage User Details - Here`s MUD in your eye !
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.056 seconds in which 0.026 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