Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Tue, 26 Apr 2005 21:35:54 -0400,    group: microsoft.public.platformsdk.active.directory        back       


ADSI WinNT Provider and XP   
New to ADSI, I've been working on users and groups on my home machines and
have been having trouble enumerating users within a group - membership that
is.  These are all local accounts (of course - at home) and I have therefor
focused on attempting this with the WinNT provider.  It is relatively
trivial to enumerate users and groups for a given system, but I have been
unsuccessful in the enumeration of group memberships. Does anyone know if
this is inhibited in XP Home Edition ?  For all the digging I have done, I
do not see this possibility discussed anywhere on the MS sites.  If anyone
has done this for this OS, please elaborate on how you get from an existing
group directory entry object to the member user references.... in your
preferred language... C, Basic, Script, etc.. I have tried various methods
of authentication in the bind to the group object and various methods of
trying to retrieve a collection of user references (be it object references
or properties)... all in vein.  So, tips would be great.

-J
date: Tue, 26 Apr 2005 21:35:54 -0400   author:   Joe User JoeUser@somewhere

Re: ADSI WinNT Provider and XP   
"Joe User" <JoeUser@somewhere> wrote in message 
news:eVVySmsSFHA.2520@TK2MSFTNGP09.phx.gbl...
> New to ADSI, I've been working on users and groups on my home machines and
> have been having trouble enumerating users within a group - membership 
> that
> is.  These are all local accounts (of course - at home) and I have 
> therefor
> focused on attempting this with the WinNT provider.  It is relatively
> trivial to enumerate users and groups for a given system, but I have been
> unsuccessful in the enumeration of group memberships. Does anyone know if
> this is inhibited in XP Home Edition ?  For all the digging I have done, I


if you leave out DOMAIN then you should use your local XP computer name

Sub main()
    Dim iadsO As iads
    Dim iadsG As IADsGroup
    Dim iadsC As IADsContainer

    Set iadsG = GetObject("WinNT://DOMAIN/Administrators")
    Dim c As Long

    For Each iadsO In iadsG.Members
        Debug.Print iadsO.Name
    Next
End Sub


> do not see this possibility discussed anywhere on the MS sites.  If anyone
> has done this for this OS, please elaborate on how you get from an 
> existing
> group directory entry object to the member user references.... in your
> preferred language... C, Basic, Script, etc.. I have tried various methods
> of authentication in the bind to the group object and various methods of
> trying to retrieve a collection of user references (be it object 
> references
> or properties)... all in vein.  So, tips would be great.
>
> -J
>
>
date: Wed, 27 Apr 2005 09:10:09 +0200   author:   Egbert Nierop \(MVP for IIS\) lid

Re: ADSI WinNT Provider and XP   
Thanks for the reply - I am guessing that you are still using VB6 - pre
dotNet and did believe it should be that simple before.  I assume you've
tried the code you've forwarded - and will look to get at it again tonight.
I am running from .Net and have found that I have been unable to get it to
acknowledge the '.Name' method for that object - no matter how I've tried to
get at it.  One possible problem, might be that I am using the full path of
the top level group object to rebind to that group in an attempt to retrieve
the names of its members - and the resulting group path includes both the
domain and the computer - though it was read by binding to the WinNT
provider in just the manor you suggest.  All additional comments welcome -

 - J

"Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
message news:uBmnqnvSFHA.3176@TK2MSFTNGP09.phx.gbl...
> "Joe User" <JoeUser@somewhere> wrote in message
> news:eVVySmsSFHA.2520@TK2MSFTNGP09.phx.gbl...
> > New to ADSI, I've been working on users and groups on my home machines
and
> > have been having trouble enumerating users within a group - membership
> > that
> > is.  These are all local accounts (of course - at home) and I have
> > therefor
> > focused on attempting this with the WinNT provider.  It is relatively
> > trivial to enumerate users and groups for a given system, but I have
been
> > unsuccessful in the enumeration of group memberships. Does anyone know
if
> > this is inhibited in XP Home Edition ?  For all the digging I have done,
I
>
>
> if you leave out DOMAIN then you should use your local XP computer name
>
> Sub main()
>     Dim iadsO As iads
>     Dim iadsG As IADsGroup
>     Dim iadsC As IADsContainer
>
>     Set iadsG = GetObject("WinNT://DOMAIN/Administrators")
>     Dim c As Long
>
>     For Each iadsO In iadsG.Members
>         Debug.Print iadsO.Name
>     Next
> End Sub
>
>
> > do not see this possibility discussed anywhere on the MS sites.  If
anyone
> > has done this for this OS, please elaborate on how you get from an
> > existing
> > group directory entry object to the member user references.... in your
> > preferred language... C, Basic, Script, etc.. I have tried various
methods
> > of authentication in the bind to the group object and various methods of
> > trying to retrieve a collection of user references (be it object
> > references
> > or properties)... all in vein.  So, tips would be great.
> >
> > -J
> >
> >
>
date: Wed, 27 Apr 2005 07:16:43 -0400   author:   Joe User JoeUser@somewhere

Re: ADSI WinNT Provider and XP   
"Joe User" <JoeUser@somewhere> wrote in message 
news:OhD53qxSFHA.580@TK2MSFTNGP15.phx.gbl...
> Thanks for the reply - I am guessing that you are still using VB6 - pre
> dotNet and did believe it should be that simple before.  I assume you've
> tried the code you've forwarded - and will look to get at it again 
> tonight.
> I am running from .Net and have found that I have been unable to get it to
> acknowledge the '.Name' method for that object - no matter how I've tried 
> to


Hi,

You did not say you wanted DotNet. Why not say it?
anyway, I found a sample in the MSDN which mentions how to do it...

[STAThread]

static void Main(string[] args)

{


DirectoryEntry ent = new 
DirectoryEntry("WinNT://yourPCorDOMAIN/Administrators");

object members = ent.Invoke("Members",null);


foreach (object ent2 in (IEnumerable) members)

{

DirectoryEntry ent3 = new DirectoryEntry(ent2);

Console.WriteLine(ent3.Name);

}





}


-- 
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm



> get at it.  One possible problem, might be that I am using the full path 
> of
> the top level group object to rebind to that group in an attempt to 
> retrieve
> the names of its members - and the resulting group path includes both the
> domain and the computer - though it was read by binding to the WinNT
> provider in just the manor you suggest.  All additional comments welcome -
>
> - J
>
> "Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
> message news:uBmnqnvSFHA.3176@TK2MSFTNGP09.phx.gbl...
>> "Joe User" <JoeUser@somewhere> wrote in message
>> news:eVVySmsSFHA.2520@TK2MSFTNGP09.phx.gbl...
>> > New to ADSI, I've been working on users and groups on my home machines
> and
>> > have been having trouble enumerating users within a group - membership
>> > that
>> > is.  These are all local accounts (of course - at home) and I have
>> > therefor
>> > focused on attempting this with the WinNT provider.  It is relatively
>> > trivial to enumerate users and groups for a given system, but I have
> been
>> > unsuccessful in the enumeration of group memberships. Does anyone know
> if
>> > this is inhibited in XP Home Edition ?  For all the digging I have 
>> > done,
> I
>>
>>
>> if you leave out DOMAIN then you should use your local XP computer name
>>
>> Sub main()
>>     Dim iadsO As iads
>>     Dim iadsG As IADsGroup
>>     Dim iadsC As IADsContainer
>>
>>     Set iadsG = GetObject("WinNT://DOMAIN/Administrators")
>>     Dim c As Long
>>
>>     For Each iadsO In iadsG.Members
>>         Debug.Print iadsO.Name
>>     Next
>> End Sub
>>
>>
>> > do not see this possibility discussed anywhere on the MS sites.  If
> anyone
>> > has done this for this OS, please elaborate on how you get from an
>> > existing
>> > group directory entry object to the member user references.... in your
>> > preferred language... C, Basic, Script, etc.. I have tried various
> methods
>> > of authentication in the bind to the group object and various methods 
>> > of
>> > trying to retrieve a collection of user references (be it object
>> > references
>> > or properties)... all in vein.  So, tips would be great.
>> >
>> > -J
>> >
>> >
>>
>
>
date: Wed, 27 Apr 2005 14:35:17 +0200   author:   Egbert Nierop \(MVP for IIS\) lid

Re: ADSI WinNT Provider and XP   
well - I took your code snippet and tested it out - and the invoke just
throws an exception.  I experimented with mods to it as well - all with an
equal lack of luck.  Thanks anyways.
- J

"Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
message news:e6OxTWySFHA.3344@TK2MSFTNGP12.phx.gbl...
> "Joe User" <JoeUser@somewhere> wrote in message
> news:OhD53qxSFHA.580@TK2MSFTNGP15.phx.gbl...
> > Thanks for the reply - I am guessing that you are still using VB6 - pre
> > dotNet and did believe it should be that simple before.  I assume you've
> > tried the code you've forwarded - and will look to get at it again
> > tonight.
> > I am running from .Net and have found that I have been unable to get it
to
> > acknowledge the '.Name' method for that object - no matter how I've
tried
> > to
>
>
> Hi,
>
> You did not say you wanted DotNet. Why not say it?
> anyway, I found a sample in the MSDN which mentions how to do it...
>
> [STAThread]
>
> static void Main(string[] args)
>
> {
>
>
> DirectoryEntry ent = new
> DirectoryEntry("WinNT://yourPCorDOMAIN/Administrators");
>
> object members = ent.Invoke("Members",null);
>
>
> foreach (object ent2 in (IEnumerable) members)
>
> {
>
> DirectoryEntry ent3 = new DirectoryEntry(ent2);
>
> Console.WriteLine(ent3.Name);
>
> }
>
>
>
>
>
> }
>
>
> -- 
> compatible web farm Session replacement for Asp and Asp.Net
> http://www.nieropwebconsult.nl/asp_session_manager.htm
>
>
>
> > get at it.  One possible problem, might be that I am using the full path
> > of
> > the top level group object to rebind to that group in an attempt to
> > retrieve
> > the names of its members - and the resulting group path includes both
the
> > domain and the computer - though it was read by binding to the WinNT
> > provider in just the manor you suggest.  All additional comments
welcome -
> >
> > - J
> >
> > "Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
> > message news:uBmnqnvSFHA.3176@TK2MSFTNGP09.phx.gbl...
> >> "Joe User" <JoeUser@somewhere> wrote in message
> >> news:eVVySmsSFHA.2520@TK2MSFTNGP09.phx.gbl...
> >> > New to ADSI, I've been working on users and groups on my home
machines
> > and
> >> > have been having trouble enumerating users within a group -
membership
> >> > that
> >> > is.  These are all local accounts (of course - at home) and I have
> >> > therefor
> >> > focused on attempting this with the WinNT provider.  It is relatively
> >> > trivial to enumerate users and groups for a given system, but I have
> > been
> >> > unsuccessful in the enumeration of group memberships. Does anyone
know
> > if
> >> > this is inhibited in XP Home Edition ?  For all the digging I have
> >> > done,
> > I
> >>
> >>
> >> if you leave out DOMAIN then you should use your local XP computer name
> >>
> >> Sub main()
> >>     Dim iadsO As iads
> >>     Dim iadsG As IADsGroup
> >>     Dim iadsC As IADsContainer
> >>
> >>     Set iadsG = GetObject("WinNT://DOMAIN/Administrators")
> >>     Dim c As Long
> >>
> >>     For Each iadsO In iadsG.Members
> >>         Debug.Print iadsO.Name
> >>     Next
> >> End Sub
> >>
> >>
> >> > do not see this possibility discussed anywhere on the MS sites.  If
> > anyone
> >> > has done this for this OS, please elaborate on how you get from an
> >> > existing
> >> > group directory entry object to the member user references.... in
your
> >> > preferred language... C, Basic, Script, etc.. I have tried various
> > methods
> >> > of authentication in the bind to the group object and various methods
> >> > of
> >> > trying to retrieve a collection of user references (be it object
> >> > references
> >> > or properties)... all in vein.  So, tips would be great.
> >> >
> >> > -J
> >> >
> >> >
> >>
> >
> >
>
date: Wed, 27 Apr 2005 22:50:34 -0400   author:   Joe User JoeUser@somewhere

Re: ADSI WinNT Provider and XP   
"Joe User" <JoeUser@somewhere> wrote in message 
news:u%23Qes05SFHA.2432@TK2MSFTNGP12.phx.gbl...
> well - I took your code snippet and tested it out - and the invoke just
> throws an exception.  I experimented with mods to it as well - all with an
> equal lack of luck.  Thanks anyways.
> - J

So what does the exception say?


> "Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
date: Thu, 28 Apr 2005 09:58:54 +0200   author:   Egbert Nierop \(MVP for IIS\) lid

Re: ADSI WinNT Provider and XP   
"Joe User" <JoeUser@somewhere> wrote in message 
news:u%23Qes05SFHA.2432@TK2MSFTNGP12.phx.gbl...
> well - I took your code snippet and tested it out - and the invoke just
> throws an exception.  I experimented with mods to it as well - all with an
> equal lack of luck.  Thanks anyways.
> - J

Try this...
And give us the error message you get. If it does not work, you probably do 
not run XP Professional or your configuration is not correct.
DirectoryEntry ent = new DirectoryEntry("WinNT://./Administrators");

object members = ent.Invoke("Members",null);


foreach (object ent2 in (IEnumerable) members)

{

DirectoryEntry ent3 = new DirectoryEntry(ent2);

Console.WriteLine(ent3.Name);

}
date: Thu, 28 Apr 2005 10:31:15 +0200   author:   Egbert Nierop \(MVP for IIS\) lid

Re: ADSI WinNT Provider and XP   
--------- excerpt from original post ---------
unsuccessful in the enumeration of group memberships. Does anyone know if
this is inhibited in XP Home Edition ?  For all the digging I have done, I
--------- end excerpt ------------
   -- as I said, thanks
-J
"Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
message news:Osbkmy8SFHA.2096@TK2MSFTNGP14.phx.gbl...
> "Joe User" <JoeUser@somewhere> wrote in message
> news:u%23Qes05SFHA.2432@TK2MSFTNGP12.phx.gbl...
> > well - I took your code snippet and tested it out - and the invoke just
> > throws an exception.  I experimented with mods to it as well - all with
an
> > equal lack of luck.  Thanks anyways.
> > - J
>
> Try this...
> And give us the error message you get. If it does not work, you probably
do
> not run XP Professional or your configuration is not correct.
> DirectoryEntry ent = new DirectoryEntry("WinNT://./Administrators");
>
> object members = ent.Invoke("Members",null);
>
>
> foreach (object ent2 in (IEnumerable) members)
>
> {
>
> DirectoryEntry ent3 = new DirectoryEntry(ent2);
>
> Console.WriteLine(ent3.Name);
>
> }
>
date: Thu, 28 Apr 2005 17:45:41 -0400   author:   Joe User JoeUser@somewhere

Re: ADSI WinNT Provider and XP   
Hi,

I have succesfully tested the code mentioned this on XP home. Sorry I was 
thinking that because of the simplified security model this would not work.
There are several ways to test your system.
go to www.sysinternals.com and install filemon and tokenmon they should be 
able to report DLL or other runtime failures.

Note that there is a dependency on system32\activeds.dll I've heard 
sometimes this had to be reregistered (using regsvr32).
Also check if your virustool (if any) denies such program.


-- 
"Joe User" <JoeUser@somewhere> wrote in message 
news:%23UCZAvDTFHA.612@TK2MSFTNGP12.phx.gbl...
> --------- excerpt from original post ---------
> unsuccessful in the enumeration of group memberships. Does anyone know if
> this is inhibited in XP Home Edition ?  For all the digging I have done, I

Sorry did not see this.

> --------- end excerpt ------------
>   -- as I said, thanks
> -J
> "Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
> message news:Osbkmy8SFHA.2096@TK2MSFTNGP14.phx.gbl...
>> "Joe User" <JoeUser@somewhere> wrote in message
>> news:u%23Qes05SFHA.2432@TK2MSFTNGP12.phx.gbl...
>> > well - I took your code snippet and tested it out - and the invoke just
>> > throws an exception.  I experimented with mods to it as well - all with
> an
>
date: Fri, 29 Apr 2005 00:50:31 +0200   author:   Egbert Nierop \(MVP for IIS\) lid

Re: ADSI WinNT Provider and XP   
Excellent news -  now I know that I wasn't just wasting my time.  I posted
to the group only after attempting to look for references differentiating
the ADSI models between the two versions of XP on msdn myself - and didn't
find any.  So, until now, all I had to go on was what the debugger was
telling me.  If you were able to do it with the native call - I should be
able to find a way.  That helps more than you know.  Have a great weekend.

-J

"Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
message news:eDFHxSETFHA.2256@tk2msftngp13.phx.gbl...
> Hi,
>
> I have succesfully tested the code mentioned this on XP home. Sorry I was
> thinking that because of the simplified security model this would not
work.
> There are several ways to test your system.
> go to www.sysinternals.com and install filemon and tokenmon they should be
> able to report DLL or other runtime failures.
>
> Note that there is a dependency on system32\activeds.dll I've heard
> sometimes this had to be reregistered (using regsvr32).
> Also check if your virustool (if any) denies such program.
>
>
> -- 
> "Joe User" <JoeUser@somewhere> wrote in message
> news:%23UCZAvDTFHA.612@TK2MSFTNGP12.phx.gbl...
> > --------- excerpt from original post ---------
> > unsuccessful in the enumeration of group memberships. Does anyone know
if
> > this is inhibited in XP Home Edition ?  For all the digging I have done,
I
>
> Sorry did not see this.
>
> > --------- end excerpt ------------
> >   -- as I said, thanks
> > -J
> > "Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
> > message news:Osbkmy8SFHA.2096@TK2MSFTNGP14.phx.gbl...
> >> "Joe User" <JoeUser@somewhere> wrote in message
> >> news:u%23Qes05SFHA.2432@TK2MSFTNGP12.phx.gbl...
> >> > well - I took your code snippet and tested it out - and the invoke
just
> >> > throws an exception.  I experimented with mods to it as well - all
with
> > an
> >
>
date: Fri, 29 Apr 2005 19:59:24 -0400   author:   Joe User JoeUser@somewhere

Re: ADSI WinNT Provider and XP   
"Joe User" <JoeUser@somewhere> wrote in message 
news:Op2qXeRTFHA.4056@TK2MSFTNGP15.phx.gbl...
> Excellent news -  now I know that I wasn't just wasting my time.  I posted
> to the group only after attempting to look for references differentiating
> the ADSI models between the two versions of XP on msdn myself - and didn't
> find any.  So, until now, all I had to go on was what the debugger was
> telling me.  If you were able to do it with the native call - I should be
> able to find a way.  That helps more than you know.  Have a great weekend.

I have given you even 2 ways that -worked- using VB6 (using native ADSI 
code) and a managed sample.
If you mean that you are going to use the ADVAPI32 library, have my 
blessings, but that won't work either. You computer seems mall functioning.
As I suggested, you should install filemon and tokenmon from 
www.sysinternals.com to see what can be fixed about your system.
date: Sat, 30 Apr 2005 08:50:09 +0200   author:   Egbert Nierop \(MVP for IIS\) lid

Re: ADSI WinNT Provider and XP   
actually, revisiting the code, all I had to do was catch the exception and
read its inner exception thrown (which is masked by the managed code) and
then it all became clear.  I hadn't worked with Native calls from .Net
before... and so this was yet another learning experience.  I have it
listing users now for any group I choose and learned a little in the
process.  So - all set - thanks once again.

-J

"Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
message news:eMDKaDVTFHA.2172@tk2msftngp13.phx.gbl...
> "Joe User" <JoeUser@somewhere> wrote in message
> news:Op2qXeRTFHA.4056@TK2MSFTNGP15.phx.gbl...
> > Excellent news -  now I know that I wasn't just wasting my time.  I
posted
> > to the group only after attempting to look for references
differentiating
> > the ADSI models between the two versions of XP on msdn myself - and
didn't
> > find any.  So, until now, all I had to go on was what the debugger was
> > telling me.  If you were able to do it with the native call - I should
be
> > able to find a way.  That helps more than you know.  Have a great
weekend.
>
> I have given you even 2 ways that -worked- using VB6 (using native ADSI
> code) and a managed sample.
> If you mean that you are going to use the ADVAPI32 library, have my
> blessings, but that won't work either. You computer seems mall
functioning.
> As I suggested, you should install filemon and tokenmon from
> www.sysinternals.com to see what can be fixed about your system.
>
date: Sat, 30 Apr 2005 10:32:55 -0400   author:   Joe User JoeUser@somewhere

Re: ADSI WinNT Provider and XP   
-- since I think you're going to read this -- from the past discussion -
the whole reason I had to post in the first place was that the children
property to the .Net System.DirectoryEntry object would get an exception
when trying to read the group members - and it was interesting that you
immediately reverted to a Native invocation of the ADSI object's members
method instead of using the former.  Now I know this isn't really the group
to address the .Net issue (which this turns out to be), but maybe you have a
comment on that (the .children property and why it might fail when used
against the same .Net System.DirectoryEntry object as the working native
call) as well - feel free.

 - J

"Joe User" <JoeUser@somewhere> wrote in message
news:O680WGZTFHA.2676@TK2MSFTNGP10.phx.gbl...
> actually, revisiting the code, all I had to do was catch the exception and
> read its inner exception thrown (which is masked by the managed code) and
> then it all became clear.  I hadn't worked with Native calls from .Net
> before... and so this was yet another learning experience.  I have it
> listing users now for any group I choose and learned a little in the
> process.  So - all set - thanks once again.
>
> -J
>
> "Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
> message news:eMDKaDVTFHA.2172@tk2msftngp13.phx.gbl...
> > "Joe User" <JoeUser@somewhere> wrote in message
> > news:Op2qXeRTFHA.4056@TK2MSFTNGP15.phx.gbl...
> > > Excellent news -  now I know that I wasn't just wasting my time.  I
> posted
> > > to the group only after attempting to look for references
> differentiating
> > > the ADSI models between the two versions of XP on msdn myself - and
> didn't
> > > find any.  So, until now, all I had to go on was what the debugger was
> > > telling me.  If you were able to do it with the native call - I should
> be
> > > able to find a way.  That helps more than you know.  Have a great
> weekend.
> >
> > I have given you even 2 ways that -worked- using VB6 (using native ADSI

> > code) and a managed sample.
> > If you mean that you are going to use the ADVAPI32 library, have my
> > blessings, but that won't work either. You computer seems mall
> functioning.
> > As I suggested, you should install filemon and tokenmon from
> > www.sysinternals.com to see what can be fixed about your system.
> >
>
>
date: Sat, 30 Apr 2005 12:16:04 -0400   author:   Joe User JoeUser@somewhere

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us