Jeroen Tondeleir
Jeroen Tondeleir

Reputation: 48

Batch code to show all pc's in a domain

I tried to look some things up, but I'm unable to find what i look for.

I would like to have a code that can do this:

So it would kinda look like this:

GetSysteminfo.bat

Scan domain for every pc >> PcNames.txt
For %%EveryPC IN (PcNames.txt) Do (
Commands (i will post them if neccesary)
)

The output file would look like: PcInfo.txt

PC01
information

PC02
information

PC03
information

etc.

I hope you understand what i try to get. Thanks in advance for trying to help me.

Upvotes: 0

Views: 163

Answers (1)

PA.
PA.

Reputation: 29339

You'll need the tools netdom (https://technet.microsoft.com/en-us/library/cc772217.aspx) and the domain administration credentials.

then you might

 for /f "tokens=*" %%a in ('netdom query WORKSTATION') do (
    echo %%a >>results.txt
    yourcommand %%a >>results.txt
    echo. >>results.txt
 ) 

Upvotes: 1

Related Questions