Prev | Current Page 535 | Next

John Paul Mueller

"Administering Windows Server 2008 Server Core"

Of course, you want to do all this without
working with each machine individually, so it??™s just as well that you can tell the batch file to generate
the list of machines for you. Listing 8.2 shows how to create such a list as batch file. Note that
some of the long lines are broken in the book. All of the FOR commands must appear on a single line.
SCHEDULING AND MANAGING TASKS 219
Listing 8.2: Defining Tasks on Every Machine on a Network
@ECHO OFF
REM Obtain a list of machines from the system.
Net View > Temp.TXT
REM Remove any existing list of machines.
@ECHO Removing old Machines.TXT.
IF EXIST Machines.TXT Del Machines.TXT
REM Make the list usable by removing extraneous material.
@ECHO Generating a New Machine List
FOR /F ???skip=3??? %%M in (Temp.TXT) DO IF %%M NEQ The @ECHO %%M >> Machines.TXT
REM Copy the required files to each machine.
@ECHO Copying the File Specification and Deletion Batch Files
FOR /F %%M in (Machines.TXT) DO Copy DelFiles.TXT ???%%M\Drive_D??? /Y
FOR /F %%M in (Machines.TXT) DO Copy MyBatch.BAT ???%%M\Drive_D??? /Y
REM Schedule the task on each machine.
@ECHO Creating the Scheduled Task
FOR /F %%M in (Machines.


Pages:
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
ranking kasyn Wczasy nad morzem szkolenia dla przedsiębiorców aragorn.binto.pl zakłady bukmacherskie