Solved

How can we  export to a file all computers in NT4 domain?

Posted on 2011-02-17
5
399 Views
Last Modified: 2012-05-11
How can we  export to a file all computers in NT4 domain?
0
Comment
Question by:SAM2009
5 Comments
 
LVL 5

Assisted Solution

by:rdhoore108
rdhoore108 earned 50 total points
ID: 34920130
NETDOM.EXE should be able to do that, it is in the NT 4 Server Resource Kit supplement.
0
 
LVL 5

Expert Comment

by:rdhoore108
ID: 34920156
0
 
LVL 83

Assisted Solution

by:oBdA
oBdA earned 50 total points
ID: 34920805
Here's a batch script that should do the trick; should be running on any machine in the domain:
@echo off
setlocal
:: *** The number of the first useless lines of the 'net group "domain users" /domain' command output:
set NetFirst=4
:: *** The last line of the 'net group "domain users" /domain' command output:
set NetLast=The command completed successfully
:: *** In an NT4 domain, the domain computers are in the Domain Users group; 
:: *** in an AD domain, they're in the "Domain Computers" group:
set MachineGroup=Domain Computers
if "%UserDNSDomain%"=="" set MachineGroup=Domain Users

echo Computeraccounts in %Userdomain%:
for /f "skip=%NetFirst% delims=" %%a in ('net group "%MachineGroup%" /domain') do (
 set Line=%%a
 call :process
)
goto :eof

:process
:: *** Get the account names, configured in three columns:
set Account1=%Line:~0,25%
set Account2=%Line:~25,25%
set Account3=%Line:~50,25%
:: *** Avoid processing the "The command completed successfully" line
if /i "%Account1%"=="%NetLast:~0,25%" goto :eof
:: *** Remove spaces
if not "%Account1%"=="" set Account1=%Account1: =%
if not "%Account2%"=="" set Account2=%Account2: =%
if not "%Account3%"=="" set Account3=%Account3: =%
:: *** Write all accounts containing a "$":
if "%Account1%"=="" goto :eof
if not "%Account1%"=="%Account1:$=%" echo %Account1%
if "%Account2%"=="" goto :eof
if not "%Account2%"=="%Account2:$=%" echo %Account2%
if "%Account3%"=="" goto :eof
if not "%Account3%"=="%Account3:$=%" echo %Account3%
goto :eof

Open in new window

0
 
LVL 12

Accepted Solution

by:
Daz_1234 earned 400 total points
ID: 34924566
The script below will simply write the computer name of all computers in the domain to file C:\All_Domain_Computers.txt.

Daz.

'# Lists all computers in the Domain

Set fso = CreateObject("Scripting.FileSystemObject")
strDomain = "YOUR-DOMAIN"
strOutputFile = "C:\All_Domain_Computers.txt"
Set ts = fso.OpenTextFile(strOutputFile, 2, True)  '# Overwrite and create if not exist

Set oDomain = GetObject("WinNT://" & strDomain)
oDomain.filter = Array("Computer")
For Each oComputer In oDomain
    ts.WriteLine oComputer.Name
Next
ts.Close

MsgBox "Done!"

Open in new window

0
 
LVL 1

Author Closing Comment

by:SAM2009
ID: 34929143
Thnak you very much for all your suggestions. I very appreciate it!
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now