Solved

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

Posted on 2011-02-17
5
401 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 13

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
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 …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

813 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

13 Experts available now in Live!

Get 1:1 Help Now