How to export SRVMGR domain list??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

all.

i am trying to export a full list of the domain members that are listed in
server manager.. on both NT and AD domains. i cannot find a way (or
utlitiy) that will export the list.. NET VIEW /DOMAIN does not work.. it only
gives me a list of active members. I want the entire list that I see in
server manager.

ideas??

thanks in advance.

r
 
If you have Python (2.3) installed, this script by D.W.Harks will do what
you want. Save the text below as "domain.py" and you can ouput to text file
with "python domain.py > domain.txt". Comment out the line that says "Print
"Listing machines ...." if you don't want that in your output.
Louis

-----Begin script-----
# From a post to python-win32 by D.W.Harks
# http://mail.python.org/pipermail/python-win32/2003-July/001179.html
#
from __future__ import generators
import os, sys
import socket
import win32com.client
import win32net

def machines_in_domain (domain_name):
adsi = win32com.client.Dispatch ("ADsNameSpaces")
nt = adsi.GetObject ("","WinNT:")
result = nt.OpenDSObject ("WinNT://%s" % domain_name, "", "", 0)
result.Filter = ["computer"]
for machine in result:
yield machine.Name

domain_controller = win32net.NetGetDCName (None, None)
domain_name = win32net.NetUserModalsGet (domain_controller,
2)['domain_name']
print "Listing machines in", domain_name
for machine in machines_in_domain (domain_name):
print machine
-----End script-----
 
i will give that a shot.. thanks..
r

3c273 said:
If you have Python (2.3) installed, this script by D.W.Harks will do what
you want. Save the text below as "domain.py" and you can ouput to text file
with "python domain.py > domain.txt". Comment out the line that says "Print
"Listing machines ...." if you don't want that in your output.
Louis

-----Begin script-----
# From a post to python-win32 by D.W.Harks
# http://mail.python.org/pipermail/python-win32/2003-July/001179.html
#
from __future__ import generators
import os, sys
import socket
import win32com.client
import win32net

def machines_in_domain (domain_name):
adsi = win32com.client.Dispatch ("ADsNameSpaces")
nt = adsi.GetObject ("","WinNT:")
result = nt.OpenDSObject ("WinNT://%s" % domain_name, "", "", 0)
result.Filter = ["computer"]
for machine in result:
yield machine.Name

domain_controller = win32net.NetGetDCName (None, None)
domain_name = win32net.NetUserModalsGet (domain_controller,
2)['domain_name']
print "Listing machines in", domain_name
for machine in machines_in_domain (domain_name):
print machine
-----End script-----



Rob said:
all.

i am trying to export a full list of the domain members that are listed in
server manager.. on both NT and AD domains. i cannot find a way (or
utlitiy) that will export the list.. NET VIEW /DOMAIN does not work.. it only
gives me a list of active members. I want the entire list that I see in
server manager.

ideas??

thanks in advance.

r
 
Back
Top