显示域中所有电脑的批处理代码

Batch code to show all pc's in a domain

我试图查找一些东西,但找不到我要找的东西。

我想要一个可以做到这一点的代码:

所以它看起来像这样:

GetSysteminfo.bat

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

输出文件如下所示: PcInfo.txt

PC01
information

PC02
information

PC03
information

etc.

我希望你能理解我想要得到的东西。 在此先感谢您的帮助。

您将需要工具 netdom (https://technet.microsoft.com/en-us/library/cc772217.aspx) 和域管理凭据。

那么你可能

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