JSI Tip 1102. Another way to build a file of member computer names in your domain.


In tip 677, we used NETDOM to build a file of computer names in your domain.

Here is another method that doesn't require Supplement Two of the Resource kit (even though you should have it).

Use Regedit.exe to export a InputFileName.reg file, from your PDC, at:

HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names

You could use:

regedit /e "<Drive:>\<Path>\InputFileName.reg" "HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names"

The syntax of RegMember.bat is:

RegMember "<Drive:>\<Path>\OutputFileName.ext" "<Drive:>\<Path>\InputFileName.reg"

where:

<Drive:>\<Path>\OutputFileName.ext will contain the output computer names.

<Drive:>\<Path>\InputFileName.reg   is the exported .reg file.

RegMember.bat contains:


@echo off
setlocal
if "%2"

"" goto badp If exist %1 del /f /q %1 if not exist %2 goto badp set input=%2 set output=%1 for /f "Tokens=8 Delims=\" %%i in (%input%) do call :ismbr %%i endlocal goto end :badp @echo Syntax: RegMember "<Drive:>\<Path>\OutputFileName.ext" "<Drive:>\<Path>\InputFileName.reg" endlocal goto end :ismbr set tst=%1 set mbr=%tst:$\]=% if "%mbr%"

"%tst%" goto end @echo %mbr% >> %output% :end

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish