#32115 - 2002-11-09 06:22 AM
Enumerate the properties of an AD object?
|
braunsky
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
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#32117 - 2002-11-09 09:07 AM
Re: Enumerate the properties of an AD object?
|
braunsky
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
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]
|
|
Top
|
|
|
|
#32120 - 2002-11-12 06:10 AM
Re: Enumerate the properties of an AD object?
|
braunsky
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 633 anonymous users online.
|
|
|