Solved

Scripting question, generate report of machines showing which domain they are joined to

Posted on 2006-11-02
1
141 Views
Last Modified: 2010-03-18
I need to script or otherwise automate a report through vbscript or batch file, to scan a particular IP range and report on machine name and which domain the machine is joined to.  I am sure windows has some dos utilities that will accomplish this, so if anyone has a good  script example you could send me, I'd appreciate it.

Thanks
Joe
0
Comment
Question by:MCPJoe
1 Comment
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 17858170
nbtstat will report that:  nbtstat -a hostname, i.e. with a list of hosts in hostlist.txt, one per line something like this should run down the list then extract the domain name from the nbtstat output.  Can't test here at the mo. so report back any syntax errors or if it doesn't work for you.
Steve

@echo off
for /f "tokens=*" %%a in (hostlist.txt) do call :process %%a
goto end
:process

for /f "tokens=1" %%x in ('nbtstat -a %1 ^| find "<1F>"') do echo %1, %%x >> domlist.txt
:end
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

Sometimes you might need to configure routing based not only on destination IP address, but also on a combination of destination IP address (or hostname) and destination port number. I will describe a method how to accomplish this with free tools. …
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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