Page 1 of 1 1
Topic Options
#86253 - 2002-06-24 10:35 PM Properties of an object using ADSI.
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
I was fiddling with this and came up with two functions that return arrays: one for the properties associated with an ADSI object, and the other for the values associated with the properties given. Here is the code.

code:
$domain = "domainname"
$ads = GetObject("WinNT://$domain")

Function GetProperties($adsiobject)
$adsiobject.GetInfo
$countprop = VAL($adsiobject.propertycount)-1
If $countprop < 0
Exit 1
ENDIF
DIM $adsiprop[$countprop]
For $i = 0 to $countprop
$adsiprop[$i] = $adsiobject.Next().name
Next
$GetProperties = $adsiprop
EndFunction


Function GetValues($proparray,$adsiobject)
If NOT Vartype($proparray) & 8192
Exit 1
Endif
$ba = UBOUND($proparray)
DIM $propval[$ba]
For $i = 0 to $ba
$prop=$proparray[$i]
$rc = EXECUTE("$$PropVal[$$i]=$$adsiobject.$prop")
If @error
Exit 1
Endif
Next
$GetValues = $propval
EndFunction




$ok = GetProperties($ads)
$bk = GetValues($ok,$ads)
For $i = 0 to UBOUND($ok)
$ok[$i] ?
$bk[$i] ?
Next

Anyone have thoughts on this? Useful? Worthless?

Brian

[ 24 June 2002, 22:39: Message edited by: BrianTX ]

Top
#86254 - 2002-06-24 10:54 PM Re: Properties of an object using ADSI.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Is this a little like http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=13;t=000139 4th post?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#86255 - 2002-06-24 10:59 PM Re: Properties of an object using ADSI.
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
Yeah.. it's similar, although I took a different approach. I'm still fiddling with this stuff, though. I suppose one difference is that your script enumerates optional properties.. I'm not sure mine does.

Brian

[ 24 June 2002, 23:01: Message edited by: BrianTX ]

Top
#86256 - 2002-06-24 11:43 PM Re: Properties of an object using ADSI.
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
I forgot about the adsi object viewer (adsvw.exe) in the Microsoft Platform SDK.. it works pretty well.

Brian

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.055 seconds in which 0.027 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