Solved

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

Posted on 2011-02-17
5
398 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 82

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

16 Experts available now in Live!

Get 1:1 Help Now