Page 1 of 1 1
Topic Options
#85097 - 2002-02-09 05:39 PM Cannot use Filter Function in ADSI - BUG in Kix?
MasterOfDesaster Offline
Fresh Scripter

Registered: 2002-01-23
Posts: 21
Loc: Munich, Germany
Hello,

i try following Code (where "Number5" is my Computername)

code:
  
Dim $Test
Dim $Computer

$AD=GetObject("WinNT://Number5,computer")
$AD.Filter=Array("Service")

for each $s in $AD
? $S.name
next


Normaly this code should only shows the NT-Services of my Computer, but this shows all ADSI information like Users,Groups and Services.

When i try to run this code in WSH i works fine.

I think there is a problem with the "$ad.Filter ".

Has anyone any ideas?

_________________________
Greetings,

Michael

Top
#85098 - 2002-02-09 05:44 PM Re: Cannot use Filter Function in ADSI - BUG in Kix?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Try this:

$AD.Filter = "Service",""

-Shawn

Top
#85099 - 2002-02-09 05:53 PM Re: Cannot use Filter Function in ADSI - BUG in Kix?
MasterOfDesaster Offline
Fresh Scripter

Registered: 2002-01-23
Posts: 21
Loc: Munich, Germany
Great!

this hint works...can you explain me in short words, how this works?

_________________________
Greetings,

Michael

Top
#85100 - 2002-02-09 06:18 PM Re: Cannot use Filter Function in ADSI - BUG in Kix?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Yeah sure,

The filter property needs to see an array, and in kixtart, one way to specify arrays is by saying this:

$array = 1,2,3,4,5

So, you say this:

$domain.filter = "service","user"

or to just specify one class, say this

$domain.filter = "computer",""

we just provide an extra null "" element in the array to get kixtart to pass the property as an array. ADSI sees the second, null elementbut just ignores it.

Did that answer your question ?

-Shawn

Top
#85101 - 2002-02-09 07:37 PM Re: Cannot use Filter Function in ADSI - BUG in Kix?
MasterOfDesaster Offline
Fresh Scripter

Registered: 2002-01-23
Posts: 21
Loc: Munich, Germany
Yes, thanks! You're really a COM specialist.
_________________________
Greetings,

Michael

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
0 registered and 2011 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.054 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