[python-win32] PDC vs VLAN cage match.

d.w. harks dave at psys.org
Mon Aug 4 18:55:23 EDT 2003


With carefully-arranged electrons, null-python-win32 at tinfoilhat.ca wrote:
> I'm still having little luck enumerating across VLANs.
> Though the following bit of code was suggested by Mr. Harks did help:
> 
> >import win32com.client
> >adsi = win32com.client.Dispatch("ADsNameSpaces")
> >nt = adsi.GetObject("", "WinNT:")
> >dom = nt.OpenDSObject("WinNT://DOM", "user", "password", 0)
> >dom.Filter = ["computer"]
> >for comp in dom:
> >    print comp.Name
> 
> Any sources for documenatation on this?  Specifically the ADsNameSpaces
> stuff?  This is a pretty different approach than using WMI, maybe it's the
> same thing though I'm not qualified to tell.
> 
> As far as win32sdk stuff is concerned I'm jumping into that pool without
> checking if it has water in it first.  It is extremly interesting though
> the lack of descriptive documentation is a bit troubling.
> 
> I'm sure this documentation exists though I'm having a hard time finding it.
> I could really use some book or site suggestions.
> 
> -- 
> Sean
> 

You'll find that after the win32com.client.Dispatch() call, nearly every
single line of that code is almost identical to the VBScript or Visual Basic
code found on MSDN or in an ADSI programming book.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/adsi/active_directory_service_interfaces_adsi.asp?frame=true

--the home for ADSI coders

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/adsi/adsi_objects_of_winnt.asp

--Objects of the WinNT provider

Essentially, you won't find Pythonic documentation; you'll have to translate
the VB, VBScript, or C++ -- but that's fairly trivial, once you get the hang
of it.

Good luck!

dave

-- 
David W. Harks <dave at psys.org>  http://dwblog.psys.org



More information about the Python-win32 mailing list