Listing computers of a WinNT-Domain

D

Dirk Hagemann

Hi!
I'm using this code to list all computers of our WinNT-Domains:
import win32com.client
from pprint import pprint as p

domain='domainX'
auswahl='computer'

def enumerate(domain,auswahl):
adsi = win32com.client.Dispatch("ADsNameSpaces")
nt = adsi.GetObject("","WinNT:")
result = nt.OpenDSObject("WinNT://"+domain+"","","",0)
result.Filter = [auswahl] # computer, user, group
domain = []
for machine in result:
domain.append(machine.Name)
return domain
p(enumerate(domain,auswahl))

This works well with all domains except one domain. One of the domains
returns an emty list of computers, but it returns users an groups if I
set the filter accordingly; just the computers are missing (even if I
do not filter).
One week ago it was fully working... What can have happend? Any idea
anybody?

Regards
Dirk

PS: the computers are still existing in this domain.
 
M

Michel Claveau/Hamster

Hi !

Windows pb, not Python.

This domain :
- is with AD ?
- same protocol ?
- same rights ?
- connected like Administrator ?
- some services are disactived ?
- have you try with WMI ?
- have you try on the server primary server domain ?
- etc.
- etc.

Good courage...

@-salutations an *sorry for my bad english*
 
D

Dirk Hagemann

Hi Michael!

I have "domain-admin"-rights (I can see the computers in the
server-manager GUI).
This domain is exactly like the other domains, BUT it is much BIGGER
than the others.
As far as I found out meanwhile it seems as if my script is fully ok,
but because of the size of this domain, I don't get all elements. I
found out that my list of elements has exactly 4000 entries;
coincidence??? It looks like this object simply gets just the first
4000 elements.

Now I seem to have 2 possibilities:
1.: find out how to get the other elements on this way
or
2.: find another appropriate way to list all computer-accounts of this
domain.

At the moment I try to find some Microsoft-Tools which I can run from
commandline...

Dirk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top