RE(2): Deployment

Ingecom - SERRE Jean-Christophe jcs "at" ingecom.com
Fri, 11 Aug 2000 00:05:09 +0000


Andy Mason <amason "at" mail.cebra.com> wrote:
>
> Here's the bit you need to get your list of machine names:
>
> for /f "tokens=1 skip=3" %m in ('net view') do echo %m
>
> Try this to see what it does, then replace "echo %m" with
"remoteinstall.bat
> 12:00 %m"
> If you want to use this type of for command in a batch file, you need two
> %'s for each variable (%%m instead of %m).
>
> This will list ALL names you can see in Network Neighborhood, which might
> not be ideal, since it would include servers, etc.

FYI, there are two troubles in that code: the last line of "net view"
says that command has been completed and will give a false computername.
And this will not list the complete nethood but only the current
domain/workgroup.

The two batches below will display the complete list of all
computernames visible in the nethood (one batch enumerates all
domains/workgroups and calls the other which enumerates all
computernamename in it).

The batch compdom.bat should be completely computer-independant, but in
the batch compall.bat you'll have to edit the COMPALLTXT variable to set
it to the first words of the status line outputted by "net view /domain"
on your computer (the sample works for a french NT that ends with "La
commande a iti exicutie").

compall.bat
......................................................................
@ECHO OFF

SET COMPALLTMP=COMPALL.TXT
SET COMPALLTXT=La commande

NET VIEW /DOMAIN | FIND /V /I "%COMPALLTXT%" > %COMPALLTMP%
FOR /F "SKIP=3" %%D IN ( %COMPALLTMP% ) DO CALL COMPDOM.BAT %%D

IF EXIST %COMPALLTMP% DEL %COMPALLTMP% > NUL
SET COMPALLTMP=
SET COMPALLTXT=
......................................................................

compdom.bat
......................................................................
@ECHO OFF

SET COMPDOMTMP=COMPDOM.TXT
SET COMPDOMTXT=
IF NOT "%1"=="" SET COMPDOMTXT=/DOMAIN:%1

NET VIEW %COMPDOMTXT% | FIND "\\" > %COMPDOMTMP%
FOR /F %%M IN ( %COMPDOMTMP% ) DO ECHO %%M

IF EXIST %COMPDOMTMP% DEL %COMPDOMTMP% > NUL
SET COMPDOMTMP=
SET COMPDOMTXT=
......................................................................

Thus,
  COMPALL.BAT  > NAMES.TXT
should generate a text list of all computernames ; a 3rd batch calling
it could then use a set of
  TYPE NAMES.TXT | FIND /V /I "\\SOMENAME" > TMP.TXT
  COPY TMP.TXT NAMES.TXT
so as to remove one after another a set of names from the final list...

--
JCS - Jean-Christophe SERRE - INGECOM France - +33 (0)1.48.34.12.34
 
Microsoft: the 51st State of America -- 52nd coming soon!
---------------------------------------------------------------------
To unsubscribe, send a message with the line: unsubscribe vnc-list
to majordomo "at" uk.research.att.com
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------