List domains on a windows network?

Tim Golden tim.golden at viacom-outdoor.co.uk
Tue Sep 14 04:33:26 EDT 2004


jakasspinguino at hotmail.com (Jason) wrote in message news:<ed7f588b.0409081938.4634c05c at posting.google.com>...
> Hi,
> 
> I'm looking for a way to enumerate the domains within my network.  I
> can find functions within the win32net library to enumerate computers
> within a given domain, but is there a way I can get a list of the
> domains themselves?
> 
> Thanks,
> Jason

You've probably found this out by now, but the following
code should do the business:

<code>

import win32com.client

for domain in win32com.client.GetObject ("WinNT:"):
  print domain.Name

</code>

TJG



More information about the Python-list mailing list