Avamar - Scripts

Part I: Sample script to retrieve data from a putty session and VMware

@echo off

REM The server we want to research is passed in. We locate it and then produce the output

set buildDate=%DATE:~4,10%

set dateStr=%buildDate:~6,4%%buildDate:~0,2%%buildDate:~3,2%_%%%t.log

REM @echo %dateStr%

REM http://www.thegeekstuff.com/2011/10/grep-or-and-not-operators/

REM grep -E 'Dev.*Tech' employee.txt

REM grep -i -m1 "%1.vmdk" putty_%dateStr%

REM This is to find "File Name" AND "%.vmdk"

REM @echo ^^^^

grep -i -m1 -E "File Name.*%1" putty_%dateStr%


REM @echo ^^^^

Part II: Script to run (Part I) to get what host a VM is on

@echo off

REM pass the servers we want to find. Then it will go to that day and process them

@for /f "tokens=*" %%f In (%1.txt) Do @ProcessLocations.cmd %%f

To use: make sure the file locations exist in Part I. Run the script in Part II.