?
Solved

Help on a Windows batch file domain pc query?

Posted on 2006-03-30
9
Medium Priority
?
398 Views
Last Modified: 2013-11-13
I need to be able to query the domain and take all the computer names in the domain name put them into a text file. Then I need to take those results and use them to query all the computer for their system info (name, ip ,mac) Like the DOS systeminfo command with the mac address. And save the ouput as a .csv file that contains all the information for all computers in the domain. I have alot of seperate parts ,but can't tie it al together that good. Any help is appreciated.
0
Comment
Question by:sliderwing
7 Comments
 
LVL 1

Expert Comment

by:uter
ID: 16337032
It's tough to query all the remote machines in real time but pretty easy to set up a login script that queries the PC and writes a CSV out on a network share. Is that a possibility? The simplest script would just be one line:

set > \\server\share\%computername%.txt
0
 
LVL 10

Expert Comment

by:fm250
ID: 16337179
you can also add another line (if you are going with uter solution) for ip addresses, mac address and computer name ..etc like this:

ipconfig /all >> \\server\share\%computername%.txt

nothe that the >> will append to the file, not delte it.

hope this help
0
 
LVL 1

Expert Comment

by:uter
ID: 16337717
If you really want to get fancy, you can do a

fsutil fsinfo drives

which will list all the drives, then parse those with a for loop and do a

fsutil volume diskfree [drive letter]

to get the free space.

(Beat THAT for obscure DOS commands!) :-)

0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

by:sliderwing
ID: 16338760
It is a weird scenario. I have no control over the servers, but total control over about 100 pc's running windows xp. So I won't be able to do the server thing. Thanks though.
0
 
LVL 5

Accepted Solution

by:
acsell earned 2000 total points
ID: 16346371
You can use the following program to get the information that you require with out the need to have access to the server. It will also automatically export to CSV and scans the network quite quickly.

http://www.inetcat.org/software/nbtscan.html

NBTscan is a program for scanning IP networks for NetBIOS name information. It sends NetBIOS status query to each address in supplied range and lists received information in human readable form. For each responded host it lists IP address, NetBIOS computer name, logged-in user name and MAC address.

Example Usage-

nbtscan.exe -q -s , 172.16.1.0-255 > list.csv
nbtscan.exe -q -s , 172.16.2.0-255 > list.csv

just use the above commands in a batch file and replace the IP ranges with your own.
0
 
LVL 5

Expert Comment

by:acsell
ID: 16346410
Also have a look at PSTools especially PsExec

http://www.sysinternals.com/Utilities/PsTools.html

PsExec will allow you to run programs remotely over a whole network of computers. The only problem is that it requires you to have a list of al of the computers on the domain. Although you could probably use nbtscan for that or some other tool.

http://www.sysinternals.com/Utilities/PsExec.html
0
 

Expert Comment

by:computertsu
ID: 16356330
When you said 'domain', do you have Active Directory? You can start your PC name list by exporting the contents of the Users and Computers tool, Computers folder.

The reverse approach, Make an Excel spreadsheet: put the text string "ping -n 1 -a 192.168.0." in cell A1 and copy it down to A254. (change the 192 part to match your IP addresses).
In B1, type 1, then in B2 type 2, use the pattern fill to complete the series down to cell B254.
In C1 type " >c:\pinglog.txt" and copy this all the way down to C254
Save as a text file, open it in notepad
Do a Find/Replace to remove the " and , and then save, rename to ping.bat and run it.

You can do "arp -a" for a list of IP to mac addresses shortly after your scan finishes or change the batch file above to nbtstat -A 192.168.0.1

These batch file approaches let you inventory your network, but require the PCs to be turned on.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

840 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