Listing all machines in a domain
Dirk Hagemann
usenet at mail-2-me.com
Thu Oct 30 07:06:07 EST 2003
Tim Howarth <tim at worthy.demon.co.uk> wrote in message news:<2f3cef424c.tim at worthy.demon.co.uk>...
> In message <41cb194b.0310150354.13c4cb2c at posting.google.com>
> dirkhagemann at firemail.de (Dirk Hagemann) wrote:
>
> > I need to get a list of all machines in a (Windows-)domain.
>
> If an Active Directory domain then you could use;
>
>
> import win32com.client
>
> def do_onecontainer(Container):
> for oneobject in Container:
> if oneobject.Class.lower()=='computer':
> print oneobject.cn
>
> if oneobject.Class.lower()=="organizationalunit" or \
> oneobject.Class.lower()== "container":
> do_onecontainer(oneobject)
>
> startContainer=win32com.client.GetObject("LDAP://DC=mydomain,DC=local")
>
> do_onecontainer(startContainer)
No, thank you. It's not an AD-domain - that's what we are preparing...
Dirk
More information about the Python-list
mailing list