@ECHO OFF
setlocal EnableDelayedExpansion
REM SET TWGETSKIPMEGARAID=YES
SET TWGETWINSTART=%time%
REM SET LSIGETWINVER=091218_Skip_MegaRAID
SET LSIGETWINVER=091218
@ECHO Capture_Script_Version_%LSIGETWINVER%
REM
REM NOTE: This Script Disables AEC and DPMSTAT Automatically.	
REM 
REM - LSIGET Windows Change Log - Restarted after major re-write.
REM -  
REM - 12/14/09	Added 3ware 10.0 release, cversions.MR/HBA, fine tuned data presentation.
REM -
REM - 03/09/10	Changed help from -? to -H for compatibility with FreeBSD. Will restart documentation of all changes to capture scripts.
REM -
REM - 03/10/10	Upgraded MR CLI to 4.3, added 09M12 version info to cversions_MR.txt. Added Drive Type & Queuing on 3ware grep.
REM -
REM - 03/11/10	Added tw_wdcon & tw_devcon - None of these are supported individually, internal utils, only to be used at LSI instruction.
REM -		tw_windriver     Driver configuration utility for the 7000/8000/9000 series of controllers (not the 9750).
REM -		tw_wdcon         Driver configuration utility for the 9750 controller (and any others going forward).
REM -		tw_devcon        Device control and driver installation utility for all controllers (not specific to any product, 3ware, LSI, or otherwise).
REM - 03/13/10	Cleaned up tw_devcon section, Drive Type heading change, old file cleanup.
REM -
REM - 04/20/10	Updated MegaCli to 10M04
REM -
REM - 06/20/10	Rearranged data for easier troubleshooting, less use of MegaCli, more grepping of master file for better performance.
REM -		Created separate files for pdlist/adpalilog/adpallinfo/fwtermlog & added master file name to all as well as 
REM -		adapter_ax.txt file, fwtermlog and all relevant data still in adapter_ax.txt file. Created separate files for grepped
REM -		fwtermlog errors to make it easier to read fwtermlog (instead of appending to end).
REM -		Updated MegaCli to 10M05, updated help, fwtermlog errors in separate subdir.
REM -
REM - 12/14/10	Updated internal util.
REM - 01/05/11	Backup reg key for ring buffer, updated MegaCli to 10M09.
REM -
REM - 01/25/11	Added ELF & DS III query for MR, commented out reg export. Fixed a few typos.
REM -
REM - 01/25/11	Updated tw_cli to 10.2
REM -
REM - 03/25/11	Updating ELF query, DS 3, misc command additions and formatting changes. Updated MegaCli to 10M12/8.01.06.
REM -		Updated HBA section to better support Warp, still need separate cli.
REM -
REM - 03/28/11	Updated all 3ware.com references to lsi.com and recommended versions. Updated internal util to 1.66. Changed MR event log subdir.
REM -
REM - 06/20/11	Added Beta 11M06 MegaCli(64)
REM -
REM - 09/23/11	Added check for Win7SP1 and dump system event log with wevtutil and MegaRAID_Driver_Event_Codes.txt to Script_Workspace dir.
REM -		Added 9.5.4/10.2.1 tw_cli that fixed show diag not working on older fw.	
REM - 10/06/11	Updated internal util to 1.67.
REM -
REM - 01/26/12	Updated MegaCLi(64) to 8.02.21 from 11M09P3, added check for MR LD consistency, MR PCI Info - adpgetpci, MR perfmode.
REM -
REM - 05/30/12	Added WarpDrive data collection.
REM -		Updated MegaCli and MegaCli64 to 8.04.07.
REM -
REM - 08/21/13	Updated internal util to 1.70, replaced MegaCli with storcli 1.05.07, updated dcli to 110.00.00.00, updated KB URLs, Win 2k12 version #,
REM -		hard coded 32bit internal tool, piped dir test to nul, updated readme, fixed WD data collection logic and added additional data - changed the 
REM -		formatting of it, REM -'ed out tw_devcon.	
REM -
REM - 08/29/13	Updated storcli to 1.05.11 (5.8), added storelibir-2.dll's to support NytroXD.   	
REM -
REM - 09/17/13	Updated 7z to 9.2,switched back to .7z format, Need to add Nytro XD data capture.
REM -
REM - 12/03/13	Updated storcli(64) to 1.06.03 (5.9)
REM -
REM - 01/09/14	Added -SRS, -SWR & -F command line options to skip the MR Record sort and evaluation, Windows Reporting (MSINFO32/WINMSD) and both, 
REM -		only to be used for repetitive captures that don't rely on this info, significantly speeds up capture. Increased # of cmd line
REM -		variables supported to 10. Allow cmd line variables to be either all upper or all lower case within each variable.
REM -		Added MegaRAID_Terminology.txt to \MegaRAID\Notes subdir.	
REM -
REM - 01/10/14	Took out the check requiring a comment or displaying ability to make a comment. Added W2K12R2 identification. Cleaned up formatting.
REM -		Replaced the following variables/keywords with the corresponding substitute.
REM -		TWWORKSPACE=TW-WS
REM -		TWfileName=TW-FN
REM -		controller_numbers.txt=ctrl_nums.txt
REM -		c%%i_cxenclosure_numbers.txt=c%%i_cxencl_nums.txt
REM -		c%%i_exenclosure_numbers.txt=c%%i_exencl_nums.txt
REM -		controller_numbers_aec.txt=ctrl_nums_aec.txt
REM -		controller_numbers_pmstat.txt=ctrl_nums_pmstat.txt
REM -		c%%i_show_pmstat_enabled.txt=c%%i_show_pmstat_enbld.txt
REM -		c%%i_port_numbers.txt=c%%i_port_nums.txt
REM -		exenclosure_numbers.txt=exencl_nums.txt
REM -		c%%i_unit_numbers.txt=c%%i_unit_nums.txt
REM -		NO_Mraid_Adapters=NO_MR_Adps
REM -		adapter_numbers.txt=adp_nums.txt
REM -		phy_numbers_A%%i.txt=phy_nums_A%%i.txt
REM -		eventlog_getsincereboot_A%%i.txt=evtlog_GSR_A%%i.txt
REM -		eventlog_getsinceshutdown_A%%i.txt=evtlog_GSS_A%%i.txt
REM -		eventlog_getevents_A%%i.txt=evtlog_GE_A%%i.txt
REM -		eventlog_includedeleted_A%%i.txt=evtlog_ID_A%%i.txt
REM -		NO_WarpDrives=NO_WDs
REM -		NO_3Ware_Controllers=NO_3Ware_Ctrls
REM -
REM - 01/12/14	Added native storcli syntax support. Grep of fwtermlog and eventlog sorting takes place only in MegaCli section for times sake,
REM -		output of the raw logs is done from storcli as well. Updated aens_mr.txt to MR 5.5.	
REM -
REM - 01/13/14	Fixed erroneous iuCRC_Error_Detected warning.
REM - 01/18/14	Added DPMSTAT & AEC data collection options for MR.
REM -
REM - 01/19/14	Moved script_diag to end so G_* switches get the data. Added check to only show iBBU or SuperCap data if present, work around 
REM -		for storcli bug.
REM -
REM - 01/21/14	Increased variable check to 20 and truly support case insensitive variables. Skip adpalilog dump on Win2K12R2 due to 
REM -		storcli bug. Updated internal util to 1.71.
REM -
REM - 01/22/14	Added Nytro XD support and used storelibir-2.dll's from release 14.07_CCOH, need to make sure no functionality was lost. for 
REM -		other Nytro products.
REM -
REM - 01/24/14	Updated storcli to 1.07.07 (6.2), REM -ed out 3Ware/MegaRAID/HBA INF File Check - Changed in W2K12. Added Cx show health - all,
REM -		New feature is erratic, different PDs display intermittently, MR/NMR.
REM -
REM - 01/25/14	Added the following commands;
REM -		storcli /cx show health [all]
REM -		storcli /cx show fshinting
REM -		storcli /cx[/ex]/sx show securitykey keyid 
REM -		storcli /cx show ocr 
REM -		storcli /cx show bootwithpinnedcache
REM -		storcli /cx show badblocks
REM -		storcli /cx/vx show BBMT
REM -
REM - 01/26/14	Added Progress & Obsolete as AENs to manage. Updated aens_mr.txt to release 6.2, storelib 4.14 event/eventmsh.h.
REM -
REM - 01/28/14	Cleaned up duplicate AEN output files.
REM -
REM - 02/26/14	Added 6.3.9600 as a valid Win2K12R2 version in addition to 6.3.9200. Added test IF EXIST for cX_nytro_eidslt_nmr.txt &
REM -		drvVAX.txt use.
REM -
REM - 02/06/14	Added 6.3.9431 as a valid Win2K12R2 version, added check to skip adpalilog if OS version is unknown. Fixed logic for ADPALILOG_SKIP
REM -
REM - 04/23/14	Added option 17 and 25-2-0-0 to internal util, got rid of _all output.
REM - 
REM - 05/28/14	Don't run reg on an unknown OS, created REG_SKIP variable. Changed output file to *.z_7 to make it through the Avago email filter. 
REM -
REM - 06/24/14	Changed output filename back to .7z and now create file with a password, "avago". Updated storcli to 1.09.08 (6.3). Removed skipping
REM -		of adpalilog for Win2K3 as 1.09.08 storcli fixed the segfault issue. Included pciutils3.2.1, gathering lspci, -t, -v, -vv, -vvv, -x,
REM -		-xxx, -xxxx, -D, -n, -nn, -M.
REM -
REM - 08/08/14	Fixed dpmstat collection for 3ware, missing creation of ctrl_nums_pmstat.txt for STANDARD mode. Added new line into MR PMSTAT output 
REM -		files to work with macro created for lsigetlunix. 
REM -
REM - 08/14/14	Added LSI expander data collection, xu 16.00.00.00 and g3xu 5.00.00.00.
REM -
REM - 08/22/14	Added Summary.txt file, duplicate info from other files all in one. Added grep 2.54. Moved MR reg keys from MegaRAID\MegaCli to MegaRAID
REM -
REM - 08/28/14	Fixed Summary.txt, wasnt including MegaRAID\storcli\Controller_Cx.txt files. Added GPL to pciutils subdir.
REM -
REM - 09/26/14	Removed support for Nytro WD/XD due to sale of division to Seagate. Updated storcli version to 6.4/1.12.13. 
REM -		Added collection of ManPages 16-31 on HBAs. Updated internal util to 1.72. 
REM -
REM - 01/05/15	Changed grep string for CV detection from SuperCaP to Cachevault_Info. 	
REM -
REM - 03/19/15	Added registry dump for lsi_sas3 driver, fixed syntax error that was generating an error for Gen1_2_EXP_SAS_Address.txt not existing if Gen3 expanders did.
REM -
REM - 02/07/16	Streamlined AEN sorting, use "grep -B 3 -A 5", lose data section but description includes pertinent info, changed aens_mr.txt format. A lot faster.
REM - 	   	Added sed and awk, not using yet. Updated Readme.txt -srs switch notes. Added -UMS "Use MegaCli Syntax" switch, took it out from standard run to speedup script.
REM -		Changed filename password from avago to broadcom, also references in script. Deleted unmaintained version files. 
REM -
REM - 02/09/16	Removed eventlog collection of standard/getsinceboot/getsinceshutdown, only get includedeleted now to save time, a minute plus per capture per controller for 78k logs.
REM -		Updated storcli to 1.18.08, 6.10 plus, through BST. Minor tweaks to the Readme.txt, URLs, etc. External message mods.
REM -
REM - 02/10/16	Removed ADPALILOG_SKIP logic, fix for old bug. Added IOC data collection. Added AEN summary and all AENs to Summary.txt. Added coreutils, i.e. cut, etc.
REM -
REM - 02/13/16	Added Expander data collection, separated expander subdirs to 3/6/12Gb. Added missing internal util options to match lunix script. Added sas2/3ircu output and bundled sas2/3flash.
REM - 
REM - 02/14/16	Updated Sense-Key/Opcode file, added Controller_Disk_Association subdir.
REM -
REM - 02/26/16	Added 64bit versions of pciutils and sg3_utils. Added check for Win10 and Win10 Update. Updated readme for Win10 support. Added show termlog type=config for storcli. 
REM -		Added whoami /all to check for Admin rights to run script. Fixed various bugs with multiple script switch combinations. Expanded script logging for debug purposes.
REM - 
REM - 02/27/16	Fixed print strings/comments/instructions. Added some additional command line switches for repetitive capture and script debugging. Stopped collecting driver images.
REM -		Created Utils subdir to clean up installation. 
REM - 
REM - 02/28/16	Added \Scsi Port x\Scsi Bus x\Target Id x\Logical Unit Id x & registry key to CDA subdir. Deleted REG_SKIP variable, check for native reg util instead.
REM -		Added system/application logs and lspci output to Summary.txt file. Added System_Logs, lspci and System_Reg_Keys subirs to clean up root.
REM -		Deprecated WINMSD support.
REM -
REM - 02/29/16	Fixed some aesthetic file not found errors on systems without MR or 3Ware controllers. Added precreate.bat. 
REM -
REM - 03/01/16	Added a -EXT switch to extract all included utilities. Rearranged some of the code blocks. Created an Internal/OEM/Partner variant of the script that contains controller 
REM -		utilities and requires BCLAs. lsigetwin-I_xxyyxx is the subdir for the new build which is a super set of lsigetwin_xxyyxx. Updated the Readme to provide more details.
REM -
REM - 03/04/16	Added -SMR, -S3W, SHBA and -SEXP command line switches to skip data collection for MegaRAID, 3Ware, HBA and Expanders respectively. Changed all switches with DPMSTAT to DPM.
REM -
REM - 03/05/16	Added LSI_Products subdir, Removed storcli subdir, moved all non existent reg_key files to the TW-WS dir. Cleaned up expander data collection formatting, messaging and timing. 
REM - 
REM - 03/06/16	Fixed 3ware tw_mgmt.log name issue.
REM -
REM - 03/08/16	Removed all automatic directory creations unless a device/valid file exists. Removed redundant 3ware 3DMx dirs. Added MR/storcli /eall show status to Controller_Cx, deleted separate 
REM -		show all/status file. Put redundant/comparative storcli files in separate subdir. Rem'ed out MSM/CIM/SNMP file collection. Removed MegaRAID\FWTermlog subdir. Cleaned up 
REM -		expander data collection and summary.txt file. Added alilog output, new syntax equivalent of AdpAliLog, runs in 30 seconds as opposed to Legacy syntax of 4m30s.
REM -
REM - 03/11/16	Fixed presentation for MR of background task status/time to completion. Added a bunch of new cli commands as well as SDS command support, still need to add new cli when available.
REM -		_SDS build created with version 2.03.00 storcli. Fixed Expander\xxGb\Detail subdir creation if no HBAs present. Upgraded storcli to 6.11/1.19.04.
REM -
REM - 03/13/16	Added -SDS switch to force use BETA versions of storcli, if SDS in storcli show output it will be used regardless, temporary. If SDS is not in the show output then the GCA 
REM -		1.19.04 storcli will be used.
REM - 
REM - 03/14/16	Fixed Readme, incorrect parameter listed for skip compression and removed -F as redundant, same as -SRC. Added automatic change log creation on package build. Removed -F as switch,
REM -		previously only removed it from help.
REM - 
REM - 03/15/16	Fixed logic in CDA section, added "IF EXIST %TW-WS%cda\reg-scsi-lun-id-pds.txt" to avoid screen output error. Fixed some typo's. fixed logic for -m/-g_*/-e_* command line switches,
REM -		to only allow when pertinent.
REM -
REM - 03/16/16	Improved logic for competing commmand line switches, updated help. Created messages when illegal combinations used.
REM -
REM - 03/17/16	Updated 7z (15.14) and now have 32 /64bit versions to support WInPE. Replaced grep/gawk/sed/coreutils with cygwin 32/64bit variants for WinPE. Replaced doze with sleep.
REM -
REM - 03/18/16	Replaced the nearly 500 instances of findstr with grep. Delete the Utils subdir on each run, move /Y doesnt work on subdirs.
REM -
REM - 03/19/16	Finished WinPE 64 port, made a number of commmands optional based on WOW64 support being installed/WinPE supporting the command such as msinfo32/whoami/eventlog capture/etc.
REM -		Made all xdir/timer commands to time script sections dependent on WOW64 support and replaced then with simple %time% echos. Enhanced logging.
REM -
REM - 03/20/16	Addded scl support, changed nameing style on all exp/HBA files to have SAS Address on left. 
REM -
REM - 03/21/16	Added warning if compression of file failed, borderline on a 2GB system running WinPE 10 64Bit.
REM -
REM - 03/25/16	Fixed move of sas2/3ircu if those IOCs aren't present. Upgraded tw_cli to last version. Created Event_Logs subdir for 3ware AENs.
REM -
REM - 03/26/16	Fixed bug in create.bat that builds the script and generates the changelog, the entire script was being dumped into the changelog. Got rid of duplicate header for scl utility.
REM -		Added check to not create exp subdir for scl util if no exps present.
REM - 
REM - 03/27/16	scl not running, fixed some logic and added additional debug prints. Fixed some typos in 3ware data dump.
REM -
REM - 04/11/16	Added Scrutiny SI Phase 11 to a new Internal Only build of lsiget, in addition to the _I internal version there is now a _IS internal version as well.
REM -
REM - 04/20/16	Fixed some bugs associated with the Scrutiny extraction, added messages, etc.
REM -
REM - 05/04/16	Added subdir lsiget_Generic_Commented_SI_Scripts to the -IS build Scrutiny subdir with two highly commented Python script files with lots of examples/notes.
REM -		A Scrutiny\Captured_Eyes subdir is automatically created and EYEs/Bathtubs/Data Files are saved there automatically when these scripts are run. By default
REM -		the specific PHYs are chosen from a menu but there a numerous commented out examples for Expanders/IOC-ROC SAS PHYs as well as IOC-ROC PCIe PHYs.
REM -
REM - 05/10/16	Added bootstrapCobra.bin to the -I/IS builds to allow for g3xtools serial expander access. Added new Scrutiny Bathtub Script to -I/-IS builds, loops on x PHYs, disables/enables
REM -		PHYs, stops on phy errors, has logging.
REM -
REM - 05/11/16	Added Docs directory to -I/-IS builds with MPT SAS Error codes/MPT Specs/Expander SDK PGs/Expander FW Config PGs.
REM -
REM - 05/13/16	Changed path for cygwin subdirs from Utils\cygwin32 or Utils\cygwin64 to Utils\cygwin to help with Python script pathing for Eyescope.
REM -
REM - 05/18/16	Added PRERELEASE g3xu and scl for Cub support in the INTERNAL builds. Older Scrutiny Python Scripts were not updated for the new Util Pathing, only the latest.
REM -		Get sasaddress from scl via show instead of sasaddr due to bug in scl, logged defect. Added support for Cub.
REM -
REM - 09/29/17	Changed default for SMR to YES, updated storcli to 7.3 Release.
REM -
REM -
REM - 11/22/17	Updated lsut and scli.
REM -       Added a few commands to scli for SAS35 controllers
REM -
REM - 08/22/18 - Updated scl, g3xutil, storcli, sas3flash, sas3ircu
REM -
REM - 09/12/18 added Win2016 recognition
REM
REM To Do...
REM 1. Registry Backup, RB Registry Mod, RB, Reg restore.
REM 2. Port Linux debug scripts
REM 
REM
REM  Data collection script for Windows platforms
REM    This script will collect some system files such as "event" logs useful 
REM    for debugging purposes. 
REM 
REM  How to run it:
REM    1. Copy the lsigetwin_xxxxxx.tz file to a file system with available space. 
REM         A. In general, the size of the data collected is at least as big as the total size of all logs files.
REM    3. Run it: lsigetwin -H <enter> for help screen
REM
REM 
REM  What to do when the script ends:
REM    1. Send the .7z file to Technical Support or the FAE that you are in contact with.
REM 
REM  What to do when receiving the .7z file:
REM    1. Extract
REM    2. Verify files are not empty & Controller_Cx.txt files are present.
REM    3. Analyze the collected data 
REM
REM
REM
REM ###########################################################################################################################
REM # Windows Batch file scripting debug tips
REM ###########################################################################################################################
REM
REM 1. You can not use a "GOTO Label" within a conditional statement, i.e. (GOTO Label) unless there is an executable 
REM    statement, i.e. "@ECHO ###" after the label. 
REM 
REM 2. You can not use a "IF %ERRORLEVEL%==0 or @ECHO %ERRORLEVEL" within a conditional statement, i.e. (IF %ERRORLEVEL%==0).
REM    The return will always be 0, use "IF NOT ERRORLEVEL 1" for a TRUE statement.
REM
REM 3. The replaceable parameter %Num_Mraid_Adapters% doesn't working in the following statement if its in a conditional statement, i.e.
REM    IF [%USEMEGACLISYNTAX%]==[NO] (
REM    FOR /L %%i IN (0,1,15) DO ( IF %%i LSS %Num_Mraid_Adapters% @ECHO %%i >> adp_nums.txt )
REM
REM 4. To use else it must connect each statement on the same line, i.e. ) ELSE (
REM
REM 5. grep 2.24 "^value" only at beginng of line, "value$" only at end of line, -v = invert match, i.e. all non matching lines.

REM ###########################################################################################################################
REM # Initialize time/date variables
REM ###########################################################################################################################

SET tw_date=%date%
SET tw_date=%tw_date:~-10%
SET tw_date=%tw_date:/=%
SET tw_date=%tw_date: =%
SET tw_date=%tw_date::=%
SET tw_date=%tw_date:.=%
SET tw_year=%tw_date:~-2%
SET tw_daymonth=%tw_date:~0,-4%
SET tw_date=%tw_daymonth%%tw_year%

SET tw_time=%time%
SET tw_time=%tw_time: =%
SET tw_time=%tw_time::=%
SET tw_time=%tw_time:.=%
SET tw_time=%tw_time:,=%
SET tw_time=%tw_time:~0,-2%


REM ###########################################################################################################################
REM # Save old log and clean up
REM ###########################################################################################################################
IF EXIST misc_output.txt copy misc_output.txt %tw_date%.%tw_time%%_misc_output.txt > nul 2>&1
IF EXIST misc_output.txt del misc_output.txt > nul 2>&1
IF EXIST misc_output.txt del misc_output.txt > nul 2>&1
IF EXIST misc_output.txt @ECHO misc_output.txt still exists... 
IF EXIST misc_output.txt del misc_output.txt > nul 2>&1
IF EXIST misc_output.txt del misc_output.txt > nul 2>&1
IF EXIST misc_output.txt @ECHO misc_output.txt still exists... 

IF EXIST Utils rmdir /S /Q Utils >> misc_output.txt 2>&1
IF EXIST Utils rmdir /S /Q Utils >> misc_output.txt 2>&1
IF EXIST Utils @ECHO Utils still exists... >> misc_output.txt 2>&1
IF EXIST Utils @ECHO Utils still exists... 
IF EXIST Utils rmdir /S /Q Utils >> misc_output.txt 2>&1
IF EXIST Utils rmdir /S /Q Utils >> misc_output.txt 2>&1
IF EXIST Utils @ECHO Utils still exists... >> misc_output.txt 2>&1
IF EXIST Utils @ECHO Utils still exists...

@ECHO dir of subdir after Utils deletion >> misc_output.txt 2>&1
dir >> misc_output.txt 2>&1

REM ###########################################################################################################################
REM # Set all_cli variable
REM ###########################################################################################################################

SET all_cli=

IF EXIST all_cli SET all_cli=all_cli
IF [%all_cli%]==[all_cli]	(
				IF EXIST all_clii	(
							@ECHO Both all_cli and all_clii exist... >> misc_output.txt 2>&1 
							GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1
							)
				IF EXIST all_cliis	(
							@ECHO Both all_cli and all_cliis exist... >> misc_output.txt 2>&1 
							GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1
							)
				)

IF EXIST all_clii SET all_cli=all_clii
IF [%all_cli%]==[all_clii]	(
				IF EXIST all_cliis	(
							@ECHO Both all_clii and all_cliis exist... >> misc_output.txt 2>&1 
							GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1
							)
				)

IF EXIST all_cli SET all_cli=all_cli
IF EXIST all_clii SET all_cli=all_clii
IF EXIST all_cliis SET all_cli=all_cliis


IF EXIST timer.txt del timer.txt >> misc_output.txt 2>&1
IF EXIST timer.txt del timer.txt >> misc_output.txt 2>&1
IF EXIST timer.txt @ECHO timer.txt still exists... >> misc_output.txt 2>&1
IF EXIST timer.txt @ECHO timer.txt still exists... 
IF EXIST timer.txt del timer.txt >> misc_output.txt 2>&1
IF EXIST timer.txt del timer.txt >> misc_output.txt 2>&1
IF EXIST timer.txt @ECHO timer.txt still exists... >> misc_output.txt 2>&1
IF EXIST timer.txt @ECHO timer.txt still exists... 



REM Need Early
IF NOT EXIST Utils mkdir Utils >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy 32_7z.exe 7z.exe >> misc_output.txt 2>&1) ELSE copy 64_7z.exe 7z.exe >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy 32_7z.dll 7z.dll >> misc_output.txt 2>&1) ELSE copy 64_7z.dll 7z.dll >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (7z e -y %all_cli% cygwin32.7z >> misc_output.txt 2>&1) ELSE 7z e -y %all_cli% cygwin64.7z >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (7z x -y cygwin32.7z >> misc_output.txt 2>&1) ELSE 7z x -y cygwin64.7z >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (move /Y cygwin32 Utils\cygwin >> misc_output.txt 2>&1) ELSE move /Y cygwin64 Utils\cygwin >> misc_output.txt 2>&1
SET cut=Utils\cygwin\cut >> misc_output.txt 2>&1
SET gawk=Utils\cygwin\gawk >> misc_output.txt 2>&1
SET grep=Utils\cygwin\grep >> misc_output.txt 2>&1
SET sed=Utils\cygwin\sed >> misc_output.txt 2>&1
SET sleep=Utils\cygwin\sleep >> misc_output.txt 2>&1
SET tr=Utils\cygwin\tr >> misc_output.txt 2>&1

@ECHO dir Utils after creation of subdir and move of cygwin utils >> misc_output.txt 2>&1
dir Utils >> misc_output.txt 2>&1

IF EXIST cygwin32 rmdir cygwin32 /S /Q  >> misc_output.txt 2>&1
IF EXIST cygwin64 rmdir cygwin64 /S /Q  >> misc_output.txt 2>&1

IF EXIST timer.exe del timer.exe  >> misc_output.txt 2>&1
IF EXIST xdir.exe del xdir.exe  >> misc_output.txt 2>&1

7z e -y %all_cli% timer.exe >> misc_output.txt 2>&1
7z e -y %all_cli% xdir.exe >> misc_output.txt 2>&1

SET NOWOW64=NO
@ECHO WOW64 test with xdir >> misc_output.txt 2>&1
xdir >> misc_output.txt 2>&1
IF ERRORLEVEL 1	(
		SET NOWOW64=YES
		@ECHO %time%
		del timer.exe >> misc_output.txt 2>&1
		del xdir.exe >> misc_output.txt 2>&1
		@ECHO deleted timer.exe and xdir.exe - doing a dir >> misc_output.txt 2>&1 
		dir >> misc_output.txt 2>&1  	
		)

IF NOT [%NOWOW64%]==[YES] (timer /q /nologo)
IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t timer.txt)



REM This section pulled from create.bat and modified where noted.
REM all_cli_files.txt changed to cleanup_all.txt

REM Third Party utils
@ECHO dumpel.exe > cleanup_all.txt 
@ECHO pciutils-3.2.1_32.7z >> cleanup_all.txt 
@ECHO pciutils-3.2.1_64.7z >> cleanup_all.txt 
@ECHO sg3_utils-1.42_32.7z >> cleanup_all.txt 
@ECHO sg3_utils-1.42_64.7z >> cleanup_all.txt 
@ECHO cygwin32.7z >> cleanup_all.txt
@ECHO cygwin64.7z >> cleanup_all.txt
REM Script files
@ECHO aens_3w.txt >> cleanup_all.txt 
@ECHO aens_mr.txt >> cleanup_all.txt 
@ECHO create.bat >> cleanup_all.txt 
@ECHO precreate.bat >> cleanup_all.txt 
@ECHO MegaRAID_Terminology.txt >> cleanup_all.txt 
@ECHO MegaRAID_Driver_Event_Codes.txt >> cleanup_all.txt 
REM Cli/Utils
@ECHO lsut.32 >> cleanup_all.txt 
@ECHO lsut.64 >> cleanup_all.txt 
@ECHO lsut.exe >> cleanup_all.txt 
@ECHO 32_lsut.exe >> cleanup_all.txt 
@ECHO tw_cli.32 >> cleanup_all.txt 
@ECHO tw_cli.64 >> cleanup_all.txt 
@ECHO tw_windriver.exe >> cleanup_all.txt 
@ECHO tw_wdcon.exe >> cleanup_all.txt 
@ECHO tw_devcon.32 >> cleanup_all.txt 
@ECHO tw_devcon.64 >> cleanup_all.txt 
@ECHO tw_devcon.exe >> cleanup_all.txt 
@ECHO Win_storcli.exe >> cleanup_all.txt 
@ECHO Win_storcli64.exe >> cleanup_all.txt 
@ECHO SDS_Win_storcli.exe >> cleanup_all.txt 
@ECHO SDS_Win_storcli64.exe >> cleanup_all.txt 
@ECHO storelibir-2.32 >> cleanup_all.txt  
@ECHO storelibir-2.64 >> cleanup_all.txt 
@ECHO Win_dcli.exe >> cleanup_all.txt 
@ECHO Win_sasflash.32 >> cleanup_all.txt 
@ECHO Win_sasflash.64 >> cleanup_all.txt
@ECHO Win_sas2flash.32 >> cleanup_all.txt 
@ECHO Win_sas2flash.64 >> cleanup_all.txt 
@ECHO Win_sas3flash.32 >> cleanup_all.txt 
@ECHO Win_sas3flash.64 >> cleanup_all.txt 
@ECHO Win_sas2ircu.32 >> cleanup_all.txt 
@ECHO Win_sas2ircu.64 >> cleanup_all.txt 
@ECHO Win_sas3ircu.32 >> cleanup_all.txt 
@ECHO Win_sas3ircu.64 >> cleanup_all.txt 
@ECHO license.txt >> cleanup_all.txt 
@ECHO tempfiles >> cleanup_all.txt 
@ECHO flashoem.32 >> cleanup_all.txt 
@ECHO flashoem.64 >> cleanup_all.txt 
@ECHO scl.exe >> cleanup_all.txt 
@ECHO scl.32 >> cleanup_all.txt 
@ECHO scl.64 >> cleanup_all.txt 
@ECHO cub_scl.exe >> cleanup_all.txt 
@ECHO cub_scl.32 >> cleanup_all.txt 
@ECHO cub_scl.64 >> cleanup_all.txt 
REM Required for tw_devcon
@ECHO DIFxAPI.32 >> cleanup_all.txt 
@ECHO DIFxAPI.64 >> cleanup_all.txt 
@ECHO DIFxAPI.dll >> cleanup_all.txt 
REM 3ware working files
@ECHO *_p_show.txt >> cleanup_all.txt 
@ECHO *_pp_show.txt >> cleanup_all.txt 
@ECHO *_port_nums.txt >> cleanup_all.txt 
@ECHO ctrl_nums_pmstat.txt >> cleanup_all.txt 
@ECHO show.txt >> cleanup_all.txt 
@ECHO c_show.txt >> cleanup_all.txt 
@ECHO ctrl_nums.txt >> cleanup_all.txt 
@ECHO *_show_capture.txt >> cleanup_all.txt 
@ECHO ctrl_nums_aec.txt >> cleanup_all.txt 
@ECHO *_show_pmstat_enbld.txt >> cleanup_all.txt 
@ECHO *_show_pmstat.txt >> cleanup_all.txt 
@ECHO *_show.txt >> cleanup_all.txt 
@ECHO tw_wdcon.txt >> cleanup_all.txt 
@ECHO tw_wdcon1.txt >> cleanup_all.txt 
@ECHO tw_wdcon2.txt >> cleanup_all.txt 
@ECHO tw_windriver.txt >> cleanup_all.txt 
@ECHO tw_windriver1.txt >> cleanup_all.txt 
@ECHO tw_windriver2.txt >> cleanup_all.txt 
@ECHO ctrl_nmbrs_tw_windriver.txt >> cleanup_all.txt 
@ECHO ctrl_nmbrs_tw_wdcon.txt >> cleanup_all.txt 
@ECHO Valid_controller_test.txt >> cleanup_all.txt
REM MegaRAID working files
@ECHO adpcount_1.txt >> cleanup_all.txt 
@ECHO num_mraid_adapters.txt >> cleanup_all.txt 
@ECHO adp_nums.txt >> cleanup_all.txt 
@ECHO CtDbg.log >> cleanup_all.txt 
@ECHO MegaSAS.log >> cleanup_all.txt 
@ECHO CmdTool.log >> cleanup_all.txt 
@ECHO mr_ctrl_nums.txt >> cleanup_all.txt 
@ECHO mr_ctrl_nums_pmstat.txt >> cleanup_all.txt
@ECHO mr_ctrl_nums_aec.txt >> cleanup_all.txt
@ECHO *_show_pmstat_enbld_mr.txt >> cleanup_all.txt
@ECHO *_show_pmstat_mr.txt >> cleanup_all.txt
@ECHO *_show_pmstat_eidslt_mr.txt >> cleanup_all.txt
@ECHO *_show_pmstat_eidslt1_mr.txt >> cleanup_all.txt
@ECHO *_show_aec_mr.txt >> cleanup_all.txt
@ECHO *_show_capture_mr.txt >> cleanup_all.txt
@ECHO pre_mr_ctrl_nums.txt >> cleanup_all.txt
REM HBA working files
@ECHO Valid_hba_test.txt >> cleanup_all.txt
@ECHO Valid_wd_test.txt >> cleanup_all.txt
REM Util logs
@ECHO CmdTool.log >> cleanup_all.txt 
@ECHO CtDbg.log >> cleanup_all.txt 
@ECHO MegaSAS.log >> cleanup_all.txt 
REM Misc
@ECHO xu.exe >> cleanup_all.txt 
@ECHO g3xu.exe >> cleanup_all.txt 
@ECHO g3xu.32 >> cleanup_all.txt 
@ECHO g3xu.64 >> cleanup_all.txt 
@ECHO cub_g3xu.exe >> cleanup_all.txt 
@ECHO cub_g3xu.64 >> cleanup_all.txt 
@ECHO dcli.exe >> cleanup_all.txt 
@ECHO scrutiny.7z >> cleanup_all.txt 
@ECHO Docs.7z >> cleanup_all.txt 


REM   .......................................||.......................................
@ECHO ........................Initial Cleanup at Script Start......................... >> misc_output.txt 2>&1
@ECHO dir >> misc_output.txt 2>&1
dir >> misc_output.txt 2>&1
@ECHO Running Cleanup >> misc_output.txt 2>&1
@ECHO List of files to delete >> misc_output.txt 2>&1
type cleanup_all.txt >> misc_output.txt 2>&1
@ECHO File list done >> misc_output.txt 2>&1
FOR /F "usebackq" %%i IN (cleanup_all.txt) DO	( 
						IF EXIST %%i (del %%i >> misc_output.txt 2>&1)
						)

@ECHO dir AFTER Running Cleanup >> misc_output.txt 2>&1
dir >> misc_output.txt 2>&1

REM ###########################################################################################################################
REM # Verify all capture script files exist or exit.
REM ###########################################################################################################################

IF NOT EXIST 32_7z.exe @ECHO "32_7z.exe missing GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1
IF NOT EXIST 32_7z.dll @ECHO "32_7z.dll missing GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1
IF NOT EXIST 64_7z.exe @ECHO "64_7z.exe missing GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1
IF NOT EXIST 64_7z.dll @ECHO "64_7z.dll missing GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1
IF NOT EXIST 7z.exe @ECHO "7z.exe missing GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1
IF NOT EXIST 7z.dll @ECHO "7z.dll missing GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1
IF NOT EXIST %all_cli% @ECHO "%all_cli% missing GOTO NOT_A_VALID_CAPTURE_SCRIPT" >> misc_output.txt 2>&1

IF NOT EXIST 32_7z.exe (@ECHO 32_7z.exe missing GOTO NOT_A_VALID_CAPTURE_SCRIPT) >> misc_output.txt 2>&1
IF NOT EXIST 32_7z.dll (@ECHO 32_7z.dll missing GOTO NOT_A_VALID_CAPTURE_SCRIPT) >> misc_output.txt 2>&1
IF NOT EXIST 64_7z.exe (@ECHO 64_7z.exe missing GOTO NOT_A_VALID_CAPTURE_SCRIPT) >> misc_output.txt 2>&1
IF NOT EXIST 64_7z.dll (@ECHO 64_7z.dll missing GOTO NOT_A_VALID_CAPTURE_SCRIPT) >> misc_output.txt 2>&1
IF NOT EXIST 7z.exe (@ECHO 7z.exe missing GOTO NOT_A_VALID_CAPTURE_SCRIPT)
IF NOT EXIST 7z.dll (@ECHO 7z.dll missing GOTO NOT_A_VALID_CAPTURE_SCRIPT)
IF NOT EXIST %all_cli% (@ECHO %all_cli% missing GOTO NOT_A_VALID_CAPTURE_SCRIPT)



GOTO VALID_CAPTURE_SCRIPT

:NOT_A_VALID_CAPTURE_SCRIPT
REM   .......................................||.......................................
@ECHO .
@ECHO "lsigetwin -H" provides a help screen.
@ECHO .
@ECHO This is not a valid lsigetwin installation. This script is available at;
@ECHO .
@ECHO http://www.avagotech.com/support/knowledgebase/1211161499563/lsiget-data-capture-script
@ECHO .
@ECHO All files included in the original lsigetwin_xxx_xxxxxx.7z file MUST be kept
@ECHO in the same subdir as lsigetwin.bat.
@ECHO .
@ECHO .

REM   .......................................||.......................................
@ECHO ..........................:NOT_A_VALID_CAPTURE_SCRIPT........................... >> misc_output.txt 2>&1
@ECHO "dir >> misc_output.txt 2>&1" >> misc_output.txt 2>&1
dir >> misc_output.txt 2>&1

GOTO END

:VALID_CAPTURE_SCRIPT
REM ###########################################################################################################################
REM # Initialize Variables
REM ###########################################################################################################################
SET EXTRACTUTILS=NO
SET TWGETSKIPRECORDCAPTURE=NO
SET TWGETSKIPCOMPRESSION=NO
SET TWGETSKIPRECORDSORT=NO
SET TWGETSKIPWINDOWSREPORTING=NO
SET TWPRINTFILENAME=
SET TWGETDIRECTORYKEEP=NO
SET TWGETBATCHMODE=
SET TWGETPARTIALMODE=STANDARD
SET TWGETMONITORMODE=
SET TW_Help_Screen=
SET OLD_EVT_CAP_EXIST=
SET NEW_EVT_CAP_EXIST=
SET TWcomment=
SET TWver_name=
SET mtw_date=
SET mtw_year=
SET mtw_daymonth=
SET mtw_time=
SET TW-FN=
SET TW-WS=
SET tws1=
SET tws2=
SET tws3=
SET Continue_without_CLI=
SET NO_3Ware_Ctrls=YES

REM MRaid
SET Num_Mraid_Adapters=
SET NO_MR_Adps=YES
SET NO_NMR_Adps=
Set USEMEGACLISYNTAX=NO

REM HBA
SET NO_lsut_GEN1_HBAs=YES
SET NO_lsut_GEN2_HBAs=YES
SET NO_lsut_GEN3_HBAs=YES
SET NO_lsut_GEN4_HBAs=YES
SET NO_lsut_LSI_HBAs=
SET NO_scl_IOC=YES
SET NO_LSI_HBAs=
SET NO_GEN1_HBAs=YES
SET NO_GEN2_HBAs=YES
SET NO_GEN3_HBAs=YES
SET NO_GEN4_HBAs=YES
SET NO_GEN2-3_HBAs=YES
SET ENABLE_ALL_IOC_DEBUG=NO
SET NO_2ircu_HBAs=YES
SET NO_3ircu_HBAs=YES

REM Exps
SET NO_xu_GEN1_EXPs=YES
SET NO_xu_GEN2_EXPs=YES
SET NO_g3xu_GEN3_EXPs=YES
SET NO_g4xu_GEN4_EXPs=YES
SET NO_scl_EXP=YES

SET NO_scl_EXP-IOC=YES
SET NO_WDs=


REM ###########################################################################################################################
REM # Command Line Options
REM # Looking for comments that are not command line options.
REM # Only 1 comment allowed, lowest variable # wins.
REM ###########################################################################################################################
FOR /L %%i IN (1,1,20) DO (IF EXIST TWGETVARIABLE%%i del TWGETVARIABLE%%i)

@ECHO %1 > TWGETVARIABLE1
@ECHO %2 > TWGETVARIABLE2
@ECHO %3 > TWGETVARIABLE3
@ECHO %4 > TWGETVARIABLE4
@ECHO %5 > TWGETVARIABLE5
@ECHO %6 > TWGETVARIABLE6
@ECHO %7 > TWGETVARIABLE7
@ECHO %8 > TWGETVARIABLE8
@ECHO %9 > TWGETVARIABLE9
@ECHO %10 > TWGETVARIABLE10
@ECHO %11 > TWGETVARIABLE11
@ECHO %12 > TWGETVARIABLE12
@ECHO %13 > TWGETVARIABLE13
@ECHO %14 > TWGETVARIABLE14
@ECHO %15 > TWGETVARIABLE15
@ECHO %16 > TWGETVARIABLE16
@ECHO %17 > TWGETVARIABLE17
@ECHO %18 > TWGETVARIABLE18
@ECHO %19 > TWGETVARIABLE19
@ECHO %20 > TWGETVARIABLE20


%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE20 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%20
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE19 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%19
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE18 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%18
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE17 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%17
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE16 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%16
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE15 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%15
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE14 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%14
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE13 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%13
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE12 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%12
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE11 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%11
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE10 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%10
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE9 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%9
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE8 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%8
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE7 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%7
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE6 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%6
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE5 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%5
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE4 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%4
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE3 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%3
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE2 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%2
%grep% -i  -e "-EXT" -e "-M" -e "-P" -e "-D" -e "-B" -e "-Q" -e "-F1" -e "-F2" -e "-F3" -e "-F4" -e "-CS" -e "-UMS" -e "-SRC" -e "-SRS" -e "-SWR" -e "-SCDA" -e "-SMR" -e "-S3W" -e "-SHBA" -e "-SEXP" -e "-SC" -e "-E_AEC" -e "-E_DPM" -e "-E_AEC_DPM" -e "-G_AEC" -e "-G_DPM" -e "-G_AEC_DPM" -e "-SDS" -e "-H" TWGETVARIABLE1 >> misc_output.txt 2>&1
IF ERRORLEVEL 1 SET TWcomment=%1

FOR /L %%i IN (1,1,20) DO	(
				IF EXIST TWGETVARIABLE%%i	(
								@ECHO ######################TWGETVARIABLE%%i###################### >> misc_output.txt 2>&1
								type TWGETVARIABLE%%i >> misc_output.txt 2>&1
								del TWGETVARIABLE%%i >> misc_output.txt 2>&1	
								)
				)


REM Checking command line variables for options.
REM Competing options are not allowed.

for %%i in (%*) do	(
			IF /I [%%i]==[-P] SET TWPRINTFILENAME=YES
			IF /I [%%i]==[-D] SET TWGETDIRECTORYKEEP=YES
			IF /I [%%i]==[-Q] SET TWGETBATCHMODE=QUIET
			IF /I [%%i]==[-B] SET TWGETBATCHMODE=BATCH
			IF /I [%%i]==[-E_AEC] SET TWGETPARTIALMODE=E_AEC
			IF /I [%%i]==[-E_DPM] SET TWGETPARTIALMODE=E_DPM
			IF /I [%%i]==[-E_AEC_DPM] SET TWGETPARTIALMODE=E_AEC_DPM
			IF /I [%%i]==[-G_AEC] SET TWGETPARTIALMODE=G_AEC
			IF /I [%%i]==[-G_DPM] SET TWGETPARTIALMODE=G_DPM
			IF /I [%%i]==[-G_AEC_DPM] SET TWGETPARTIALMODE=G_AEC_DPM
			IF /I [%%i]==[-M] SET TWGETMONITORMODE=MONITOR
			IF /I [%%i]==[-H] SET TW_Help_Screen=YES
			IF /I [%%i]==[-UMS] SET USEMEGACLISYNTAX=YES
			IF /I [%%i]==[-EXT] SET EXTRACTUTILS=YES
			IF /I [%%i]==[-SDS] SET SDSSTORCLI=YES
REM			IF /I [%%i]==[-EAID] SET ENABLE_ALL_IOC_DEBUG=YES
			IF /I [%%i]==[-SRC] SET TWGETSKIPRECORDCAPTURE=YES
			IF /I [%%i]==[-SRC] SET TWGETSKIPRECORDSORT=YES
			IF /I [%%i]==[-SRS] SET TWGETSKIPRECORDSORT=YES
			IF /I [%%i]==[-SWR] SET TWGETSKIPWINDOWSREPORTING=YES
			IF /I [%%i]==[-SCDA] SET TWGETSKIPCDA=YES
			IF /I [%%i]==[-SMR] SET TWGETSKIPMEGARAID=YES
			IF /I [%%i]==[-S3W] SET TWGETSKIP3WARE=YES
			IF /I [%%i]==[-SHBA] SET TWGETSKIPHBA=YES
			IF /I [%%i]==[-SEXP] SET TWGETSKIPEXPANDER=YES
			IF /I [%%i]==[-SC] SET TWGETSKIPCOMPRESSION=YES

			IF /I [%%i]==[-F1] SET TWGETSKIPRECORDCAPTURE=YES
			IF /I [%%i]==[-F1] SET TWGETSKIPRECORDSORT=YES
			IF /I [%%i]==[-F1] SET TWGETSKIPWINDOWSREPORTING=YES

			IF /I [%%i]==[-F2] SET TWGETSKIPRECORDCAPTURE=YES
			IF /I [%%i]==[-F2] SET TWGETSKIPRECORDSORT=YES
			IF /I [%%i]==[-F2] SET TWGETSKIPCDA=YES

			IF /I [%%i]==[-F3] SET TWGETSKIPRECORDCAPTURE=YES
			IF /I [%%i]==[-F3] SET TWGETSKIPRECORDSORT=YES
			IF /I [%%i]==[-F3] SET TWGETSKIPWINDOWSREPORTING=YES
			IF /I [%%i]==[-F3] SET TWGETSKIPCDA=YES

			IF /I [%%i]==[-F4] SET TWGETSKIPRECORDCAPTURE=YES
			IF /I [%%i]==[-F4] SET TWGETSKIPRECORDSORT=YES
			IF /I [%%i]==[-F4] SET TWGETSKIPWINDOWSREPORTING=YES
			IF /I [%%i]==[-F4] SET TWGETSKIPCDA=YES
			IF /I [%%i]==[-F4] SET TWGETSKIPCOMPRESSION=YES
			)



REM ###########################################################################################################################
REM # Option Override
REM ###########################################################################################################################

IF [%TWGETPARTIALMODE%]==[E_AEC] SET TWGETMONITORMODE=
IF [%TWGETPARTIALMODE%]==[E_DPM] SET TWGETMONITORMODE=
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] SET TWGETMONITORMODE=
IF [%TWGETPARTIALMODE%]==[G_AEC] SET TWGETMONITORMODE=
IF [%TWGETPARTIALMODE%]==[G_DPM] SET TWGETMONITORMODE=
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] SET TWGETMONITORMODE=

IF [%TWGETPARTIALMODE%]==[E_AEC] SET USEMEGACLISYNTAX=NO
IF [%TWGETPARTIALMODE%]==[E_DPM] SET USEMEGACLISYNTAX=NO
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] SET USEMEGACLISYNTAX=NO
IF [%TWGETPARTIALMODE%]==[G_AEC] SET USEMEGACLISYNTAX=NO
IF [%TWGETPARTIALMODE%]==[G_DPM] SET USEMEGACLISYNTAX=NO
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] SET USEMEGACLISYNTAX=NO

IF [%EXTRACTUTILS%]==[YES] SET TWGETMONITORMODE=
IF [%EXTRACTUTILS%]==[YES] SET USEMEGACLISYNTAX=NO
IF [%EXTRACTUTILS%]==[YES] SET TWPRINTFILENAME=NO
IF [%EXTRACTUTILS%]==[YES] SET TWGETDIRECTORYKEEP=NO
IF [%EXTRACTUTILS%]==[YES] SET TWGETBATCHMODE=BATCH
IF [%EXTRACTUTILS%]==[YES] SET TW_Help_Screen=NO

IF NOT [%TWGETDIRECTORYKEEP%]==[YES]	(
					IF [%TWGETSKIPCOMPRESSION%]==[YES]	(
										@ECHO .
										@ECHO You can't skip compression without keeping the directory...						
 										@ECHO The -D parameter has been enabled...
										SET TWGETDIRECTORYKEEP=YES
										)
					)						


REM   .......................................||.......................................
@ECHO .............................Initial Variables SET.............................. >> misc_output.txt 2>&1
@ECHO "SET >> misc_output.txt 2>&1" >> misc_output.txt 2>&1
SET >> misc_output.txt 2>&1



REM ###########################################################################################################################
REM # Help Screen
REM ###########################################################################################################################

IF [%TW_Help_Screen%]==[YES] (GOTO Help_Screen) ELSE GOTO No_Help_Screen

:Help_Screen 
REM   .......................................||.......................................
@ECHO .
@ECHO LSI HBA/MegaRAID/3ware Data Collection Script for Win 2K - Win16.
@ECHO This script will collect system logs and info as well as controller, disk and 
@ECHO enclosure info for debugging purposes. All files included in the original 
@ECHO lsigetwin_xxxxxx.7z/zip file MUST be kept in the same subdir as lsigetwin.bat.
@ECHO This script MUST be run from its own subdir, NOT pathed.
@ECHO .
@ECHO You MUST be an Administrator/have Admin rights to run this script. The latest
@ECHO version of this script can be found at;
@ECHO .
@ECHO http://www.avagotech.com/support/knowledgebase/1211161499563/lsiget-data-capture-script
@ECHO .
@ECHO OR
@ECHO .
@ECHO ftp0.broadcom.com
@ECHO User:tsupport
@ECHO Password:tsupport
@ECHO /outgoing_perm/CaptureScripts  
@ECHO /outgoing_perm/CaptureScripts/BETA  (Latest)
@ECHO .
REM   .......................................||.......................................
@ECHO To automatically get the latest script you can download the following file and 
@ECHO grep for the current latest file. This ensures support will always have access
@ECHO to the latest data to speed up the support process.
@ECHO .
@ECHO This is an example and not the latest versions.
@ECHO .
@ECHO /outgoing_perm/CaptureScripts/Latest_Script_Versions.txt
@ECHO #Used for automated remote script updates
@ECHO LatestFreebsd#lsigetfreebsd_xxxxxx.tgz
@ECHO LatestLinux#lsigetlinux_ddmmyy.tgz
@ECHO LatestLunix#lsigetlunix_ddmmyy.tgz
@ECHO LatestMacOS#lsigetmacos_ddmmyy.tgz
@ECHO LatestSolaris#lsigetsolaris_ddmmyy.tgz
@ECHO LatestWin#lsigetwin_ddmmyy.7z
@ECHO .
@ECHO Command Line Options:
@ECHO lsigetwin [Comment] [Option(s)]		
@ECHO Comment: Enclose noncontiguous strings in double quotes "My Comments" 
@ECHO Option: 
@ECHO -UMS		= Use MegaCli Syntax in addition to native storcli syntax.
@ECHO -EXT		= EXTRACT - Extracts all available utilities for use.
@ECHO -P		= PRINT filename in .\LSICAPTUREFILES.TXT for scripting.
@ECHO -D		= Working DIRECTORY is not deleted.
@ECHO -Q		= QUIET Mode - No keystrokes required unless error.
@ECHO -B		= BATCH Mode - No keystrokes required.
@ECHO -E_AEC		= Clear and ENABLE AEC.
@ECHO -E_DPM		= Clear and ENABLE DPMSTAT.
@ECHO -E_AEC_DPM	= Clear and ENABLE AEC and DPMSTAT.
@ECHO -G_AEC		= Disable and GET AEC Logs.
@ECHO -G_DPM		= Disable and GET DPMSTAT Logs.
@ECHO -G_AEC_DPM	= Disable and GET AEC and DPMSTAT Logs.
@ECHO -M		= MONITOR Mode - Standard capture, daily/targeted logging.
@ECHO -SDS		= Use the BETA storcli 2.03.00 for SDS support.
@ECHO -H		= This Help Screen.
@ECHO .
@ECHO The following command line options are NOT standard and may be detrimental 
@ECHO to a root cause analysis of your issue. Used for repetitive data collection
@ECHO and script debugging, these are fluid and may change.
REM   .......................................||.......................................
@ECHO .
@ECHO -SRS		= Skip MegaRAID AEN Record Sort, NOT standard.
@ECHO -SRC		= Skip MegaRAID AEN Record Capture and Sort, NOT standard.
@ECHO -SWR		= Skip Windows Reporting (MSINFO32), NOT standard.
@ECHO -SCDA		= Skip Controller Disk Association, NOT standard.
@ECHO -SMR		= Skip MegaRAID DATA Capture, NOT standard.
@ECHO -S3W		= Skip 3Ware DATA Capture, NOT standard.
@ECHO -SHBA		= Skip HBA DATA Capture, NOT standard.
@ECHO -SEXP		= Skip Expander DATA Capture, NOT standard.
@ECHO -SC		= Skip Compression of output subdirectory, NOT standard.
@ECHO -F1		= FAST-1, combines -SRC/-SWR, NOT standard.
@ECHO -F2		= FAST-2, combines -SRC/-SCDA, NOT standard.
@ECHO -F3		= FAST-3, combines -SRC/-SWR/-SCDA, NOT standard.
@ECHO -F4		= FAST-4, combines -SRC/-SWR/-SCDA/-SC, NOT standard.
@ECHO .
@ECHO Example; lsigetwin -D -Q "This is my comment"
@ECHO Runs the standard script leaving the working directory, without prompts 
@ECHO and leaves a comment.
@ECHO .
@ECHO Example; lsigetwin -Q "This is my comment" -D -M 
@ECHO Runs the standard script leaving the working directory, without prompts 
@ECHO and leaves a comment, once done the script stays resident in Monitor Mode.
@ECHO .
@ECHO Notes: 
@ECHO Send "JUST" the created .7z file to your support rep. 
@ECHO The file is PASSWORD Protected to get through the Broadcom firewall. 
@ECHO Password=broadcom
@ECHO .
@ECHO SDS = Will force the use of the Beta storcli that supports SDS mode.
@ECHO If the "storcli show" command output contains SDS this version will be used 
@ECHO anyway.
@ECHO .
@ECHO EXT = EXTRACT - All of the embedded utilities that are in the pertinent 
@ECHO capture script are extracted without the actual capture script running.
@ECHO The architecture specific (32/64bit) specific Broadcom utilities such as
@ECHO storcli/sas3ircu/etc. are all copied to the root of the capture script subdir.
@ECHO All third party utilities are copied to that root\Utils, i.e. grep/sg_scan/etc.
@ECHO After each script run, Broadcom utilities without a device are copied to the 
@ECHO Utils subdir. On EACH run the Utils subdir is deleted.
@ECHO .
@ECHO AEC = Advanced Event Capture - This is an unreleased INTERNAL option. 
@ECHO Do NOT use AEC without being directed to by Technical Support or an FAE.
@ECHO .
@ECHO DPMSTAT = Disk Performance Monitoring Statistics - Captures performance
@ECHO related information on a controller/disk basis. Detailed information can 
@ECHO found in the 3Ware and MegaRAID Users Guides available at;
@ECHO .
@ECHO http://www.broadcom.com
@ECHO .
REM   .......................................||.......................................
@ECHO All of the -G_* "GET" Options are done automatically if AEC or DPMSTAT was
@ECHO enabled previously with the -E_* "ENABLE" options by default. The -G_* 
@ECHO options are meant for quick repetitive results without getting other system
@ECHO information. Normally you should run the standard lsigetwin.bat file without
@ECHO a -G_* option to provide as much info as possible.
@ECHO .
@ECHO If there are competing comments the lowest variable number wins.
@ECHO If there are contradictory options the lowest variable number with the
@ECHO option order listed in the help wins. Valid combinations would be;
@ECHO -D or -D with -B or -Q any -E_* or -G_* option by itself or in conjunction
@ECHO with a -D and -B/-Q option. -E_* is allowed with -D but has no effect as 
@ECHO there is no working directory created.
@ECHO .
REM   .......................................||.......................................
@ECHO Monitor Mode - 3Ware only. Runs the standard capture script and then remains 
@ECHO resident, logging "show diag" approx. every 24 hours and also monitors for three 
@ECHO specific AEN's (Controller Reset/Degraded Array/Rebuild Started). If any
@ECHO of these are encountered a final "show diag" will be done and the script 
@ECHO will finish normally. Use to capture the internal printlog/buf prior to
@ECHO the buffer being overwritten. Not allowed in conjunction with any -E_*/-G_* 
@ECHO or -EXT option.
@ECHO .
@ECHO Recomended CodeSet/Release Versions - Latest always recomended.
@ECHO .
@ECHO 3ware-
@ECHO .
REM   .......................................||.......................................
@ECHO This script should run with any release after 7.6.0 on the 7k, 8k 
@ECHO and 9k family of controllers. 
@ECHO .
REM   .......................................||.......................................
@ECHO MegaRAID -
@ECHO .
REM   .......................................||.......................................
@ECHO This script should run with any release after 3.1 on the 82xx, 83xx, 84xx, 87xx, 
@ECHO 88xx, 92xx and 93xx family of controllers. 
@ECHO .
@ECHO HBA -
@ECHO .
@ECHO This script should run with any HBA using the symmpi, lsi_sas, lsi_sas2,
@ECHO lsi_gen2 or lsi_sas3 driver.
@ECHO .
@ECHO Trouble Shooting - 
@ECHO .
@ECHO 1Q. Script appears to hang
@ECHO 1A. Dont enable Quick Edit mode. Also command windows have been seen to go to 
@ECHO sleep after a while (20-30 Minutes), hit return in the window to wake up.
@ECHO .
@ECHO .
@ECHO Capture Script Version: %LSIGETWINVER%
@ECHO .

GOTO END_No_Pause

:No_Help_Screen


IF [%TWGETBATCHMODE%]==[BATCH] GOTO comment
IF [%TWGETBATCHMODE%]==[QUIET] GOTO comment
IF [%all_cli%]==[all_cli] GOTO SKIPALL_CLII
REM   .......................................||.......................................
@ECHO .
@ECHO This is an Internal/OEM/Partner version of lsiget. This script contains 
@ECHO utilities that require a BCLA. This script is only to be distributed by
@ECHO Broadcom FAE's/Engineering to appropriately licensed customers or for INTERNAL
@ECHO use.
:SKIPALL_CLII
@ECHO .
@ECHO Its recommended to disable "QuickEdit Mode" on any Command/Power Shell Window
@ECHO that this script is run in under Properties/Options. Otherwise if you click in
@ECHO the Window you can get stuck in "Select" mode and the script will stop. If
@ECHO this happens you can hit return in the Window.
REM No Comment doesnt generate pause anymore.
IF [%TWcomment%]==[] (GOTO no_comment) ELSE GOTO comment

REM ###########################################################################################################################
REM # Script not paused regardless of comment
REM ###########################################################################################################################
:no_comment
IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO E_FROM_COMMENT
IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO E_FROM_COMMENT
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO E_FROM_COMMENT
IF [%EXTRACTUTILS%]==[YES] GOTO E_FROM_COMMENT
REM   .......................................||.......................................
@ECHO .
@ECHO "lsigetwin -H" provides a help screen.
@ECHO .
@ECHO To associate a user comment with this data capture session pass the
@ECHO comment as a variable. 
@ECHO .						  
@ECHO Example;
@ECHO lsigetwin "Case 123456-123456789 - performance problems after upgrade"   
@ECHO .
@ECHO NOTE: Noncontiguous strings must be in double quotes "My Comments". 	  
@ECHO .
@ECHO .
@ECHO Hit CTRL-C to abort and use a comment or DO NOTHING TO CONTINUE...
REM PAUSE
:comment

REM ###########################################################################################################################
REM # reg test
REM ###########################################################################################################################

@ECHO Test if reg is present >> misc_output.txt 2>&1
reg /?  >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 (SET HAVE_REG=YES) ELSE SET HAVE_REG=NO

REM ###########################################################################################################################
REM # Windows Version Check
REM ###########################################################################################################################

SET TWver_name=OS_Unknown

Ver | find "[Version 10.0.14393]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0    (
            SET TWver_name=Win16DC
            GOTO HAVE_VER
            )

ver | find "[Version 10.0.16229]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win10PE
			GOTO HAVE_VER
			)

ver | find "[Version 10.0.15063]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win10Pro
			GOTO HAVE_VER
			)

ver | find "[Version 10.0.14267]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win16TP4
			GOTO HAVE_VER
			)

ver | find "[Version 10.0.10586]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win10U
			GOTO HAVE_VER
			)

ver | find "[Version 10.0.10240]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win10
			GOTO HAVE_VER
			)

ver | find "[Version 6.3.9431]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win2k12R2DCP
			GOTO HAVE_VER
			)

ver | find "[Version 6.3.9600]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win2k12R2
			GOTO HAVE_VER
			)

ver | find "[Version 6.3.9200]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win2k12R2
			GOTO HAVE_VER
			)

ver | find "[Version 6.2.9200]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win2k12
			GOTO HAVE_VER
			)

ver | find "[Version 6.1.7601]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=Win7SP1
			GOTO HAVE_VER
			)

ver | find "[Version 6.1.7600]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=Win7
			GOTO HAVE_VER
			)

ver | find "[Version 6.1.7100]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0	(
			SET TWver_name=Win7RC1
			GOTO HAVE_VER
			)	

ver | find "[Version 6.1.7000]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=Win7beta64
			GOTO HAVE_VER
			)

ver | find "[Version 6.1.6801]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=Win7beta2
			GOTO HAVE_VER
			)

ver | find "[Version 6.1.6519]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=Win7beta1
			GOTO HAVE_VER
			)

ver | find "[Version 6.0.6002]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=VSP2_W2k8SP2
			GOTO HAVE_VER
			)

ver | find "[Version 6.0.6001]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=VSP1_W2k8
		  	GOTO HAVE_VER
			)

ver | find "[Version 6.0.6000]" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=Vista
			GOTO HAVE_VER
			)

ver | find "Version 5.2.3790" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=Win2k3SP2
			GOTO HAVE_VER
			)

ver | find "2003" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=Win2k3
			GOTO HAVE_VER
			)

ver | find "XP" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=WinXP
			GOTO HAVE_VER
			)	

ver | find "2000" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=Win2k
			GOTO HAVE_VER
			)	

ver | find "NT" >> misc_output.txt 2>&1
IF %ERRORLEVEL% == 0 	(
			SET TWver_name=WinNT
			GOTO HAVE_VER
			)


:HAVE_VER

@ECHO At the HAVE_VER point >> misc_output.txt 2>&1
@ECHO %TWver_name% >> misc_output.txt 2>&1

:E_FROM_COMMENT

REM ###########################################################################################################################
REM # Extract Files
REM ###########################################################################################################################
@ECHO dir Prior to main file extraction >> misc_output.txt 2>&1
dir >> misc_output.txt 2>&1
@ECHO dir Utils Prior to main file extraction >> misc_output.txt 2>&1
dir Utils >> misc_output.txt 2>&1

7z e -y %all_cli% >> misc_output.txt 2>&1
IF [%NOWOW64%]==[YES] del timer.exe >> misc_output.txt 2>&1
IF [%NOWOW64%]==[YES] del xdir.exe >> misc_output.txt 2>&1
move /Y Sense-Key_ASC-ASCQ_Opcodes_ATA-Command_Codes-Set_Features_Code.txt Utils >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (7z x -y pciutils-3.2.1_32.7z >> misc_output.txt 2>&1) ELSE 7z x -y pciutils-3.2.1_64.7z >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (move /Y pciutils-3.2.1_32 Utils >> misc_output.txt 2>&1) ELSE move /Y pciutils-3.2.1_64 Utils >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Utils\pciutils-3.2.1_32\lspci.exe Utils >> misc_output.txt 2>&1) ELSE copy Utils\pciutils-3.2.1_64\lspci.exe Utils >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Utils\pciutils-3.2.1_32\pci.ids Utils >> misc_output.txt 2>&1) ELSE copy Utils\pciutils-3.2.1_64\pci.ids Utils >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Utils\pciutils-3.2.1_32\*.dll Utils >> misc_output.txt 2>&1) ELSE copy Utils\pciutils-3.2.1_64\*.dll Utils >> misc_output.txt 2>&1
SET lspci=Utils\lspci
IF %PROCESSOR_ARCHITECTURE% == x86 (7z x -y sg3_utils-1.42_32.7z >> misc_output.txt 2>&1) ELSE 7z x -y sg3_utils-1.42_64.7z >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (move /Y sg3_utils-1.42_32 Utils >> misc_output.txt 2>&1) ELSE move /Y sg3_utils-1.42_64 Utils >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Utils\sg3_utils-1.42_32\sg_scan.exe Utils >> misc_output.txt 2>&1) ELSE copy Utils\sg3_utils-1.42_64\sg_scan.exe Utils >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Utils\sg3_utils-1.42_32\sg_vpd.exe Utils >> misc_output.txt 2>&1) ELSE copy Utils\sg3_utils-1.42_64\sg_vpd.exe Utils >> misc_output.txt 2>&1
SET sg_scan=Utils\sg_scan
SET sg_vpd=Utils\sg_vpd
IF EXIST pciutils-3.2.1_32 rmdir pciutils-3.2.1_32 /S /Q  >> misc_output.txt 2>&1
IF EXIST pciutils-3.2.1_64 rmdir pciutils-3.2.1_64 /S /Q  >> misc_output.txt 2>&1
IF EXIST sg3_utils-1.42_32 rmdir sg3_utils-1.42_32 /S /Q  >> misc_output.txt 2>&1
IF EXIST sg3_utils-1.42_64 rmdir sg3_utils-1.42_64 /S /Q  >> misc_output.txt 2>&1



REM ###########################################################################################################################
REM # Rename HBA utils
REM ###########################################################################################################################
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Win_sas2ircu.32 sas2ircu.exe >> misc_output.txt 2>&1) ELSE copy Win_sas2ircu.64 sas2ircu.exe >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Win_sas3ircu.32 sas3ircu.exe >> misc_output.txt 2>&1) ELSE copy Win_sas3ircu.64 sas3ircu.exe >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Win_sasflash.32 sasflash.exe >> misc_output.txt 2>&1) ELSE copy Win_sasflash.64 sasflash.exe >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Win_sas2flash.32 sas2flash.exe >> misc_output.txt 2>&1) ELSE copy Win_sas2flash.64 sas2flash.exe >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy Win_sas3flash.32 sas3flash.exe >> misc_output.txt 2>&1) ELSE copy Win_sas3flash.64 sas3flash.exe >> misc_output.txt 2>&1

REM ###########################################################################################################################
REM # Test 3ware cli
REM ###########################################################################################################################

IF EXIST tw_cli.exe del tw_cli.exe >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy tw_cli.32 tw_cli.exe >> misc_output.txt 2>&1) ELSE copy tw_cli.64 tw_cli.exe >> misc_output.txt 2>&1

@ECHO tw_cli show >> misc_output.txt 2>&1
tw_cli show > Valid_controller_test.txt 2>&1
@ECHO type Valid_controller_test.txt  >> misc_output.txt 2>&1
type Valid_controller_test.txt  >> misc_output.txt 2>&1

%grep% "No controller found" Valid_controller_test.txt >> misc_output.txt 2>&1
IF NOT ERRORLEVEL 1 (SET NO_3Ware_Ctrls=YES) ELSE SET NO_3Ware_Ctrls=NO
IF [%NO_3Ware_Ctrls%]==[YES] SET NO_3WARE_VDs=YES


REM ###########################################################################################################################
REM # tw_devcon arch check
REM ###########################################################################################################################
IF EXIST tw_devcon.exe del tw_devcon.exe >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy tw_devcon.32 tw_devcon.exe >> misc_output.txt 2>&1) ELSE copy tw_devcon.64 tw_devcon.exe >> misc_output.txt 2>&1
IF EXIST DIFxAPI.dll del DIFxAPI.dll >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy DIFxAPI.32 DIFxAPI.dll >> misc_output.txt 2>&1) ELSE copy DIFxAPI.64 DIFxAPI.dll >> misc_output.txt 2>&1

REM ###########################################################################################################################
REM # Test lsut - 64 bit hanging on option 42, ONLY 32 bit version used on option 42
REM ###########################################################################################################################

IF EXIST lsut.exe del lsut.exe >> misc_output.txt 2>&1

@ECHO dir lsut.* >> misc_output.txt 2>&1
dir lsut.* >> misc_output.txt 2>&1

REM 64bit version has issues
@ECHO PROCESSOR_ARCHITECTURE Test >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (copy lsut.32 lsut.exe >> misc_output.txt 2>&1) ELSE copy lsut.64 lsut.exe >> misc_output.txt 2>&1

REM Option 42 crashes on 64 bit
copy lsut.32 32_lsut.exe >> misc_output.txt 2>&1

@ECHO dir lsut.* >> misc_output.txt 2>&1
dir lsut.* >> misc_output.txt 2>&1

@ECHO lsut 0 >> misc_output.txt 2>&1
lsut 0 > Valid_hba_test.txt 2>&1
@ECHO type Valid_hba_test.txt >> misc_output.txt 2>&1
type Valid_hba_test.txt >> misc_output.txt 2>&1

@ECHO %grep% Chip Vendor Valid_hba_test.txt >> misc_output.txt 2>&1
@ECHO LSI HBA Test >> misc_output.txt 2>&1
%grep% "Chip Vendor" Valid_hba_test.txt >> misc_output.txt 2>&1
IF NOT %ERRORLEVEL%==0 (SET NO_lsut_LSI_HBAs=YES) ELSE SET NO_lsut_LSI_HBAs=NO

REM ###########################################################################################################################
REM # Test g3xu
REM ###########################################################################################################################

IF NOT %PROCESSOR_ARCHITECTURE% == x86 (IF EXIST cub_g3xu.64 move /Y cub_g3xu.64 cub_g3xu.exe >> misc_output.txt 2>&1)
IF EXIST cub_g3xu.exe cub_g3xu.exe -i get avail | %grep% SAS_35X >> misc_output.txt 2>&1
IF NOT ERRORLEVEL 1	(
			move /Y cub_g3xu.exe g3xu.64 >> misc_output.txt 2>&1
			@ECHO .
			@ECHO Beta Cub g3xutil is being used...
			@ECHO Beta Cub g3xutil is being used... >> misc_output.txt 2>&1 
			)



IF EXIST cub_g3xu.64 del cub_g3xu.64 >> misc_output.txt 2>&1
IF EXIST cub_g3xu.exe del cub_g3xu.exe >> misc_output.txt 2>&1				

IF %PROCESSOR_ARCHITECTURE% == x86 (copy g3xu.32 g3xu.exe >> misc_output.txt 2>&1) ELSE copy g3xu.64 g3xu.exe >> misc_output.txt 2>&1



REM ###########################################################################################################################
REM # Test scl 
REM ###########################################################################################################################
IF %PROCESSOR_ARCHITECTURE% == x86 (copy cub_scl.32 cub_scl.exe >> misc_output.txt 2>&1) ELSE copy cub_scl.64 cub_scl.exe >> misc_output.txt 2>&1
IF EXIST cub_scl --list | %grep% SAS35x >> misc_output.txt 2>&1
IF NOT ERRORLEVEL 1 	(
			move /Y cub_scl.32 scl.32 >> misc_output.txt 2>&1 
			move /Y cub_scl.64 scl.64 >> misc_output.txt 2>&1 
			del cub_scl.exe >> misc_output.txt 2>&1 
			@ECHO .
			@ECHO scli is being used...
			@ECHO scli is being used... >> misc_output.txt 2>&1 
			)

IF %PROCESSOR_ARCHITECTURE% == x86 (copy scl.32 scl.exe >> misc_output.txt 2>&1) ELSE copy scl.64 scl.exe >> misc_output.txt 2>&1
scl --list >> misc_output.txt 2>&1
IF NOT ERRORLEVEL 1 SET NO_scl_EXP-IOC=NO

REM ###########################################################################################################################
REM # Test MegaRAID cli 
REM ###########################################################################################################################

IF %PROCESSOR_ARCHITECTURE% == x86 (copy SDS_Win_storcli.exe storcli.exe >> misc_output.txt 2>&1) ELSE copy SDS_Win_storcli64.exe storcli64.exe >> misc_output.txt 2>&1
IF %PROCESSOR_ARCHITECTURE% == x86 (SET MR_Cli=storcli.exe) ELSE SET MR_Cli=storcli64.exe >> misc_output.txt 2>&1
%MR_Cli% show | %grep% SDS >> misc_output.txt 2>&1
IF NOT ERRORLEVEL 1 SET SDSSTORCLI=YES



IF EXIST storcli.exe del storcli.exe >> misc_output.txt 2>&1
IF EXIST storcli64.exe del storcli64.exe >> misc_output.txt 2>&1
IF EXIST storelibir-2.dll del storelibir-2.dll >> misc_output.txt 2>&1


IF [%SDSSTORCLI%]==[YES]	(
				@ECHO .
				@ECHO SDS Beta storcli is being used...
				@ECHO SDS Beta storcli is being used... >> misc_output.txt 2>&1 
				IF %PROCESSOR_ARCHITECTURE% == x86 (copy SDS_Win_storcli.exe storcli.exe >> misc_output.txt 2>&1) ELSE copy SDS_Win_storcli64.exe storcli64.exe >> misc_output.txt 2>&1
				IF %PROCESSOR_ARCHITECTURE% == x86 (copy storelibir-2.32 storelibir-2.dll >> misc_output.txt 2>&1) ELSE copy storelibir-2.64 storelibir-2.dll >> misc_output.txt 2>&1
				IF %PROCESSOR_ARCHITECTURE% == x86 (SET MR_Cli=storcli.exe) ELSE SET MR_Cli=storcli64.exe >> misc_output.txt 2>&1
				)
IF NOT [%SDSSTORCLI%]==[YES]	(
				IF %PROCESSOR_ARCHITECTURE% == x86 (copy Win_storcli.exe storcli.exe >> misc_output.txt 2>&1) ELSE copy Win_storcli64.exe storcli64.exe >> misc_output.txt 2>&1
				IF %PROCESSOR_ARCHITECTURE% == x86 (copy storelibir-2.32 storelibir-2.dll >> misc_output.txt 2>&1) ELSE copy storelibir-2.64 storelibir-2.dll >> misc_output.txt 2>&1
				IF %PROCESSOR_ARCHITECTURE% == x86 (SET MR_Cli=storcli.exe) ELSE SET MR_Cli=storcli64.exe >> misc_output.txt 2>&1
				)


@ECHO dir AFTER the main file extraction >> misc_output.txt 2>&1
dir >> misc_output.txt 2>&1
@ECHO dir Utils AFTER the main file extraction >> misc_output.txt 2>&1
dir Utils >> misc_output.txt 2>&1
@ECHO SET AFTER the main file extraction >> misc_output.txt 2>&1
SET >> misc_output.txt 2>&1


REM ###########################################################################################################################
REM # MegaCli SYNTAX - create adp_nums.txt, gets copied to script_workspace later...
REM ###########################################################################################################################

IF [%USEMEGACLISYNTAX%]==[NO]	GOTO SKIP_USEMEGACLISYNTAX1
				@ECHO "%MR_Cli% adpcount nolog > adpcount.txt" >> misc_output.txt 2>&1
				%MR_Cli% adpcount nolog > adpcount.txt
				@ECHO "type adpcount.txt >> misc_output.txt 2>&1" >> misc_output.txt 2>&1
				%grep% Controller adpcount.txt > adpcount_1.txt
				FOR /F "tokens=3 delims=. " %%i in (adpcount_1.txt) DO (@ECHO %%i >> num_mraid_adapters.txt)
				
				IF EXIST num_mraid_adapters.txt ( FOR /F "tokens=1" %%i in (num_mraid_adapters.txt) DO (SET Num_Mraid_Adapters=%%i) )
				FOR /L %%i IN (0,1,15) DO ( IF %%i LSS %Num_Mraid_Adapters% @ECHO %%i >> adp_nums.txt )
				
				
				IF NOT EXIST adp_nums.txt (SET NO_MR_Adps=YES) ELSE SET NO_MR_Adps=NO
:SKIP_USEMEGACLISYNTAX1
				
REM ###########################################################################################################################
REM # storcli SYNTAX - create mr_ctrl_nums.txt, gets copied to script_workspace later...
REM ###########################################################################################################################

@ECHO "%MR_Cli% /call show | %grep% "Controller = " > pre_mr_ctrl_nums.txt 2>&1" >> misc_output.txt 2>&1
%MR_Cli% /call show | %grep% "Controller = " > pre_mr_ctrl_nums.txt 2>&1
@ECHO "type pre_mr_ctrl_nums.txt >> misc_output.txt 2>&1"  >> misc_output.txt 2>&1
type pre_mr_ctrl_nums.txt >> misc_output.txt 2>&1

FOR /F "tokens=2 delims== " %%i in (pre_mr_ctrl_nums.txt) DO (@ECHO %%i >> mr_ctrl_nums.txt)

IF NOT EXIST mr_ctrl_nums.txt (SET NO_MR_Adps=YES) ELSE SET NO_MR_Adps=NO
IF NOT EXIST mr_ctrl_nums.txt (SET NO_NMR_Adps=YES) ELSE SET NO_NMR_Adps=NO


REM ###########################################################################################################################
REM # Test ddcli
REM ###########################################################################################################################

IF EXIST dcli.exe del dcli.exe >> misc_output.txt 2>&1
REM Only 32-bit version of ddoemcli is available
copy Win_dcli.exe dcli.exe >> misc_output.txt 2>&1

dcli -listall > Valid_wd_test.txt  2>&1

%grep% "No controllers found." Valid_wd_test.txt >> misc_output.txt 2>&1
IF %ERRORLEVEL%==0 SET NO_WDs=YES


REM ###########################################################################################################################

IF NOT EXIST tempfiles	(
			IF [%EXTRACTUTILS%]==[YES]	( 
							@ECHO .
							@ECHO Utilities extracted...
							@ECHO .
							)
			)
IF EXIST tempfiles	(
			move /Y tempfiles tempfiles.bat >> misc_output.txt 2>&1
			call tempfiles.bat
			del tempfiles.bat >> misc_output.txt 2>&1
			)
REM Initial @ECHO statement overridden on call statement.
REM @ECHO ON

IF [%EXTRACTUTILS%]==[YES] (GOTO END_No_Pause)

IF NOT [%NO_lsut_LSI_HBAs%]==[YES] GOTO Continue_with_CLI
IF NOT [%NO_LSI_HBAs%]==[YES] GOTO Continue_with_CLI

IF [%NO_3Ware_Ctrls%]==[YES] ( IF [%NO_MR_Adps%]==[YES] GOTO NO_CLI_DRV_ETC )

GOTO Continue_with_CLI
REM ###########################################################################################################################
REM # TW_CLI not valid, no driver, controllers, etc.
REM ###########################################################################################################################

:NO_CLI_DRV_ETC
IF [%TWGETBATCHMODE%]==[BATCH] GOTO Continue_without_CLI
REM   .......................................||.......................................
@ECHO ...............................:NO_CLI_DRV_ETC.................................. >> misc_output.txt 2>&1
@ECHO "dir >> misc_output.txt 2>&1" >> misc_output.txt 2>&1
dir >> misc_output.txt 2>&1
IF EXIST cleanup_all.txt	(
				FOR /F "usebackq" %%i IN (cleanup_all.txt) DO	( 
										@ECHO "IF EXIST %%i del %%i >> misc_output.txt 2>&1"  >> misc_output.txt 2>&1
										IF EXIST %%i del %%i >> misc_output.txt 2>&1
										@ECHO "dir >> misc_output.txt 2>&1" >> misc_output.txt 2>&1
										dir >> misc_output.txt 2>&1	
										)
				)

REM   .......................................||.......................................
@ECHO ................................................................................
@ECHO ####### No 3Ware or MegaRAID Raid Controllers or LSI HBAs are installed ########
@ECHO ##################################### OR #######################################
@ECHO ###### You do not have root privileges which is required to run the CLIs #######
@ECHO .
@ECHO "lsigetwin -H" provides a help screen.
@ECHO .
IF [%TWGETBATCHMODE%]==[BATCH] GOTO Continue_without_CLI
@ECHO Hit CTRL-C to abort or ENTER to continue data collection without CLI support.
@ECHO .
PAUSE

:Continue_without_CLI
:Continue_with_CLI

REM ###########################################################################################################################
REM # Extract Files again may have been deleted
REM ###########################################################################################################################
7z e -y %all_cli% >> misc_output.txt 2>&1
move /Y Sense-Key_ASC-ASCQ_Opcodes_ATA-Command_Codes-Set_Features_Code.txt Utils >> misc_output.txt 2>&1

REM ###########################################################################################################################

IF [%NO_3Ware_Ctrls%]==[YES]	(
				IF [%TWGETMONITORMODE%]==[MONITOR]	(
									SET TWGETMONITORMODE=
									REM   .......................................||.......................................
									@ECHO .
									@ECHO The command line switch
									@ECHO -M 
									@ECHO can ONLY be used if a 3Ware controller is installed...
									@ECHO Ignoring option: "-M"
					
									@ECHO The command line switch >> misc_output.txt 2>&1
									@ECHO -M >> misc_output.txt 2>&1
									@ECHO can ONLY be used if a 3Ware controller is installed... >> misc_output.txt 2>&1
									@ECHO Ignoring option: "-M" >> misc_output.txt 2>&1
									)		
				)
				

IF [%NO_3Ware_Ctrls%]==[YES]	(
				IF [%NO_MR_Adps%]==[YES]	(
								IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO IF_NO_3Ware_or_MR-No_AEC_or_DPMSTAT
								IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO IF_NO_3Ware_or_MR-No_AEC_or_DPMSTAT
								IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO IF_NO_3Ware_or_MR-No_AEC_or_DPMSTAT
								IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO IF_NO_3Ware_or_MR-No_AEC_or_DPMSTAT
								IF [%TWGETPARTIALMODE%]==[G_DPM] GOTO IF_NO_3Ware_or_MR-No_AEC_or_DPMSTAT
								IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] GOTO IF_NO_3Ware_or_MR-No_AEC_or_DPMSTAT
								
								GOTO YES_3Ware_or_MR_Controller
								:IF_NO_3Ware_or_MR-No_AEC_or_DPMSTAT
								@ECHO ......................:IF_NO_3Ware_or_MR-No_AEC_or_DPMSTAT...................... >> misc_output.txt 2>&1
								@ECHO "dir >> misc_output.txt 2>&1" >> misc_output.txt 2>&1
								dir >> misc_output.txt 2>&1
								REM   .......................................||.......................................
								@ECHO .
								@ECHO The command line switches;
								@ECHO -E_AEC
								@ECHO -E_DPM
								@ECHO -E_AEC_DPM
								@ECHO -G_AEC
								@ECHO -G_DPM
								@ECHO -G_AEC_DPM
								@ECHO .
								@ECHO can ONLY be used if a 3Ware and/or MegaRAID controller is installed...
								@ECHO Ignoring G_* options, exiting if E_* options...
								@ECHO %TWGETPARTIALMODE%
								@ECHO . 
								IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO END_No_Pause
								IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO END_No_Pause
								IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO END_No_Pause
								SET TWGETPARTIALMODE=STANDARD

								@ECHO . >> misc_output.txt 2>&1
								@ECHO The command line switches; >> misc_output.txt 2>&1
								@ECHO -E_AEC >> misc_output.txt 2>&1
								@ECHO -E_DPM >> misc_output.txt 2>&1
								@ECHO -E_AEC_DPM >> misc_output.txt 2>&1
								@ECHO -G_AEC >> misc_output.txt 2>&1
								@ECHO -G_DPM >> misc_output.txt 2>&1
								@ECHO -G_AEC_DPM >> misc_output.txt 2>&1
								@ECHO . >> misc_output.txt 2>&1
								@ECHO can ONLY be used if a 3Ware and/or MegaRAID controller is installed... >> misc_output.txt 2>&1
								@ECHO Ignoring G_* options, exiting if E_* options... >> misc_output.txt 2>&1
								@ECHO %TWGETPARTIALMODE% >> misc_output.txt 2>&1
								@ECHO . >> misc_output.txt 2>&1
								@ECHO SET TWGETPARTIALMODE=  >> misc_output.txt 2>&1
								@ECHO .  >> misc_output.txt 2>&1 
								@ECHO IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO END_No_Pause >> misc_output.txt 2>&1
								@ECHO IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO END_No_Pause >> misc_output.txt 2>&1
								@ECHO IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO END_No_Pause >> misc_output.txt 2>&1
								@ECHO SET TWGETPARTIALMODE=STANDARD >> misc_output.txt 2>&1
								)
				)	


	
:YES_3Ware_or_MR_Controller

REM ###########################################################################################################################
REM # Subdirectory Name / File Name Creation
REM ###########################################################################################################################

IF [%TWGETPARTIALMODE%]==[STANDARD] SET TW-FN=lsi.%TWver_name%.%COMPUTERNAME%.%tw_date%.%tw_time%
IF [%TWGETPARTIALMODE%]==[G_AEC] SET TW-FN=AEC.%TWver_name%.%COMPUTERNAME%.%tw_date%.%tw_time%
IF [%TWGETPARTIALMODE%]==[G_DPM] SET TW-FN=DPMSTAT.%TWver_name%.%COMPUTERNAME%.%tw_date%.%tw_time%
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] SET TW-FN=AEC_DPMSTAT.%TWver_name%.%COMPUTERNAME%.%tw_date%.%tw_time%
IF [%TWGETMONITORMODE%]==[MONITOR] SET TW-FN=MONITOR.%TWver_name%.%COMPUTERNAME%.%tw_date%.%tw_time%

IF [%TWGETPARTIALMODE%]==[STANDARD] GOTO PRINTFILENAME
IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO PRINTFILENAME
IF [%TWGETPARTIALMODE%]==[G_DPM] GOTO PRINTFILENAME
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] GOTO PRINTFILENAME
GOTO DONTPRINTFILENAME
:PRINTFILENAME
IF [%TWPRINTFILENAME%]==[YES] ECHO %TW-FN%.7z >> LSICAPTUREFILES.TXT
:DONTPRINTFILENAME



IF [%TWGETPARTIALMODE%]==[E_AEC] SET TW-WS=.\
IF [%TWGETPARTIALMODE%]==[E_DPM] SET TW-WS=.\
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] SET TW-WS=.\
IF [%TWGETPARTIALMODE%]==[STANDARD] SET TW-WS=%TW-FN%\script_workspace\
IF [%TWGETPARTIALMODE%]==[G_AEC] SET TW-WS=%TW-FN%\script_workspace\
IF [%TWGETPARTIALMODE%]==[G_DPM] SET TW-WS=%TW-FN%\script_workspace\
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] SET TW-WS=%TW-FN%\script_workspace\

IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO E_AEC1
IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO E_DPM1
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO E_AEC_DPM1

REM ###########################################################################################################################
REM # The following is for TWGETPARTIALMODE = G_*, STANDARD or MONITOR
REM ###########################################################################################################################

IF NOT [%NOWOW64%]==[YES] (MKDIR Utils\timer_comp >> misc_output.txt 2>&1)
MKDIR %TW-FN% >> misc_output.txt 2>&1
MKDIR %TW-FN%\script_workspace >> misc_output.txt 2>&1
IF NOT [%NOWOW64%]==[YES]	(
				MKDIR %TW-FN%\script_workspace\timers >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer1 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer2 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer3 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer4 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer5 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer6 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer7 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer8 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer9 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer10 >> misc_output.txt 2>&1
				MKDIR %TW-FN%\script_workspace\timers\timer100 >> misc_output.txt 2>&1
				
				copy timer.exe %TW-WS%timers\timer1\timer1.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer2\timer2.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer3\timer3.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer4\timer4.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer5\timer5.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer6\timer6.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer7\timer7.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer8\timer8.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer9\timer9.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer10\timer10.exe >> misc_output.txt 2>&1
				copy timer.exe %TW-WS%timers\timer100\timer100.exe >> misc_output.txt 2>&1
				copy timer.exe Utils\timer_comp\timer_comp.exe >> misc_output.txt 2>&1
				)

IF EXIST adpcount.txt copy adpcount.txt %TW-WS% >> misc_output.txt 2>&1
IF EXIST adpcount_1.txt copy adpcount_1.txt %TW-WS% >> misc_output.txt 2>&1
IF EXIST num_mraid_adapters.txt copy num_mraid_adapters.txt %TW-WS% >> misc_output.txt 2>&1
IF EXIST adp_nums.txt copy adp_nums.txt %TW-WS% >> misc_output.txt 2>&1
IF EXIST pre_mr_ctrl_nums.txt copy pre_mr_ctrl_nums.txt %TW-WS% >> misc_output.txt 2>&1
IF EXIST mr_ctrl_nums.txt copy mr_ctrl_nums.txt %TW-WS% >> misc_output.txt 2>&1


copy lsigetwin.bat %TW-WS% >> misc_output.txt 2>&1
copy aens_3w.txt %TW-WS% >> misc_output.txt 2>&1
copy aens_mr.txt %TW-WS% >> misc_output.txt 2>&1
copy MegaRAID_Driver_Event_Codes.txt %TW-WS% >> misc_output.txt 2>&1



REM Used in AEN Sort
@ECHO Info > %TW-WS%mr_aen_types.txt
@ECHO Warning >> %TW-WS%mr_aen_types.txt
@ECHO Critical >> %TW-WS%mr_aen_types.txt
@ECHO Fatal >> %TW-WS%mr_aen_types.txt
@ECHO Progress >> %TW-WS%mr_aen_types.txt
@ECHO Obsolete >> %TW-WS%mr_aen_types.txt

@ECHO %LSIGETWINVER% > %TW-WS%lsigetwin_version.txt

REM Creating comment
IF NOT [%TWcomment%]==[] @ECHO %TWcomment% > %TW-FN%\comment.txt

REM ###########################################################################################################################
REM # -E_* functions without a subdir
REM ###########################################################################################################################

:E_AEC1
:E_DPM1
:E_AEC_DPM1

IF [%TWGETSKIP3WARE%]==[YES] GOTO NO_3Ware_Ctrls
REM Skip 3Ware if just MegaRAID
IF [%NO_3Ware_Ctrls%]==[YES] GOTO NO_3Ware_Ctrls

REM ###########################################################################################################################
REM # 3wareController Numbers
REM ###########################################################################################################################
tw_cli show > %TW-WS%show.txt 2>&1
%grep% "^c" %TW-WS%show.txt > %TW-WS%c_show.txt
FOR /F "tokens=1 delims=c " %%i in (%TW-WS%c_show.txt) DO (@ECHO %%i >> %TW-WS%ctrl_nums.txt)
REM ###########################################################################################################################
REM # Controller Numbers for tw_windriver
REM ###########################################################################################################################
tw_windriver -info > %TW-WS%tw_windriver.txt 2>&1
%grep% "Controller C" %TW-WS%tw_windriver.txt > %TW-WS%tw_windriver1.txt
IF EXIST %TW-WS%tw_windriver1.txt	(
					FOR /F "tokens=2 delims= " %%i in (%TW-WS%tw_windriver1.txt) DO (@ECHO %%i >> %TW-WS%tw_windriver2.txt)
					IF EXIST %TW-WS%tw_windriver2.txt	(
										FOR /F "tokens=1 delims=C:" %%i in (%TW-WS%tw_windriver2.txt) DO (@ECHO %%i >> %TW-WS%ctrl_nmbrs_tw_windriver.txt)
										)
					)
REM ###########################################################################################################################
REM # Controller Numbers for tw_wdcon
REM ###########################################################################################################################
tw_wdcon -info > %TW-WS%tw_wdcon.txt 2>&1
%grep% "Controller C" %TW-WS%tw_wdcon.txt > %TW-WS%tw_wdcon1.txt
IF EXIST %TW-WS%tw_wdcon1.txt	(
				FOR /F "tokens=2 delims= " %%i in (%TW-WS%tw_wdcon1.txt) DO (@ECHO %%i >> %TW-WS%tw_wdcon2.txt)
				IF EXIST %TW-WS%tw_wdcon2.txt	(
								FOR /F "tokens=1 delims=C:" %%i in (%TW-WS%tw_wdcon2.txt) DO (@ECHO %%i >> %TW-WS%ctrl_nmbrs_tw_wdcon.txt)
								)
				)
REM ###########################################################################################################################
REM # Clearing and Enabling Advanced Event Capture "AEC" 
REM ###########################################################################################################################
IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO E_AEC
IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO E_DPM
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO E_AEC
GOTO NOT_E_AEC
:E_AEC
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO 	(
							tw_cli /c%%i set capture=disable > %TW-WS%c%%i_show_capture.txt 2>&1 
							IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%ctrl_nums_aec.txt
							)
IF EXIST %TW-WS%ctrl_nums_aec.txt	(
					@ECHO .
					@ECHO Clearing and Enabling Advanced Event Capture "AEC" for 3Ware...
					FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums_aec.txt) DO	(
												tw_cli /c%%i set capture=enable numevents=150000 >> misc_output.txt 2>&1
												tw_cli /c%%i set capturemode=stopped >> misc_output.txt 2>&1
												tw_cli /c%%i set capture=start >> misc_output.txt 2>&1
												)
					)
:NOT_E_AEC
IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO NO_3Ware_Ctrls
REM This is to check for MR CTRLs
IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO E_DPM
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO E_DPM
GOTO NOT_E_DPM
:E_DPM
REM ###########################################################################################################################
REM # Determine # of ports & which controllers support dpmstat.
REM # Clearing and Enabling DPMSTAT
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							tw_cli /c%%i show pmstat > %TW-WS%c%%i_show_pmstat.txt 2>&1
							%grep% "Performance Monitor: O" %TW-WS%c%%i_show_pmstat.txt  > %TW-WS%c%%i_show_pmstat_enbld.txt
							IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%ctrl_nums_pmstat.txt
							)

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							tw_cli /c%%i show > %TW-WS%c%%i_show.txt
							%grep% "^p" c%%i_show.txt > %TW-WS%c%%i_p_show.txt
							%grep% -v "NOT-PRESENT" c%%i_p_show.txt > %TW-WS%c%%i_pp_show.txt
							FOR /F "tokens=1 delims=p " %%j in (c%%i_pp_show.txt) DO (@ECHO %%j >> %TW-WS%c%%i_port_nums.txt)
							)
IF EXIST %TW-WS%ctrl_nums_pmstat.txt	(
					@ECHO .
					@ECHO Clearing and Enabling Disk Performance Monitoring Statistics "DPMSTAT" for 3Ware...
					FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums_pmstat.txt) DO	(
													tw_cli /c%%i set pmstat=off >> misc_output.txt 2>&1
													IF EXIST c%%i_port_nums.txt	(FOR /F "usebackq" %%j IN (%TW-WS%c%%i_port_nums.txt) DO	(
																									tw_cli /c%%i/p%%j set pmstat=clear type=ra >> misc_output.txt 2>&1
																									tw_cli /c%%i/p%%j set pmstat=clear type=lct >> misc_output.txt 2>&1
																									tw_cli /c%%i/p%%j set pmstat=clear type=ext >> misc_output.txt 2>&1
																									)
																	)
													)
					)

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums_pmstat.txt) DO (tw_cli /c%%i set pmstat=on >> misc_output.txt 2>&1)

:NOT_E_DPM
IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO G_AEC
IF [%TWGETPARTIALMODE%]==[G_DPM] GOTO G_DPM
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] GOTO G_AEC
IF [%TWGETPARTIALMODE%]==[STANDARD] GOTO G_AEC
IF [%TWGETPARTIALMODE%]==[MONITOR] GOTO G_AEC
REM GOTO END is for E_*
REM Below is to continue looking for MR controllers on E_*
GOTO NO_3Ware_Ctrls
:G_AEC

REM ###########################################################################################################################
REM # Disabling AEC and capturing logs - Must be first or IOCTLs pollute capture.
REM # TWGETPARTIALMODE = G_* gets AEC/DPMSTAT regardless of state.
REM # TWGETPARTIALMODE = STANDARD/MONITOR gets AEC/DPMSTAT only if Enabled. 
REM ###########################################################################################################################
REM NOT sure why below...
REM FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							REM IF [%TWGETPARTIALMODE%]==[STANDARD] tw_cli /c%%i show capture > %TW-WS%c%%i_show_capture.txt 2>&1
							REM IF [%TWGETPARTIALMODE%]==[STANDARD] %grep% "  State = Enabled" %TW-WS%c%%i_show_capture.txt  > %TW-WS%c%%i_show_capture_enabled.txt
							REM IF NOT [%TWGETPARTIALMODE%]==[STANDARD]	(
REM													tw_cli /c%%i set capture=stop >> misc_output.txt 2>&1
REM 													IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%ctrl_nums_aec.txt
REM													)
REM							)

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							tw_cli /c%%i show capture > %TW-WS%c%%i_show_capture.txt 2>&1
							%grep% "  State = Enabled" %TW-WS%c%%i_show_capture.txt  > %TW-WS%c%%i_show_capture_enabled.txt
							IF NOT ERRORLEVEL 1	(
										@ECHO %%i >> %TW-WS%ctrl_nums_aec.txt
										tw_cli /c%%i set capture=stop >> misc_output.txt 2>&1
										)
							)


IF EXIST %TW-WS%ctrl_nums_aec.txt GOTO aec_exists
GOTO aec_does_notexist
:aec_exists
@ECHO .
@ECHO Disabling and Getting Advanced Event Capture "AEC" for 3Ware...

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums_aec.txt) DO (tw_cli /c%%i set capture=stop >> misc_output.txt 2>&1)

FOR /L %%i IN (0,1,11) DO (IF EXIST evtcapture_c%%i.dat SET OLD_EVT_CAP_EXIST=YES)

IF [%OLD_EVT_CAP_EXIST%] == [YES]	(
					IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
					IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware					
					mkdir %TW-FN%\LSI_Products\3Ware\OldAEC
					FOR /L %%i IN (0,1,11) DO	(
									IF EXIST evtcapture_c%%i.dat	(
													copy evtcapture_c%%i.dat %TW-FN%\LSI_Products\3Ware\OldAEC >> misc_output.txt 2>&1
													)
									IF EXIST evtcapture_c%%i.dat del evtcapture_c%%i.dat >> misc_output.txt 2>&1
									)
					)

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums_aec.txt) DO	(
							tw_cli /c%%i get capture >> misc_output.txt 2>&1
							tw_cli /c%%i set capture=disable >> misc_output.txt 2>&1
							)

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums_aec.txt) DO (IF EXIST evtcapture_c%%i.dat SET NEW_EVT_CAP_EXIST=YES)

IF [%NEW_EVT_CAP_EXIST%] == [YES]	(
					IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
					IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware
					mkdir %TW-FN%\LSI_Products\3Ware\AEC
					FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums_aec.txt) DO	(
												IF EXIST evtcapture_c%%i.dat	(
																copy evtcapture_c%%i.dat %TW-FN%\LSI_Products\3Ware\AEC >> misc_output.txt 2>&1
																)
												IF EXIST evtcapture_c%%i.dat del evtcapture_c%%i.dat >> misc_output.txt 2>&1
												)
					)
:aec_does_notexist

:G_DPM
REM ###########################################################################################################################
REM # Determine # of controllers that support pmstat, create dummy file for Monitor Mode
REM # TWGETPARTIALMODE = G_* gets AEC/DPMSTAT regardless of state.
REM # TWGETPARTIALMODE = STANDARD gets AEC/DPMSTAT only if Enabled.
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							@ECHO "Dummy File for Monitor Mode" > %TW-WS%controller_number_C%%i.txt 2>&1
							tw_cli /c%%i show pmstat > %TW-WS%c%%i_show_pmstat.txt 2>&1
							IF [%TWGETPARTIALMODE%]==[STANDARD] 	(
												%grep% "Performance Monitor: ON" %TW-WS%c%%i_show_pmstat.txt  > %TW-WS%c%%i_show_pmstat_enbld.txt
												IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%ctrl_nums_pmstat.txt
												)
							IF NOT [%TWGETPARTIALMODE%]==[STANDARD]	(
												%grep% "Performance Monitor: O" %TW-WS%c%%i_show_pmstat.txt  > %TW-WS%c%%i_show_pmstat_enbld.txt
												IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%ctrl_nums_pmstat.txt
												)
							)
REM ###########################################################################################################################
REM Enclosure ID's if I2C Errors................
REM ###########################################################################################################################
IF EXIST %TW-WS%Valid_controller_test.txt 	(
						IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
						IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware
						%grep% "I2C transaction aborted" %TW-WS%Valid_controller_test.txt > %TW-FN%\LSI_Products\3Ware\3w_I2C_Error.txt 2>&1
						)
IF EXIST %TW-FN%\LSI_Products\3Ware dir %TW-FN%\LSI_Products\3Ware\ | find " 0 3w_I2C_Error.txt" >> misc_output.txt 2>&1
IF %ERRORLEVEL%==0 del %TW-FN%\LSI_Products\3Ware\3w_I2C_Error.txt >> misc_output.txt 2>&1
IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3w_I2C_Error.txt GOTO NO_I2C_ERROR
REM ###########################################################################################################################
REM # Determine # of /Cx/Ex enclosures if I2C Errors................
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							FOR /L %%j IN (0,1,7) DO	(
											tw_cli /c%%i/e%%j show >> misc_output.txt 2>&1
											IF NOT ERRORLEVEL 1 tw_cli /c%%i/e%%j show all >> %TW-WS%alt_cxex_show.txt 
											IF EXIST %TW-WS%alt_cxex_show.txt %grep% "^/c%%i/e%%j Vendor" %TW-WS%alt_cxex_show.txt >> %TW-WS%c%%i_cxex_show.txt 
											)
							)
REM ###########################################################################################################################
REM # Determine # of /Ex enclosures if I2C Errors................
REM ###########################################################################################################################




FOR /L %%j IN (0,1,7) DO	(
				tw_cli /e%%j show all >> misc_output.txt 2>&1
				IF NOT ERRORLEVEL 1 tw_cli /e%%j show > %TW-WS%e%%j_alt_ex_show.txt 2>&1
				IF EXIST %TW-WS%e%%j_alt_ex_show.txt %grep% "^e" %TW-WS%e%%j_alt_ex_show.txt >> %TW-WS%e%%j_ex_show.txt 2>&1
				IF EXIST %TW-WS%e%%j_ex_show.txt FOR /F "tokens=1 delims=e " %%k in (%TW-WS%e%%j_ex_show.txt) DO (@ECHO %%k >> %TW-WS%exencl_nums.txt 2>&1)
				)

:NO_I2C_ERROR
REM ###########################################################################################################################
REM # Determine # of ports/units/Cx/Ex enclosures
REM # TWGETPARTIALMODE = G_* gets AEC/DPMSTAT regardless of state.
REM # TWGETPARTIALMODE = STANDARD gets AEC/DPMSTAT only if Enabled.
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF NOT EXIST %TW-WS%c%%i_cxex_show.txt %grep% "^/c%%i/e" %TW-WS%show.txt > %TW-WS%c%%i_cxex_show.txt
							tw_cli /c%%i show > %TW-WS%c%%i_show.txt
							%grep% "^u" %TW-WS%c%%i_show.txt > %TW-WS%c%%i_u_show.txt
							%grep% "^p" %TW-WS%c%%i_show.txt > %TW-WS%c%%i_p_show.txt
							%grep% -v "NOT-PRESENT" %TW-WS%c%%i_p_show.txt > %TW-WS%c%%i_pp_show.txt
							FOR /F "tokens=1 delims=u " %%j in (%TW-WS%c%%i_u_show.txt) DO (@ECHO %%j >> %TW-WS%c%%i_unit_nums.txt)
							FOR /F "tokens=2 delims=/e " %%j in (%TW-WS%c%%i_cxex_show.txt) DO (@ECHO %%j >> %TW-WS%c%%i_cxencl_nums.txt)
							FOR /F "tokens=1 delims=p " %%j in (%TW-WS%c%%i_pp_show.txt) DO (@ECHO %%j >> %TW-WS%c%%i_port_nums.txt)
							)
REM ###########################################################################################################################
REM # Determine # of /Ex enclosures
REM # TWGETPARTIALMODE = G_* gets AEC/DPMSTAT regardless of state.
REM # TWGETPARTIALMODE = STANDARD gets AEC/DPMSTAT only if Enabled.
REM ###########################################################################################################################
IF EXIST %TW-FN%\LSI_Products\3Ware\3w_I2C_Error.txt GOTO YES_I2C_ERROR
%grep% "^e" %TW-WS%show.txt > %TW-WS%e_show.txt
FOR /F "tokens=1 delims=e " %%i in (%TW-WS%e_show.txt) DO (@ECHO %%i >> %TW-WS%exencl_nums.txt)


IF EXIST %TW-WS%exencl_nums.txt	(
				FOR /F "usebackq" %%i IN (%TW-WS%exencl_nums.txt) DO	(
											tw_cli /e%%i show > %TW-WS%e%%i_std_ex_show.txt
											IF EXIST %TW-WS%e%%i_std_ex_show.txt %grep% "^e" %TW-WS%e%%i_std_ex_show.txt >> %TW-WS%e%%i_ex_show.txt 2>&1
											)
				)

:YES_I2C_ERROR


IF EXIST %TW-WS%exencl_nums.txt	(
				FOR /F "usebackq" %%j IN (%TW-WS%exencl_nums.txt) DO	(
											FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
																		%grep% "/c%%i" %TW-WS%e%%j_ex_show.txt > %TW-WS%ex_show_c%%i.txt 
																		FOR /F "tokens=1 delims=e " %%k in (%TW-WS%ex_show_c%%i.txt) DO (@ECHO %%k >> %TW-WS%c%%i_exencl_nums.txt)
																		)
											)
				)
IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO NOT_G_DPM
REM ###########################################################################################################################
REM # If enabled, disabling PMSTAT and capturing logs
REM # TWGETPARTIALMODE = G_* gets AEC/DPMSTAT regardless of state.
REM # TWGETPARTIALMODE = STANDARD gets AEC/DPMSTAT only if Enabled.
REM ###########################################################################################################################
IF EXIST %TW-WS%ctrl_nums_pmstat.txt	(
					@ECHO .
					@ECHO Disabling and Getting Disk Performance Monitoring Statistics "DPMSTAT" for 3Ware...
					IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
					IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware
					IF NOT EXIST %TW-FN%\LSI_Products\3Ware\PMSTAT mkdir %TW-FN%\LSI_Products\3Ware\PMSTAT
					FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums_pmstat.txt) DO	(
													tw_cli /c%%i set pmstat=off >> misc_output.txt 2>&1
													REM   ......................................::.......................................
													@ECHO ....................tw_cli /c%%i show pmstat type=inst........................... >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_INST_C%%i.txt 2>&1
													tw_cli /c%%i show pmstat type=inst >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_INST_C%%i.txt 2>&1
													REM   ......................................::.......................................
													@ECHO .......................tw_cli /c%%i show pmstat type=ra.......................... >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_RA_C%%i.txt 2>&1
													tw_cli /c%%i show pmstat type=ra >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_RA_C%%i.txt 2>&1
													REM   ......................................::.......................................
													@ECHO .......................tw_cli /c%%i show pmstat type=ext......................... >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_EXT_C%%i.txt 2>&1
													tw_cli /c%%i show pmstat type=ext >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_EXT_C%%i.txt 2>&1
													)
					FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums_pmstat.txt) DO	(
													IF EXIST %TW-WS%c%%i_port_nums.txt	(FOR /F "usebackq" %%h IN (%TW-WS%c%%i_port_nums.txt) DO	(
																										REM   ......................................::.......................................
																										@ECHO ......................tw_cli /c%%i/p%%h show pmstat type=histdata.................. >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_HISTDATA_C%%i.txt 2>&1
																										tw_cli /c%%i/p%%h show pmstat type=histdata >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_HISTDATA_C%%i.txt 2>&1
																										@ECHO ........................tw_cli /c%%i/p%%h show pmstat type=lct..................... >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_LCT_C%%i.txt 2>&1
																										tw_cli /c%%i/p%%h show pmstat type=lct >> %TW-FN%\LSI_Products\3Ware\PMSTAT\PMSTAT_LCT_C%%i.txt 2>&1
																										)
																		)
					)								)


:NOT_G_DPM


REM ###########################################################################################################################
REM Starting Controller_Cx.txt files
REM ###########################################################################################################################

IF [%NO_3Ware_Ctrls%]==[YES] GOTO NO_3Ware_Ctrls

IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware

@ECHO .
IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer1\timer1 /q /nologo)
@ECHO Starting the 3Ware RAID Controller Data Collection...
IF [%NOWOW64%]==[YES] (@ECHO %time%)
@ECHO Starting the 3Ware RAID Controller Data Collection... >> misc_output.txt 2>&1
@ECHO Starting the 3Ware RAID Controller Data Collection... > %TW-WS%Start_3Ware_Data_Collection.txt
IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_3Ware_Data_Collection.txt >> misc_output.txt 2>&1)


FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
							@ECHO Start on Controller %%i...
							@ECHO Start on Controller %%i... >> misc_output.txt 2>&1
							@ECHO Start on 3Ware Controller %%i... > %TW-WS%Start_3Ware_Controller_%%i.txt
							IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_3Ware_Controller_%%i.txt >> misc_output.txt 2>&1)
							REM   ......................................::.......................................
							@ECHO %TW-FN% >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO .................................tw_cli show................................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli show >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							)

IF EXIST %TW-WS%ctrl_nmbrs_tw_windriver.txt	(
						FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nmbrs_tw_windriver.txt) DO	(
															IF EXIST %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt	(
																					REM   ......................................::.......................................
																					@ECHO ..............."tw_windriver -card %%i -info | grep "Slot DiskNum"".............. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																					tw_windriver -card %%i -info | %grep% "Slot DiskNum" >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																					)
															)
						)

IF EXIST %TW-WS%ctrl_nmbrs_tw_wdcon.txt 	(
						FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nmbrs_tw_wdcon.txt) DO	(
														IF EXIST %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt	(
																				REM   ......................................::.......................................
																				@ECHO ....................."tw_wdcon -info | grep "Controller C%%i:"".................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				tw_wdcon -info | %grep% "Controller C%%i:" >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				)
														)
						)

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							REM   ......................................::.......................................
							@ECHO ............................tw_cli /c%%i show all................................ >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show all >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							)
REM ###########################################################################################################################
REM # Partial capture
REM ###########################################################################################################################
IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO NO_3Ware_Ctrls
IF [%TWGETPARTIALMODE%]==[G_DPM] GOTO NO_3Ware_Ctrls
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] GOTO NO_3Ware_Ctrls
REM ###########################################################################################################################
REM Units
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF EXIST %TW-WS%c%%i_unit_nums.txt	(
												FOR /F "usebackq" %%j IN (%TW-WS%c%%i_unit_nums.txt) DO	(
																			REM   ......................................::.......................................
																			@ECHO ..........................tw_cli /c%%i/u%%j show all....................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																			tw_cli /c%%i/u%%j show all >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																			IF NOT ["%TWGETSKIPCDA%"]==["YES"]	(
																								IF NOT EXIST %TW-WS%cda mkdir %TW-WS%cda
																								tw_cli /c%%i/u%%j show all >> %TW-WS%cda\3ware_c%%i_u%%j.txt 2>&1
																								@ECHO 3ware_c%%i_u%%j.txt >> %TW-WS%cda\3ware_cX_uX.txt 2>&1
																								%grep% "serial number" %TW-WS%cda\3ware_c%%i_u%%j.txt > %TW-WS%cda\3ware_sn_c%%i_u%%j.txt 2>&1
																								@ECHO 3ware_sn_c%%i_u%%j.txt >> %TW-WS%cda\3ware_sn_cX_uX.txt 2>&1
																								)			
																			@ECHO .........................tw_cli /c%%i/u%%j show writedpo................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																			tw_cli /c%%i/u%%j show writedpo >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																			)
												)
							)

IF EXIST %TW-WS%cda\3ware_sn_cX_uX.txt (SET NO_3WARE_VDs=NO) ELSE SET NO_3WARE_VDs=YES

REM ###########################################################################################################################
REM Ports................
REM ###########################################################################################################################

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF EXIST %TW-WS%c%%i_port_nums.txt	(
												FOR /F "usebackq" %%j IN (%TW-WS%c%%i_port_nums.txt) DO	(
																			REM   ......................................::.......................................
																			@ECHO ........................tw_cli /c%%i/p%%j show all......................... >> %TW-WS%px_show_all_C%%i.txt 2>&1
																			tw_cli /c%%i/p%%j show all >> %TW-WS%px_show_all_C%%i.txt 2>&1
																			)
												)
							IF EXIST %TW-WS%px_show_all_C%%i.txt	(
												REM   ......................................::.......................................
												@ECHO ..................................Disk Model................................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "Model =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												@ECHO ..................................Drive Type................................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "Drive Type =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												@ECHO .................................Disk Firmware................................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "Firmware Version =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												@ECHO .................................Disk Serial #................................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "Serial =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												@ECHO .................................Disk Capacity................................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "Capacity =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												@ECHO ...........................Disk Reallocated Sectors............................ >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "Reallocated Sectors =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												@ECHO ................................Disk Temperature............................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "Temperature =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												@ECHO .................................Disk Link Speed............................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "Link Speed =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												REM   ......................................::.......................................
												@ECHO .................................NCQ Enabled................................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "NCQ Enabled =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												@ECHO ...............................Queuing Enabled................................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												%grep% "Queuing Enabled =" %TW-WS%px_show_all_C%%i.txt  >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
												)
							)
REM ###########################################################################################################################
REM Misc
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							REM   ......................................::.......................................
							@ECHO ........................tw_cli /c%%i show alarms reverse......................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show alarms reverse >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO ..........................tw_cli /c%%i show rebuild.............................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show rebuild >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO .........................tw_cli /c%%i show rebuildrate........................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show rebuildrate >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO .........................tw_cli /c%%i show rebuildmode........................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show rebuildmode >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO ...........................tw_cli /c%%i show verify.............................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show verify >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO ..........................tw_cli /c%%i show verifyrate........................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show verifyrate >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							REM   ......................................::.......................................							
							@ECHO ..........................tw_cli /c%%i show verifymode........................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show verifymode >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO ...........................tw_cli /c%%i show selftest............................ >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show selftest >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO .......................tw_cli /c%%i show forcedrivecacheon....................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show forcedrivecacheon >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO .............................tw_cli /c%%i show avmode............................ >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show avmode >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO ...........................tw_cli /c%%i show lbareorder.......................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show lbareorder >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO ..............................tw_cli /c%%i show phy.............................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show phy >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO ............................tw_cli /c%%i/bbu show all............................ >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							REM   ......................................::....................................... 
							tw_cli /c%%i/bbu show all >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							)

REM ###########################################################################################################################
REM /Cx/Ex Enclosure ID's for SAS controllers................
REM ###########################################################################################################################

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF EXIST %TW-WS%c%%i_cxencl_nums.txt	(
												FOR /F "usebackq" %%j IN (%TW-WS%c%%i_cxencl_nums.txt) DO	(
																				REM   ......................................::.......................................
																				@ECHO ........................tw_cli /c%%i/e%%j show all................................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				tw_cli /c%%i/e%%j show all >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				@ECHO ......................tw_cli /c%%i/e%%j show protocol.............................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				tw_cli /c%%i/e%%j show protocol >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				)
												)
							)
REM ###########################################################################################################################
REM /Ex Enclosure ID's for SATA controllers................
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF EXIST %TW-WS%c%%i_exencl_nums.txt	(
												FOR /F "usebackq" %%j IN (%TW-WS%c%%i_exencl_nums.txt) DO	(
																				REM   ......................................::.......................................
																				@ECHO ..............................tw_cli /e%%j show all.............................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				tw_cli /e%%j show all >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				@ECHO .............................tw_cli /e%%j show protocol.......................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				tw_cli /e%%j show protocol >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
																				)
												)
							)

:I2C_ERROR

REM ###########################################################################################################################
REM Misc Stuff at end, lower priority & show diag last................
REM ###########################################################################################################################

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO 	(
                                                        REM   ......................................::......................................             
							@ECHO .........................tw_cli /c%%i show iostat............................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show iostat >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO .........................tw_cli /c%%i show pmstat............................... >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show pmstat >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							@ECHO .........................tw_cli /c%%i show capture.............................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							tw_cli /c%%i show capture >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							
							
							IF EXIST %TW-WS%px_show_all_C%%i.txt type %TW-WS%px_show_all_C%%i.txt >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							
							
							tw_cli /c%%i show diag > %TW-WS%diag_C%%i.txt 2>&1
							REM   ......................................::.......................................
							@ECHO .............................tw_cli /c%%i show diag.............................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							type %TW-WS%diag_C%%i.txt >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1

							@ECHO End on Controller %%i... >> misc_output.txt 2>&1
							@ECHO End on 3Ware Controller %%i... > %TW-WS%End_3Ware_Controller_%%i.txt
							IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_3Ware_Controller_%%i.txt >> misc_output.txt 2>&1)
							IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
							)

REM ###########################################################################################################################
REM # tw_windriver
REM ###########################################################################################################################


IF EXIST %TW-WS%ctrl_nmbrs_tw_windriver.txt	(
					
						REM   ......................................::.......................................
						@ECHO ...................."tw_windriver -info | %grep% "Sorted"".................... >> %TW-FN%\LSI_Products\3Ware\Controller_Summary_7xxx-96xx.txt 2>&1
						tw_windriver -info | %grep% "Sorted" >> %TW-FN%\LSI_Products\3Ware\Controller_Summary_7xxx-96xx.txt 2>&1
						
						FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nmbrs_tw_windriver.txt) DO	( 
															REM   ......................................::.......................................
															@ECHO ............"tw_windriver -card %%i -info | %grep% "Controller Mode...""........ >> %TW-FN%\LSI_Products\3Ware\Controller_Summary_7xxx-96xx.txt 2>&1
															tw_windriver -card %%i -info | %grep% "Controller Model Version Serial Units DiskNum Driver Name Date Mode" >> %TW-FN%\LSI_Products\3Ware\Controller_Summary_7xxx-96xx.txt 2>&1
															)

						FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nmbrs_tw_windriver.txt) DO	(
															REM   ......................................::.......................................
															@ECHO ....tw_windriver -card %%i -info -dvars dump -stats dump -log boot -log dump.....>> %TW-FN%\LSI_Products\3Ware\tw_windriver.txt 2>&1
															tw_windriver -card %%i -info -dvars dump -stats dump -log boot -log dump >> %TW-FN%\LSI_Products\3Ware\tw_windriver.txt 2>&1
															)
						REM Return for IF EXIST %TW-WS%ctrl_nmbrs_tw_windriver.txt
						)
REM ###########################################################################################################################
REM # tw_wdcon
REM ###########################################################################################################################
IF EXIST %TW-WS%ctrl_nmbrs_tw_wdcon.txt	(
									
					REM   ......................................::.......................................
					@ECHO .............................."tw_wdcon -info"................................. >> %TW-FN%\LSI_Products\3Ware\Controller_Summary_97xx.txt 2>&1
					tw_wdcon -info >> %TW-FN%\LSI_Products\3Ware\Controller_Summary_97xx.txt 2>&1
					
					REM   ......................................::.......................................
					@ECHO ..............................."tw_wdcon -info"................................ >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -info >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ................................"tw_wdcon -win"................................ >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -win >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -stats show"............................ >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -stats show >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -cmon config"........................... >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cmon config >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -cmon setup"............................ >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cmon setup >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -cmon trig"............................. >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cmon trig >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -cmon cmds"............................. >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cmon cmds >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO .............................."tw_wdcon -cmon lcts"............................ >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cmon lcts >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO .............................."tw_wdcon -cmon aves"............................ >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cmon aves >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO .............................."tw_wdcon -cmon hist"............................ >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cmon hist >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -cmondrv get"........................... >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cmondrv get >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -cmoncon get"........................... >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cmoncon get >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO .............................."tw_wdcon -dbgcon get"........................... >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -dbgcon get >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -cachecon get".......................... >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -cachecon get >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO .............................."tw_wdcon -msgdrv get"........................... >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -msgdrv get >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -dbgdrv get"............................ >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -dbgdrv get >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -msgcon get"............................ >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -msgcon get >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					REM   ......................................::.......................................
					@ECHO ............................."tw_wdcon -event get"............................. >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					tw_wdcon -event get >> %TW-FN%\LSI_Products\3Ware\tw_wdcon.txt 2>&1
					)
REM ###########################################################################################################################
REM # tw_devcon - 3ware/MegaRAID/HBA - Pulling, takes too long, not running on MR/HBA and hasnt been useful. 8/21/13
REM ###########################################################################################################################

REM @ECHO Running tw_devcon .....
REM   ......................................::.......................................
REM @ECHO .........................................."tw_devcon -fznd".......................................... >> %TW-FN%\tw_devcon_All_Devices.txt 2>&1
REM tw_devcon -fznd >> %TW-FN%\tw_devcon_All_Devices.txt 2>&1
REM   ......................................::.......................................
REM @ECHO ...................."tw_devcon 0x13C1 -onu -f 3ware10k -l 3wareDrv -l 3wdrv100 -l oemsetup -l 3wmanage -l".................. >> %TW-FN%\LSI_Products\3Ware\tw_devcon_3ware.txt 2>&1
REM tw_devcon 0x13C1 -onu -f 3ware10k -l 3wareDrv -l 3wdrv100 -l oemsetup -l 3wmanage -l >> %TW-FN%\LSI_Products\3Ware\tw_devcon_3ware.txt 2>&1
REM   ......................................::.......................................
REM @ECHO ...................."tw_devcon 0x1000 -onu -f msas2k3 -l megasas2 -l megasas -l oemsetup -l".................. >> %TW-FN%\LSI_Products\MegaRAID\tw_devcon_MegaRAID.txt 2>&1
REM tw_devcon 0x1000 -onu -f msas2k3 -l megasas2 -l megasas -l oemsetup -l >> %TW-FN%\LSI_Products\MegaRAID\tw_devcon_MegaRAID.txt 2>&1
REM   ......................................::.......................................
REM @ECHO ...................."tw_devcon 0x1000 -onu -f lsi_gen2 -l lsi_sas2 -l lsi_sas -l symmpi -l".................. >> %TW-FN%\LSI_Products\HBA\tw_devcon_HBA.txt 2>&1
REM tw_devcon 0x1000 -onu -f lsi_gen2 -l lsi_sas3 -l lsi_sas2 -l lsi_sas -l symmpi -l >> %TW-FN%\LSI_Products\HBA\tw_devcon_HBA.txt 2>&1

REM ###########################################################################################################################
REM # tw_cli /cx show diag - Printlog/Printbuff error screening
REM ###########################################################################################################################

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF EXIST %TW-WS%diag_C%%i.txt %grep% "Check power cycles" %TW-WS%diag_C%%i.txt >> %TW-WS%diag_C%%i_CPC.txt 2>&1
							dir %TW-WS%diag_C%%i_CPC.txt | find /I " 0 diag_C%%i_CPC.txt" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1 del %TW-WS%diag_C%%i_CPC.txt
											  REM   ......................................::.......................................
							IF EXIST %TW-WS%diag_C%%i_CPC.txt @ECHO ..........tw_cli /c%%i show diag - contains Drive Power Cycle Checks............. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							IF EXIST %TW-WS%diag_C%%i_CPC.txt @ECHO ..If the power cycle # is increasing this usually signifies a power supply or backplane problem.. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							IF EXIST %TW-WS%diag_C%%i_CPC.txt type %TW-WS%diag_C%%i_CPC.txt >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							IF EXIST %TW-WS%diag_C%%i_CPC.txt @ECHO ..If the power cycle # is increasing this usually signifies a power supply or backplane problem.. >> %TW-FN%\LSI_Products\3Ware\Check_power_cycles_C%%i.txt 2>&1
							IF EXIST %TW-WS%diag_C%%i_CPC.txt type %TW-WS%diag_C%%i_CPC.txt >> %TW-FN%\LSI_Products\3Ware\Check_power_cycles_C%%i.txt 2>&1
							)
							
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF EXIST %TW-WS%diag_C%%i.txt %grep% "Assert .cpp" %TW-WS%diag_C%%i.txt >> %TW-WS%diag_C%%i_Assert.txt 2>&1
							dir %TW-WS%diag_C%%i_Assert.txt | find /I " 0 diag_C%%i_Assert.txt" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1 del %TW-WS%diag_C%%i_Assert.txt
							REM      				         .................................................::.................................................
							IF EXIST %TW-WS%diag_C%%i_Assert.txt @ECHO .............................tw_cli /c%%i show diag - contains Asserts............................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							IF EXIST %TW-WS%diag_C%%i_Assert.txt @ECHO ..................This is evidence of a possible FW bug, contact your support rep!................. >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							IF EXIST %TW-WS%diag_C%%i_Assert.txt type %TW-WS%diag_C%%i_Assert.txt >> %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 2>&1
							IF EXIST %TW-WS%diag_C%%i_Assert.txt @ECHO ..................This is evidence of a possible FW bug, contact your support rep!................. >> %TW-FN%\LSI_Products\3Ware\Assert_C%%i.txt 2>&1
							IF EXIST %TW-WS%diag_C%%i_Assert.txt type %TW-WS%diag_C%%i_Assert.txt >> %TW-FN%\LSI_Products\3Ware\Assert_C%%i.txt 2>&1
							)
										
					
					

@ECHO End of the 3Ware RAID Controller Data Collection... >> misc_output.txt 2>&1
@ECHO End of the 3Ware RAID Controller Data Collection... > %TW-WS%End_3Ware_Data_Collection.txt
IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_3Ware_Data_Collection.txt >> misc_output.txt 2>&1)
%grep% -c -e 0 -e 1 -e 2 -e 3 -e 4 -e 5 -e 6 -e 7 -e 8 -e 9 %TW-WS%ctrl_nums.txt | %grep% 1 >> misc_output.txt 2>&1
IF ERRORLEVEL 1	(
		IF NOT [%NOWOW64%]==[YES] (@ECHO Cumulative - 3Ware:)
		IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer1\timer1 /s /nologo)
		)

:NO_3Ware_Ctrls



IF [%TWGETSKIPMEGARAID%]==[YES]	GOTO NO_MR_Adapters

IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO START_MR_STORCLI
IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO START_MR_STORCLI
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO START_MR_STORCLI
IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO START_MR_STORCLI
IF [%TWGETPARTIALMODE%]==[G_DPM] GOTO START_MR_STORCLI
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] GOTO START_MR_STORCLI

REM ###########################################################################################################################
REM MegaCli - MegaRAID Adapter Info
REM ###########################################################################################################################



REM Work around for storcli bugs
IF NOT ["%NO_MR_Adps%"]==["YES"]	(
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
												%MR_Cli% /c%%i show | %grep% "iBBU" > %TW-WS%iBBU_TEST_C%%i.txt
												IF NOT ERRORLEVEL 1 @ECHO "iBBU is on Controller" > %TW-WS%iBBU_PRESENT_C%%i.txt
												%MR_Cli% /c%%i show | %grep% "Cachevault_Info" > %TW-WS%iBBU_TEST_C%%i.txt
												IF NOT ERRORLEVEL 1 @ECHO "SuperCaP is on Controller" > %TW-WS%SuperCaP_PRESENT_C%%i.txt
												)
					)

			
	
IF NOT ["%NO_MR_Adps%"]==["YES"]	(
					IF [%USEMEGACLISYNTAX%]==[YES]	(

									@ECHO .
									IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer2\timer2 /q /nologo)
									@ECHO Start of the Optional MegaRAID Adapter Data Collection with MegaCli syntax...
									IF [%NOWOW64%]==[YES] (@ECHO %time%)
									@ECHO Start of the Optional MegaRAID Adapter Data Collection with MegaCli syntax... >> misc_output.txt 2>&1
									@ECHO Start of the Optional MegaRAID Adapter Data Collection with MegaCli syntax... > %TW-WS%Start_MegaRAID_MegaCli.txt
									IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_MegaRAID_MegaCli.txt >> misc_output.txt 2>&1)

									IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
									IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID									
									IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\MegaCli mkdir %TW-FN%\LSI_Products\MegaRAID\MegaCli									

																		
									FOR /F "usebackq" %%i IN (%TW-WS%adp_nums.txt) DO	(
																IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
																@ECHO Start on Adapter %%i...
																@ECHO Start on Adapter %%i... >> misc_output.txt 2>&1
																@ECHO Start on MegaRAID Adapter %%i... > %TW-WS%Start_MegaRAID_Adapter_%%i.txt
																IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_MegaRAID_Adapter_%%i.txt >> misc_output.txt 2>&1)
																
																%MR_Cli% ldgetnum a%%i nolog > %TW-WS%ldgetnum_A%%i.txt
																%grep% "Number" %TW-WS%ldgetnum_A%%i.txt >> %TW-WS%ldgetnum1_A%%i.txt
																FOR /F "tokens=9 delims= " %%j in (%TW-WS%ldgetnum1_A%%i.txt) DO (@ECHO %%j >> %TW-WS%num_lds_A%%i.txt)
																
																FOR /F "usebackq" %%j IN (%TW-WS%Num_Lds_A%%i.txt) DO	(
																							FOR /L %%k IN (0,1,255) DO	( 
																											IF %%k LSS %%j @ECHO %%k >> %TW-WS%ld_numbers_A%%i.txt 
																											)
																							)
				
																%MR_Cli% encinfo a%%i nolog > %TW-WS%encinfo_A%%i.txt
																%grep% "Device ID" %TW-WS%encinfo_A%%i.txt >> %TW-WS%encinfo1_A%%i.txt
																FOR /F "tokens=3 delims=: " %%j in (%TW-WS%encinfo1_A%%i.txt) DO (@ECHO %%j >> %TW-WS%enclosure_numbers_A%%i.txt)
																
																%MR_Cli% phyerrorcounters a%%i nolog > %TW-WS%phyerrorcounters_A%%i.txt
																%grep% "Phy No:" %TW-WS%phyerrorcounters_A%%i.txt >> %TW-WS%phyerrorcounters1_A%%i.txt
																FOR /F "tokens=3 delims= " %%j in (%TW-WS%phyerrorcounters1_A%%i.txt) DO (@ECHO %%j >> %TW-WS%phy_nums_A%%i.txt)
																
																%MR_Cli% adpgetpciinfo a%%i nolog > %TW-WS%adpgetpciinfo_A%%i.txt
																
																
																@ECHO %TW-FN% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\pdlist_A%%i.txt
																%MR_Cli% pdlist a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\pdlist_A%%i.txt
																%grep% "Device Id:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\pdlist_A%%i.txt >> %TW-WS%pdlist1_A%%i.txt
																FOR /F "tokens=3 delims= " %%j in (%TW-WS%pdlist1_A%%i.txt) DO (@ECHO %%j >> %TW-WS%disk_dev_id_numbers_A%%i.txt)
																
																@ECHO %TW-FN% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAllInfo_A%%i.txt
																REM   ......................................::.......................................
																@ECHO ...........................MegaCli adpallinfo a%%i............................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAllInfo_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt
																%MR_Cli% adpallinfo a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO %TW-FN% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAlILog_A%%i.txt
																REM   ......................................::.......................................																
																@ECHO ............................MegaCli adpalilog a%%i............................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAlILog_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAlILog_A%%i.txt
																%MR_Cli% adpalilog a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAlILog_A%%i.txt 2>&1
																
																IF EXIST %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAllInfo_A%%i.txt %grep% "FW Package Build:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAllInfo_A%%i.txt > %TW-WS%fwA%%i_pre.txt 2>&1
																IF EXIST %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAlILog_A%%i.txt %grep% "Driver version:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAlILog_A%%i.txt > %TW-WS%drvVA%%i_pre.txt 2>&1
																IF EXIST %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAlILog_A%%i.txt %grep% "Driver Name:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\AdpAlILog_A%%i.txt > %TW-WS%drvNA%%i_pre.txt 2>&1
																IF EXIST %TW-WS%fwA%%i_pre.txt FOR /F "tokens=4 delims= " %%j in (%TW-WS%fwA%%i_pre.txt) DO @ECHO %%j > %TW-WS%fwA%%i.txt
																IF EXIST %TW-WS%drvVA%%i_pre.txt FOR /F "tokens=3 delims= " %%j in (%TW-WS%drvVA%%i_pre.txt) DO @ECHO %%j > %TW-WS%drvVA%%i.txt
																IF EXIST %TW-WS%drvNA%%i_pre.txt FOR /F "tokens=3 delims= " %%j in (%TW-WS%drvNA%%i_pre.txt) DO @ECHO %%j > %TW-WS%drvNA%%i.txt
																
																@ECHO %TW-FN% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																REM   ......................................::.......................................
																@ECHO ...............................MegaCli adpcount................................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% adpcount nolog | %grep% Count: >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																
																@ECHO ..................................Adapter A%%i................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																REM   ......................................::.......................................
																IF EXIST %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt	(
																							%grep% "Product Name    :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Memory Size     :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Host Interface  :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Serial No       :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "SAS Address     :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "FW Package Build:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "FW Version      :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Mfg. Date       :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "BBU             :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Battery FRU     :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Serial Debugger :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "On board Expander:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "On board Expander FW version :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							IF EXIST %TW-WS%drvNA%%i_pre.txt type %TW-WS%drvNA%%i_pre.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							IF EXIST %TW-WS%drvVA%%i_pre.txt type %TW-WS%drvVA%%i_pre.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM   ......................................::.......................................
																							@ECHO ..................................PCI Info..................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Bus Number      :" %TW-WS%adpgetpciinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Device Number   :" %TW-WS%adpgetpciinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Function Number :" %TW-WS%adpgetpciinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM   ......................................::.......................................
																							@ECHO ....................................Errors..................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Memory Correctable Errors   :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Memory Uncorrectable Errors :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Any Offline VD Cache Preserved   :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM %grep% "ECC Bucket Count                 :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM   ......................................::.......................................
																							@ECHO .................................Rate SETtings................................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM %grep% "Ecc Bucket Size                  :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM %grep% "Ecc Bucket Leak Rate             :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Predictive Fail Poll Interval    :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM %grep% "Interrupt Throttle Active Count  :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM %grep% "Interrupt Throttle Completion    :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Rebuild Rate                     :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "PR Rate                          :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM @ECHO Note: Resynch Rate is BgiRate >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "BGI Rate                         :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Check Consistency Rate           :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Reconstruction Rate              :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Physical Drive Coercion Mode     :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							
																							REM   ......................................::.......................................
																							@ECHO .................................Performance................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Cache Flush Interval             :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Host Request Reordering          :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Load Balance Mode                :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpgetprop NCQDsply a%%i nolog | %grep% "NCQ" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop WBSupport a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop perfmode a%%i nolog | %grep% "Perf Tuned Mode :" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							REM   ......................................::.......................................
																							
																							REM   ......................................::.......................................
																							@ECHO ....................Enclosures/Backplanes and Connectors....................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Auto Detect BackPlane Enabled    :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpgetprop ExposeEnclDevicesEnbl a%%i nolog | %grep% "Expose" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetconnectormode connectorall a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							
																							REM   ......................................::.......................................
																							@ECHO .............................Alarms and Warnings............................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Alarm                            :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Battery Warning                  :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							
																							REM   ......................................::.......................................
																							@ECHO .............................Rebuild and Hotspare.............................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Auto Rebuild                     :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Restore HotSpare on Insertion    :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpgetprop AutoEnhancedImportDsply a%%i nolog | %grep% "Auto" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop MaintainPdFailHistoryEnbl a%%i nolog | %grep% "Maintain" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							REM   ......................................::.......................................
																							@ECHO ...................................Copy Back................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpgetprop CopyBackDsbl a%%i nolog | %grep% "Copyback" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop SMARTCpyBkEnbl a%%i nolog | %grep% "Copyback" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop SSDSMARTCpyBkEnbl a%%i nolog | %grep% "Copyback" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							REM   ......................................::.......................................
																							@ECHO ..................................PR and CC.................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Enable SSD Patrol Read" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpgetprop PrCorrectUncfgdAreas a%%i nolog | %grep% "Unconfigured" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop AbortCCOnError a%%i nolog | %grep% "Abort" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							
																							REM   ......................................::.......................................
																							@ECHO ...............................ELF/Advanced SW................................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% elf getsafeid a%%i nolog | %grep% "Safe" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% elf rehostinfo a%%i nolog | %grep% "Needs" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% elf ControllerFeatures a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							REM   ......................................::.......................................
																							@ECHO ..................................Encryption................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Security Key Assigned            :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Security Key Failed              :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Security Key Not Backedup        :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpgetprop UseFDEOnlyEncrypt a%%i nolog | %grep% "FDE Only Encryption:" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							REM   ......................................::.......................................
																							@ECHO ...............................Power Management................................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Max Drives to Spinup at One Time :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Delay Among Spinup Groups        :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							@ECHO #### Dimmer Switch 1 >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpgetprop EnblSpinDownUnConfigDrvs a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							@ECHO #### Dimmer Switch 2 >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpgetprop DsblSpinDownHSP a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							@ECHO #### Dimmer Switch 3 >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpgetprop DefaultLdPSPolicy a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop DisableLdPsInterval a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop DisableLdPsTime a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop SpinDownTime a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop SpinUpEncDrvCnt a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpgetprop SpinUpEncDelay a%%i nolog | %grep% "Adapter" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							REM   ......................................::.......................................
																							@ECHO ...................................BIOS/Boot................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%MR_Cli% adpbios dsply a%%i nolog | %grep% "BIOS" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							%MR_Cli% adpbootdrive get a%%i nolog | %grep% "boot" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							REM %grep% "Cluster Mode                     :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							REM   ......................................::.......................................
																							@ECHO ....................................Drives..................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Virtual Drives    :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Degraded        :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Offline         :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Physical Devices  :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Disks           :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Critical Disks  :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							%grep% "Failed Disks    :" %TW-FN%\LSI_Products\MegaRAID\MegaCli\adpallinfo_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							)
				
				
																@ECHO ........................Adapter/System Time Sync A%%i............................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																REM   ......................................::.......................................
																@ECHO Adapter Date/Time: >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% adpgettime a%%i nolog | %grep% "Date: Time:"  >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@ECHO System Date: >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																date /T >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@ECHO System Time: >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																time /T >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																
																REM   ......................................::.......................................
																
																@ECHO .......................MegaCli getpreservedcachelist A%%i........................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% getpreservedcachelist a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																
																IF EXIST %TW-WS%ld_numbers_A%%i.txt	(
																					FOR /F "usebackq" %%j IN (%TW-WS%ld_numbers_A%%i.txt) DO	(
																													REM   ......................................::.......................................
																													@ECHO ............................MegaCli ldinfo l%%j a%%i............................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																													@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																													%MR_Cli% ldinfo l%%j a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																													REM   ......................................::.......................................
																													@ECHO .....................MegaCli ldgetprop consistency l%%j a%%i....................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																													@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																													%MR_Cli% ldgetprop consistency l%%j a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																													REM   ......................................::.......................................
																													@ECHO .......................MegaCli ldgetprop pspolicy l%%j a%%i........................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																													@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																													%MR_Cli% ldgetprop pspolicy l%%j a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																													REM   ......................................::.......................................
																													@ECHO ...........................Init/CC/Recon Status l%%j a%%i........................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																													@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 
																													%MR_Cli% ldinit showprog l%%j a%%i nolog | %grep% "Initialization" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																													%MR_Cli% ldbi showprog l%%j a%%i nolog | %grep% "Background" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																													%MR_Cli% ldcc showprog l%%j a%%i nolog | %grep% "Check" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																													%MR_Cli% ldrecon showprog l%%j a%%i nolog | %grep% "Reconstruction" >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																													REM   ......................................::.......................................
																													)
																					)
																@ECHO ............................MegaCli adppr info a%%i.............................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% adppr info a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ..........................MegaCli adpccsched info a%%i........................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% adpccsched info a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ............................MegaCli pdgetmissing a%%i............................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% pdgetmissing a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ...........................Logical and Physical Disks.......................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% ldpdinfo a%%i nolog | %grep% "RAID Drives: PD: ID: Slot Id:"  >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ...........................Physical Disk - Slot Number......................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "Slot Number:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ...........................Physical Disk - Device Id........................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "Device Id:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ..........................Physical Disk - Inquiry Data......................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "Inquiry Data:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ..........................Physical Disk - SAS Address.......................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "SAS Address" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO .........................Physical Disk - Firmware state........................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "Firmware state:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO .........................Physical Disk - Foreign State......................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "Foreign State:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ....................Physical Disk - Predictive Failure Count................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "Predictive Failure Count:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ..........................Physical Disk - Link Speed........................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "Link Speed:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ..............................Physical Disk - Type............................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "PD Type:" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO .............................Physical Disk - Common............................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%grep% "RAID Drives: PD: ID: Slot Id: Inquiry Firmware Failure Link PD" %TW-FN%\LSI_Products\MegaRAID\MegaCli\PDList_A%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																
																@ECHO Collecting Enclosure Information for Adapter A%%i with MegaCli syntax...
																
																REM   ......................................::.......................................
																@ECHO ..............................MegaCli encinfo a%%i............................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% encinfo a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																
																@ECHO Collecting Information for Adapter A%%i with MegaCli syntax...
																
																REM Causes fault on storcli 1.06.03 with CV
																IF EXIST %TW-WS%iBBU_PRESENT_C%%i.txt	(
																					REM   ......................................::.......................................
																					@ECHO .............................MegaCli adpbbucmd a%%i.............................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																					@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																					%MR_Cli% adpbbucmd a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																					)												
																REM   ......................................::.......................................
																@ECHO .........................MegaCli cfgforeign scan a%%i............................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% cfgforeign scan a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO .........................MegaCli cfgforeign dsply a%%i........................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% cfgforeign dsply a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																@ECHO ........................MegaCli cfgforeign preview a%%i.......................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% cfgforeign preview a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																
																@ECHO .........................MegaCli cfgfreespaceinfo a%%i........................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% cfgfreespaceinfo a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																
																@ECHO .....................MegaCli cfgsave -f cfgsave_A%%i.cfg a%%i.................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% cfgsave -f %TW-FN%\LSI_Products\MegaRAID\MegaCli\cfgsave_A%%i.cfg a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																
																@ECHO .....................MegaCli adpeventlog geteventloginfo a%%i.................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% adpeventlog geteventloginfo a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																																				
																@ECHO ..............................MegaCli cfgdsply a%%i.............................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% cfgdsply a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																@ECHO Collecting Logical Disk Information for Adapter A%%i with MegaCli syntax...
																REM   ......................................::.......................................
																@ECHO ..............................MegaCli ldpdinfo a%%i.............................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% ldpdinfo a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																
																
																@ECHO ..........................MegaCli phyerrorcounters a%%i.......................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% phyerrorcounters a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																
																IF EXIST %TW-WS%phy_nums_A%%i.txt	(
																					FOR /F "usebackq" %%j IN (%TW-WS%phy_nums_A%%i.txt) DO	(
																												REM   ......................................::.......................................
																												@ECHO ...........................MegaCli phyinfo phy%%j a%%i........................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																												@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																												%MR_Cli% phyinfo phy%%j a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																												)
																					)
																
																REM   ......................................::.......................................
																@ECHO .......................MegaCliEnd_Step_1_Expanderectpdmapping dsply a%%i........................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli%End_Step_1_Expanderectpdmapping dsply a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																
																@ECHO Collecting Physical Disk Information for Adapter A%%i with MegaCli syntax...	
																REM   ......................................::.......................................
																@ECHO .............................MegaCli pdlist a%%i................................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																%MR_Cli% pdlist a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM   ......................................::.......................................
																
																IF EXIST MegaOEM.exe	(
																			REM   ......................................::.......................................
																			@ECHO ...................................MegaOEM -v.................................... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																			megaoem -v >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																			@ECHO ..............MegaOEM adpSETtings write -f INI_Settings_A%%i.ini a%%i............ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																			@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																			megaoem adpsettings write -f %TW-FN%\LSI_Products\MegaRAID\MegaCli\INI_Settings_A%%i.ini a%%i nolog>> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																			)
																
																IF NOT EXIST MegaOEM.exe	(
																				MegaOEM -v >> misc_output.txt 2>&1
																				IF NOT ERRORLEVEL 1	(
																							REM   ......................................::.......................................
																							@ECHO ....................................MegaOEM -v................................. >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							megaoem -v >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							@ECHO ............MegaOEM adpsettings write -f INI_Settings_path_A%%i.ini a%%i.......... >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																							megaoem adpsettings write -f %TW-FN%\LSI_Products\MegaRAID\MegaCli\INI_Settings_path_A%%i.ini a%%i nolog>> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																							)
																				)
																
																@ECHO Collecting Internal Logs for Adapter A%%i with MegaCli syntax...
																REM   ......................................::.......................................
																@ECHO .........................MegaCli fwtermlog dsply a%%i............................ >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																%MR_Cli% fwtermlog dsply a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																@@ECHO %time% >> %TW-FN%\LSI_Products\MegaRAID\MegaCli\Adapter_A%%i.txt 2>&1
																REM @ECHO %TW-FN% >> %TW-FN%\LSI_Products\MegaRAID\fwtermlog_A%%i.txt 2>&1
																REM %MR_Cli% fwtermlog dsply a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\fwtermlog_A%%i.txt 2>&1
																
																@ECHO End on Controller %%i... >> misc_output.txt 2>&1
																@ECHO End on MegaRAID Adapter %%i... > %TW-WS%End_MegaRAID_Adapter_%%i.txt
																IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_MegaRAID_Adapter_%%i.txt >> misc_output.txt 2>&1)
																IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
																																									
																
																REM Close - adpnums					
																)

									REM Close - USEMEGACLISYNTAX	
									)
			
					REM Close - YES MRaid Adapters 
					)
						
IF NOT ["%NO_MR_Adps%"]==["YES"]	(
					IF [%USEMEGACLISYNTAX%]==[YES]	(
									@ECHO .
									@ECHO End of the Optional MegaRAID Adapter Data Collection with MegaCli syntax... >> misc_output.txt 2>&1
									@ECHO End of the Optional MegaRAID Adapter Data Collection with MegaCli syntax... > %TW-WS%End_Optional_MegaRAID.txt
									IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_Optional_MegaRAID.txt >> misc_output.txt 2>&1)
									%grep% -c -e 0 -e 1 -e 2 -e 3 %TW-WS%adp_nums.txt | %grep% 1 >> misc_output.txt 2>&1
									IF ERRORLEVEL 1	(
											IF NOT [%NOWOW64%]==[YES] (@ECHO Cumulative - MegaCli Syntax:)
											IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer2\timer2 /s /nologo)
											)
									)
					)


REM ###########################################################################################################################
REM storcli - MegaRAID Adapter Info
REM ###########################################################################################################################



:START_MR_STORCLI

IF ["%NO_MR_Adps%"]==["YES"]	(GOTO NO_MR_Adapters)

IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO MR_E_AEC
IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO MR_E_DPM
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO MR_E_AEC


GOTO MR_NOT_E_AEC
:MR_E_AEC
FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
							%MR_Cli% adpaec disable a%%i nolog > %TW-WS%c%%i_show_capture_mr.txt 
							IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%mr_ctrl_nums_aec.txt
							)



IF EXIST %TW-WS%mr_ctrl_nums_aec.txt	(
					@ECHO .
					@ECHO Clearing and Enabling Advanced Event Capture "AEC" for MegaRAID... 
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums_aec.txt) DO	(
													%MR_Cli% adpaec disable a%%i nolog >> misc_output.txt 2>&1
													%MR_Cli% adpaec start numevents 150000 a%%i nolog >> misc_output.txt 2>&1
													)
					)
:MR_NOT_E_AEC
IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO END_No_Pause
IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO MR_E_DPM
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO MR_E_DPM
GOTO MR_NOT_E_DPM
:MR_E_DPM

REM ###########################################################################################################################
REM # Determine # of ports & which controllers support dpmstat.
REM # Clearing and Enabling DPMSTAT
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
							%MR_Cli% adpgetprop dpmenable a%%i nolog > %TW-WS%c%%i_show_pmstat_mr.txt 2>&1
							%grep% "DPM is " %TW-WS%c%%i_show_pmstat_mr.txt  > %TW-WS%c%%i_show_pmstat_enbld_mr.txt
							IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%mr_ctrl_nums_pmstat.txt
							)

IF EXIST %TW-WS%mr_ctrl_nums_pmstat.txt	(
					@ECHO .
					@ECHO Clearing and Enabling Disk Performance Monitoring Statistics "DPMSTAT" for MegaRAID...
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums_pmstat.txt) DO	(
													%MR_Cli% dpmstat clear lct a%%i nolog >> misc_output.txt 2>&1
													%MR_Cli% dpmstat clear hist a%%i nolog >> misc_output.txt 2>&1
													%MR_Cli% dpmstat clear ra a%%i nolog >> misc_output.txt 2>&1
													%MR_Cli% dpmstat clear ext a%%i nolog >> misc_output.txt 2>&1
													%MR_Cli% adpsetprop dpmenable 1 a%%i nolog >> misc_output.txt 2>&1
													)
													
					)

					
:MR_NOT_E_DPM
IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO MR_G_AEC
IF [%TWGETPARTIALMODE%]==[G_DPM] GOTO MR_G_DPM
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] GOTO MR_G_AEC
IF [%TWGETPARTIALMODE%]==[STANDARD] GOTO MR_G_AEC
IF [%TWGETPARTIALMODE%]==[MONITOR] GOTO MR_G_AEC
REM GOTO END is for E_*
GOTO END_No_Pause
:MR_G_AEC

REM ###########################################################################################################################
REM # Disabling AEC and capturing logs - Must be first or IOCTLs pollute capture.
REM # TWGETPARTIALMODE = G_* gets AEC/DPMSTAT regardless of state.
REM # TWGETPARTIALMODE = STANDARD/MONITOR gets AEC/DPMSTAT only if Enabled. 
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
							IF [%TWGETPARTIALMODE%]==[STANDARD] %MR_Cli% adpaec show a%%i nolog > %TW-WS%c%%i_show_capture_mr.txt 2>&1
							IF [%TWGETPARTIALMODE%]==[STANDARD]	(
												%grep% "AEC enabled : Yes" %TW-WS%c%%i_show_capture_mr.txt  > %TW-WS%c%%i_show_capture_enabled_mr.txt 2>&1
												IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%mr_ctrl_nums_aec.txt							
												)
							IF NOT [%TWGETPARTIALMODE%]==[STANDARD] (
												%MR_Cli% adpaec stop a%%i nolog >> misc_output.txt 2>&1
												IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%mr_ctrl_nums_aec.txt
												)
							)

IF EXIST %TW-WS%mr_ctrl_nums_aec.txt GOTO MR_AEC_EXISTS
GOTO MR_AEC_DOES_NOT_EXIST
:MR_AEC_EXISTS
@ECHO .
@ECHO Disabling and Getting Advanced Event Capture "AEC" for MegaRAID...

FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums_aec.txt) DO (%MR_Cli% adpaec stop a%%i nolog >> misc_output.txt 2>&1)

FOR /L %%i IN (0,1,11) DO (IF EXIST evtcapture_c%%i.dat SET MR_OLD_EVT_CAP_EXIST=YES)

IF [%MR_OLD_EVT_CAP_EXIST%] == [YES]	(
					IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
					IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID
					IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\OldAEC mkdir %TW-FN%\LSI_Products\MegaRAID\OldAEC
					FOR /L %%i IN (0,1,11) DO	(
									IF EXIST evtcapture_c%%i.dat copy evtcapture_c%%i.dat %TW-FN%\LSI_Products\MegaRAID\OldAEC >> misc_output.txt 2>&1
									IF EXIST evtcapture_c%%i.dat del evtcapture_c%%i.dat >> misc_output.txt 2>&1
									)
					)

FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums_aec.txt) DO	(
								%MR_Cli% adpaec get -f evtcapture_c%%i.dat a%%i nolog >> misc_output.txt 2>&1
								%MR_Cli% adpaec disable a%%i nolog >> misc_output.txt 2>&1
								)

FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums_aec.txt) DO (IF EXIST evtcapture_c%%i.dat SET MR_NEW_EVT_CAP_EXIST=YES)

IF [%MR_NEW_EVT_CAP_EXIST%] == [YES]	(
					IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
					IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID
					IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\AEC mkdir %TW-FN%\LSI_Products\MegaRAID\AEC
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums_aec.txt) DO	(
													IF EXIST evtcapture_c%%i.dat copy evtcapture_c%%i.dat %TW-FN%\LSI_Products\MegaRAID\AEC >> misc_output.txt 2>&1
													IF EXIST evtcapture_c%%i.dat del evtcapture_c%%i.dat >> misc_output.txt 2>&1
	
													)
					)
:MR_AEC_DOES_NOT_EXIST

:MR_G_DPM

REM ###########################################################################################################################
REM # Determine # of controllers that support pmstat
REM # TWGETPARTIALMODE = G_* gets AEC/DPMSTAT regardless of state.
REM # TWGETPARTIALMODE = STANDARD gets AEC/DPMSTAT only if Enabled.
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
							IF [%TWGETPARTIALMODE%]==[STANDARD] %MR_Cli% adpgetprop dpmenable a%%i nolog > %TW-WS%c%%i_show_pmstat_mr.txt 2>&1
							IF [%TWGETPARTIALMODE%]==[STANDARD]	(
												%grep% "DPM is Enabled on Adapter" %TW-WS%c%%i_show_pmstat_mr.txt  > %TW-WS%c%%i_show_pmstat_enbld_mr.txt
												IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%mr_ctrl_nums_pmstat.txt
												)
							IF NOT [%TWGETPARTIALMODE%]==[STANDARD] %MR_Cli% adpgetprop dpmenable a%%i nolog > %TW-WS%c%%i_show_pmstat_mr.txt 2>&1
							IF NOT [%TWGETPARTIALMODE%]==[STANDARD]	(%grep% "DPM is " %TW-WS%c%%i_show_pmstat_mr.txt  > %TW-WS%c%%i_show_pmstat_enbld_mr.txt
												IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%mr_ctrl_nums_pmstat.txt
												)
							)


IF EXIST %TW-WS%mr_ctrl_nums_pmstat.txt	(
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums_pmstat.txt) DO	(
													%MR_Cli% /c%%i show j | %grep% "EID:Slt" > %TW-WS%c%%i_show_pmstat_eidslt1_mr.txt 2>&1
													FOR /F delims^=^"^ tokens^=4 %%j IN (%TW-WS%c%%i_show_pmstat_eidslt1_mr.txt) DO @ECHO %%j >> %TW-WS%c%%i_show_pmstat_eidslt_mr.txt 2>&1	
													)
					)

IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO MR_NOT_G_DPM

IF EXIST %TW-WS%mr_ctrl_nums_pmstat.txt	(
					@ECHO .
					@ECHO Disabling and Getting Disk Performance Monitoring Statistics "DPMSTAT" for MegaRAID...
					IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
					IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID
					IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\PMSTAT mkdir %TW-FN%\LSI_Products\MegaRAID\PMSTAT

					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums_pmstat.txt) DO	(
													%MR_Cli% adpsetprop dpmenable 0 a%%i nolog >> misc_output.txt 2>&1
													IF EXIST %TW-WS%c%%i_show_pmstat_eidslt_mr.txt	(
																			FOR /F "usebackq" %%j IN (%TW-WS%c%%i_show_pmstat_eidslt_mr.txt) DO	(
																												%MR_Cli% adpsetprop dpmenable 0 a%%i nolog >> misc_output.txt 2>&1
																												REM   ......................................::.......................................
																												@ECHO .............storcli dpmstat dsply lct physdrv[%%j] a%%i nolog.................... >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_LCT_C%%i.txt 2>&1
																												@ECHO . >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_LCT_C%%i.txt 2>&1
																												%MR_Cli% dpmstat dsply lct physdrv[%%j] a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_LCT_C%%i.txt 2>&1
																												
																												REM   ......................................::.......................................
																												@ECHO ..............storcli dpmstat dsply hist physdrv[%%j] a%%i nolog.................. >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_HIST_C%%i.txt 2>&1
																												@ECHO . >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_HIST_C%%i.txt 2>&1
																												%MR_Cli% dpmstat dsply hist physdrv[%%j] a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_HIST_C%%i.txt 2>&1
																												
																												REM   ......................................::.......................................
																												@ECHO ...............storcli dpmstat dsply ra physdrv[%%j] a%%i nolog................... >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_RA_C%%i.txt 2>&1
																												@ECHO . >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_RA_C%%i.txt 2>&1
																												%MR_Cli% dpmstat dsply ra physdrv[%%j] a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_RA_C%%i.txt 2>&1
																												
																												REM   ......................................::.......................................
																												@ECHO ...............storcli dpmstat dsply ext physdrv[%%j] a%%i nolog.................. >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_EXT_C%%i.txt 2>&1
																												@ECHO . >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_EXT_C%%i.txt 2>&1
																												%MR_Cli% dpmstat dsply ext physdrv[%%j] a%%i nolog >> %TW-FN%\LSI_Products\MegaRAID\PMSTAT\PMSTAT_EXT_C%%i.txt 2>&1
																												)
																			)			
													)				
					)	


:MR_NOT_G_DPM

@ECHO .
IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer3\timer3 /q /nologo)
@ECHO Starting the MegaRAID Controller Data Collection...
IF [%NOWOW64%]==[YES] (@ECHO %time%)
@ECHO Starting the MegaRAID Controller Data Collection with storcli... >> misc_output.txt 2>&1
@ECHO Starting the MegaRAID Controller Data Collection with storcli... > %TW-WS%Start_MegaRAID_storcli.txt
IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_MegaRAID_storcli.txt >> misc_output.txt 2>&1)

IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID

									

REM   ......................................::.......................................
@ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt
@ECHO ......................storcli /call/eall/sall show all......................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt	
%MR_Cli% /call/eall/sall show all >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt 2>&1
@ECHO .....................storcli /call/eall/sall show smart........................ >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt	
%MR_Cli% /call/eall/sall show smart >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt 2>&1
REM   ......................................::.......................................
@ECHO .................storcli /call/eall/sall show phyerrorcounters................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt	
%MR_Cli% /call/eall/sall show phyerrorcounters >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt 2>&1
IF EXIST %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt	(
									@ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									
									REM   ......................................::.......................................
									
									@ECHO ....................................Drives..................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%MR_Cli% /Call/eall/sall show | %grep% -e "SATA" -e "SAS"  >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
	
									REM   ......................................::.......................................
									@ECHO .................................Shield Counter................................ >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Shield Counter =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ................................Media Error Count.............................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Media Error Count =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ...............................Other Error Count............................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Other Error Count =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ..............................Drive Temperature................................ >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Drive Temperature =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ............................Predictive Failure Count........................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Predictive Failure Count =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO .........................S.M.A.R.T alert flagged by drive...................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "S.M.A.R.T alert flagged by drive =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ......................................SN....................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "SN =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ......................................WWN...................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "WWN =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ...............................Firmware Revision............................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Firmware Revision =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ...................................Raw size.................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Raw size =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO .................................Coerced size.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Coerced size =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ...............................Non Coerced size................................ >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Non Coerced size =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO .................................Device Speed.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Device Speed =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ..................................Link Speed................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Link Speed =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ................................Drive write cache.............................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Drive write cache =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ..............................Logical Sector Size.............................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Logical Sector Size =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO .............................Physical Sector Size.............................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Physical Sector Size =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ................................Drive position................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Drive position =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ...............................Enclosure position.............................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Enclosure position =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ..............................Connected Port Number............................ >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Connected Port Number =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ................................Sequence Number................................ >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Sequence Number =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ..............................Commissioned Spare............................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Commissioned Spare =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ...............................Emergency Spare................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Emergency Spare =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ..................Last Predictive Failure Event Sequence Number................ >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Last Predictive Failure Event Sequence Number =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO .....................Successful diagnostics completion on...................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Successful diagnostics completion on =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO .................................SED Capable................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "SED Capable =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO .................................SED Enabled................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "SED Enabled =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ...................................Secured..................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Secured =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ....................................Locked..................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Locked =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO .............................Needs EKM Attention............................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Needs EKM Attention =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO .................................PI Eligible................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "PI Eligible =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ..............................Wide Port Capable................................ >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% "Wide Port Capable =" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									REM   ......................................::.......................................
									@ECHO ....................Port # - Status - Linkspeed - SAS Address.................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%grep% -e "Gb/s 0x" -e "Gb/s  0x" -e "Gb/s   0x" -e "Gb/s    0x" %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-plus.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
	
									REM   ......................................::.......................................
									@ECHO .................................Inquiry Data.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									%MR_Cli% /Call/eall/sall show all j | %grep% "Inquiry Data"  >> %TW-FN%\LSI_Products\MegaRAID\Call_Eall_Sall_show_all-Compare-All-Parms.txt
									)


FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
							IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
							@ECHO Start on Controller %%i...
							@ECHO Start on Controller %%i... >> misc_output.txt 2>&1
							@ECHO Start_on_Controller_%%i...1 >> misc_output.txt 2>&1
							@ECHO Start on MegaRAID Controller %%i... > %TW-WS%Start_MegaRAID_Controller_%%i.txt
							IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_MegaRAID_Controller_%%i.txt >> misc_output.txt 2>&1)
 
							REM   ......................................::.......................................
							@ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt												
							@ECHO .............................storcli /C%%i show all.............................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt	
							%MR_Cli% /c%%i show all >> %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt 2>&1

							IF NOT [%TWGETPARTIALMODE%]==[STANDARD] GOTO TWPARTIALMODE
							@ECHO Start_on_Controller_%%i...2 >> misc_output.txt 2>&1
							REM   ......................................::.......................................
							@ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt
							@ECHO .........................storcli /C%%i/eall/sall show all........................ >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt
							%MR_Cli% /c%%i/eall/sall show all >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt 2>&1
							@ECHO .....................storcli /call/eall/sall show smart........................ >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt
							%MR_Cli% /call/eall/sall show smart >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt 2>&1
							REM   ......................................::.......................................
							@ECHO .................storcli /call/eall/sall show phyerrorcounters................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt
							%MR_Cli% /call/eall/sall show phyerrorcounters >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt 2>&1


							@ECHO Start_on_Controller_%%i...3 >> misc_output.txt 2>&1
							%MR_Cli% /c%%i show all >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt 2>&1
						

							@ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\alilog_C%%i.txt												
							REM   ......................................::.......................................
							@ECHO ..........................storcli /C%%i show alilog.............................. >> %TW-FN%\LSI_Products\MegaRAID\alilog_C%%i.txt
							%MR_Cli% /c%%i show alilog >> %TW-FN%\LSI_Products\MegaRAID\alilog_C%%i.txt 2>&1



							@ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt												
							REM   ......................................::.......................................
							@ECHO ................................storcli show all............................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
							%MR_Cli% show all >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1

							IF EXIST %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt	(
															REM   ......................................::.......................................
															@ECHO .....................................Time...................................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
															%grep% "Current Controller Date/Time" %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
															%grep% "Current System Date/time" %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
															)
							
							@ECHO Start_on_Controller_%%i...4 >> misc_output.txt 2>&1
							REM   ......................................::.......................................
							@ECHO ...............................storcli /C%%i show................................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
							%MR_Cli% /C%%i show >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1

							%MR_Cli% /C%%i show termlog | %grep% "PCIE Link Status/Ctrl" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ...............................PCI-E Link Speed................................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show termlog | %grep% "PCIE Link Status/Ctrl" >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)


							REM   ......................................::.......................................
							@ECHO ............................storcli /C%%i show bios.............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
							%MR_Cli% /C%%i show bios >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
							@ECHO Start_on_Controller_%%i...5 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i/vall show | %grep% "No VDs have been configured" >> misc_output.txt 2>&1
							IF ERRORLEVEL 1	(
									@ECHO Start_on_Controller_%%i...6 >> misc_output.txt 2>&1
									%MR_Cli% /C%%i show preservedcache | %grep% "Status = Success" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO .......................storcli /C%%i show preservedcache......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i show preservedcache >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)

									%MR_Cli% /C%%i/vall show all | %grep% "Status = Success" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO ...........................storcli /C%%i/vall show all........................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/vall show all >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)

									%MR_Cli% /c%%i/vall show bbmt | %grep% "Status = Success" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(		
												REM   ......................................::.......................................
												@ECHO ..........................storcli /C%%i/Vall show bbmt........................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt	
												%MR_Cli% /c%%i/vall show bbmt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)
									@ECHO Start_on_Controller_%%i...7 >> misc_output.txt 2>&1
									%MR_Cli% /c%%i/vall show autobgi | %grep% "Status = Success" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO .........................storcli /C%%i/Vall show autobgi......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt	
												%MR_Cli% /c%%i/vall show autobgi >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1		
												)						

									%MR_Cli% /C%%i/vall show expansion | %grep% "Status = Success" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO .............................VD Expansion Status............................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/vall show expansion >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)

									%MR_Cli% /C%%i/vall show bgi | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO .....................VD Background Initialization Status....................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/vall show bgi | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)
									@ECHO Start_on_Controller_%%i...8 >> misc_output.txt 2>&1
									%MR_Cli% /C%%i/vall show cc | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO ..........................VD Consistency Check Status.......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/vall show cc | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)
		
									%MR_Cli% /C%%i/vall show erase | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO ...............................VD Erase Status................................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/vall show erase | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)
	
									%MR_Cli% /C%%i/vall show init | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO ............................VD Initialization Status........................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/vall show init | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)
		
									%MR_Cli% /C%%i/vall show migrate | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO ..............................VD Migration Status.............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/vall show migrate | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)
									@ECHO Start_on_Controller_%%i...9 >> misc_output.txt 2>&1
									%MR_Cli% /C%%i/eall/sall show copyback | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO ...............................copyback Status................................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/eall/sall show copyback | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)

									%MR_Cli% /C%%i/eall/sall show rebuild | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1	(
												REM   ......................................::.......................................
												@ECHO ................................Rebuild Status................................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/eall/sall show rebuild | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)
									@ECHO Start_on_Controller_%%i...10 >> misc_output.txt 2>&1
									)

							%MR_Cli% /C%%i/eall/sall show erase | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ...............................Drive Erase Status.............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i/eall/sall show erase | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)
							@ECHO Start_on_Controller_%%i...11 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i/eall/sall show initialization | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ..........................Drive Initialization Status.......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i/eall/sall show initialization | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i/eall/sall show securitykey keyid | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .....................storcli /C%%ishow securitykey keyid......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i/eall/sall show securitykey keyid | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)
							@ECHO Start_on_Controller_%%i...12 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show freespace | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										@ECHO Start_on_Controller_%%i...12A >> misc_output.txt 2>&1
										REM   ......................................::.......................................
										@ECHO .........................storcli /C%%i show freespace............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show freespace >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										@ECHO Start_on_Controller_%%i...12B >> misc_output.txt 2>&1
										)

							@ECHO Start_on_Controller_%%i...12C >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show health all | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(						
										@ECHO Start_on_Controller_%%i...12D >> misc_output.txt 2>&1
										REM   ......................................::.......................................
										@ECHO ........................storcli /C%%i show health all............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show health all >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										@ECHO Start_on_Controller_%%i...12E >> misc_output.txt 2>&1
										)

							@ECHO Start_on_Controller_%%i...12F >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show cc | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(						
										@ECHO Start_on_Controller_%%i...12G >> misc_output.txt 2>&1
										REM   ......................................::.......................................
										@ECHO .............................storcli /C%%i show cc............................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show cc >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										@ECHO Start_on_Controller_%%i...12H >> misc_output.txt 2>&1
										)
							@ECHO Start_on_Controller_%%i...13 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show pr | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .............................storcli /C%%i show pr............................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show pr >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)	

							%MR_Cli% /C%%i show copyback | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ...........................storcli /C%%i show copyback........................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show copyback >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show failpdonsmarterror | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .....................storcli /C%%i show failpdonsmarterror....................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show failpdonsmarterror >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)
							@ECHO Start_on_Controller_%%i...14 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show eghs | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .............................storcli /C%%i show eghs............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show eghs >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show cachebypass | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .........................storcli /C%%i show cachebypass.......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show cachebypass >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show perfmode | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ...........................storcli /C%%i show perfmode........................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show perfmode >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)
							@ECHO Start_on_Controller_%%i...15 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show perfmodevalues | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ........................storcli /C%%i show perfmodevalues........................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show perfmodevalues >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show immediateio | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .......................storcli /C%%i show immediateio............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show immediateio >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show largeQD | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .........................storcli /C%%i show largeQD.............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show largeQD >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)
							@ECHO Start_on_Controller_%%i...16 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show flushwriteverify | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ......................storcli /C%%i show flushwriteverify........................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show flushwriteverify >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show largeiosupport | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .......................storcli /C%%i show largeiosupport......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show largeiosupport >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)
							@ECHO Start_on_Controller_%%i...17 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show personality | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .......................storcli /C%%i show personality............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show personality >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1

										@ECHO Start_on_Controller_%%i...18 >> misc_output.txt 2>&1
										%MR_Cli% /C%%i/epdall show | %grep% "Status = Success" >> misc_output.txt 2>&1
										IF NOT ERRORLEVEL 1	(
													REM   ......................................::.......................................
													@ECHO ..........................storcli /C%%i/epdall show.............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
													%MR_Cli% /C%%i/epdall show >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
													
													@ECHO Start_on_Controller_%%i...19 >> misc_output.txt 2>&1
													%MR_Cli% /C%%i/epdall show erase | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
													IF NOT ERRORLEVEL 1	(
																REM   ......................................::.......................................
																@ECHO ............................EPD Drive Erase Status............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																%MR_Cli% /C%%i/vall show erase | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
																)
	
													%MR_Cli% /C%%i/epdall show init | %grep% -e "In progress" -e "Paused" >> misc_output.txt 2>&1
													IF NOT ERRORLEVEL 1	(
																REM   ......................................::.......................................
																@ECHO ........................EPD Drive Initialization Status........................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																%MR_Cli% /C%%i/vall show init | %grep% -e ------------- -e Estimated -e "In progress" -e Paused >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
																)
													@ECHO Start_on_Controller_%%i...20 >> misc_output.txt 2>&1
													)
										)		


							@ECHO Start_on_Controller_%%i...21 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show pdfaileventoptions | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ....................storcli /C%%i show pdfaileventoptions........................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show pdfaileventoptions >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										@ECHO ......................storcli /C%%i show pdfailevents............................ >> %TW-FN%\LSI_Products\MegaRAID\pdfailevents_C%%i.txt
										%MR_Cli% /C%%i show pdfailevents >> %TW-FN%\LSI_Products\MegaRAID\pdfailevents_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show jbodwritecache | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ......................storcli /C%%i show jbodwritecache.......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show jbodwritecache >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							@ECHO Start_on_Controller_%%i...22 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show wbsupport | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .......................storcli /C%%i show wbsupport.............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show wbsupport >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show autopdcache | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ......................storcli /C%%i show autopdcache............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show autopdcache >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show fshinting | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ...........................storcli /C%%i show fshinting.......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show fshinting >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)	

							@ECHO Start_on_Controller_%%i...23 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show ocr | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .............................storcli /C%%i show ocr.............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show ocr >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show bootwithpinnedcache | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .....................storcli /C%%i show bootwithpinnedcache...................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show bootwithpinnedcache >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show autorebuild | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ........................storcli /C%%i show autorebuild........................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show autorebuild >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							@ECHO Start_on_Controller_%%i...24 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show badblocks | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .........................storcli /C%%i show badblocks............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show badblocks >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show ds | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ............................storcli /C%%i show ds................................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show ds >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show aso | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ............................storcli /C%%i show aso............................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show aso >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							@ECHO Start_on_Controller_%%i...25 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show bootdrive | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .........................storcli /C%%i show bootdrive............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show bootdrive >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i/pall show all | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .........................storcli /C%%i/pall show all............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i/pall show all >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i show backplane | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .........................storcli /C%%i show backplane............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show backplane >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							@ECHO Start_on_Controller_%%i...26 >> misc_output.txt 2>&1
							%MR_Cli% /C%%i show sesmonitoring | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ......................storcli /C%%i show sesmonitoring........................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i show sesmonitoring >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i/eall show all | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .........................storcli /C%%i/eall show all............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i/eall show all >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)	

							%MR_Cli% /C%%i/eall show status | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO .......................storcli /C%%i/eall show status............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i/eall show status >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)

							%MR_Cli% /C%%i/eall show phyerrorcounters | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ..................storcli /C%%i/eall show phyerrorcounters....................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i/eall show phyerrorcounters >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)	

							@ECHO Start_on_Controller_%%i...27 >> misc_output.txt 2>&1
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt	(
															REM   ......................................::.......................................
															@ECHO .................................Temperatures.................................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
															%grep% -e "Temperature Sensor for" %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
															%grep% -e "ROC temperature" %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
															)
						

							IF EXIST %TW-WS%iBBU_PRESENT_C%%i.txt	(
												REM   ......................................::.......................................
												@ECHO ..............................iBBU Temperature................................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/bbu show all | %grep% -e "Temperature" >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)

							IF EXIST %TW-WS%SuperCaP_PRESENT_C%%i.txt	(
													REM   ......................................::.......................................
													@ECHO ................................CV Temperature................................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
													%MR_Cli% /C%%i/cv show all | %grep% -e "Temperature" >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
													)
									

REM MegaCli syntax - Cant grep proper output in Windows from "/ex show status"
REM JSON output makes data available but cant clean up in Windows....
	
							@ECHO Start_on_Controller_%%i...28 >> misc_output.txt 2>&1
							REM   ......................................::.......................................
							@ECHO .............................Enclosure Temperature............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
							%MR_Cli% encinfo a%%i | %grep% -e "Temp Sensor                  :" -e "Temperature                  :" >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1

							IF EXIST %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt	(
																REM   ......................................::.......................................
																@ECHO ...............................Drive Temperature............................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																%grep% -e "Drive Temperature =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ...............................Media Error Count............................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																%grep% -e "Media Error Count =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																REM   ......................................::.......................................
																@ECHO .............................Predictive Failure Count.......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																%grep% -e "Predictive Failure Count =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ..................................Device Speed................................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																%grep% -e "Device Speed =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ....................Port # - Status - Linkspeed - SAS Address.................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																%grep% -e "Gb/s 0x" -e "Gb/s  0x" -e "Gb/s   0x" -e "Gb/s    0x" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
																)

							@ECHO Start_on_Controller_%%i...29 >> misc_output.txt 2>&1
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt	(
																@ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt	
																REM   ......................................::.......................................
																
																@ECHO ....................................Drives..................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%MR_Cli% /C%%i/eall/sall show | %grep% -e "SATA" -e "SAS"  >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt

																REM   ......................................::.......................................
																@ECHO .................................Shield Counter................................ >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Shield Counter =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ...............................Media Error Count............................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Media Error Count =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ...............................Other Error Count............................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Other Error Count =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ...............................Drive Temperature............................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Drive Temperature =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ............................Predictive Failure Count........................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Predictive Failure Count =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ........................S.M.A.R.T alert flagged by drive....................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "S.M.A.R.T alert flagged by drive =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ......................................SN....................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "SN =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ......................................WWN...................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "WWN =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
									
																@ECHO Start_on_Controller_%%i...30 >> misc_output.txt 2>&1
									
																@ECHO ...............................Firmware Revision............................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Firmware Revision =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ...................................Raw size.................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Raw size =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO .................................Coerced size.................................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Coerced size =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ................................Non Coerced size............................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Non Coerced size =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO .................................Device Speed.................................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Device Speed =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ..................................Link Speed................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Link Speed =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ...............................Drive write cache............................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Drive write cache =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ..............................Logical Sector Size.............................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Logical Sector Size =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO .............................Physical Sector Size.............................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Physical Sector Size =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ................................Drive position................................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Drive position =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ..............................Enclosure position............................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Enclosure position =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO .............................Connected Port Number............................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Connected Port Number =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ................................Sequence Number................................ >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Sequence Number =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ...............................Commissioned Spare.............................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Commissioned Spare =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ................................Emergency Spare................................ >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Emergency Spare =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO .................Last Predictive Failure Event Sequence Number................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Last Predictive Failure Event Sequence Number =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................

																@ECHO Start_on_Controller_%%i...31 >> misc_output.txt 2>&1

																@ECHO ......................Successful diagnostics completion on..................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Successful diagnostics completion on =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO .................................SED Capable................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "SED Capable =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO .................................SED Enabled................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "SED Enabled =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ....................................Secured.................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Secured =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ....................................Locked..................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Locked =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ..............................Needs EKM Attention.............................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Needs EKM Attention =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO .................................PI Eligible................................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "PI Eligible =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ...............................Wide Port Capable............................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Wide Port Capable =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																REM   ......................................::.......................................
																@ECHO ...................Port # - Status - Linkspeed - SAS Address................... >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%grep% -e "Gb/s   0x =" %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt

																REM   ......................................::.......................................
																@ECHO .................................Inquiry Data.................................. >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																%MR_Cli% /C%%i/eall/sall show all j | %grep% -e "Inquiry Data"  >> %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt
																)

							@ECHO Start_on_Controller_%%i...32 >> misc_output.txt 2>&1

							IF EXIST %TW-WS%iBBU_PRESENT_C%%i.txt	(
												REM   ......................................::.......................................
												@ECHO ..........................storcli /C%%i/bbu show all............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
												%MR_Cli% /C%%i/bbu show all >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
												)	

							IF EXIST %TW-WS%SuperCaP_PRESENT_C%%i.txt	(
													REM   ......................................::.......................................
													@ECHO ..........................storcli /C%%i/cv show all.............................. >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
													%MR_Cli% /C%%i/cv show all >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
													)				
							%MR_Cli% /C%%i/fall show all | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ..........................storcli /C%%i/fall show all............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i/fall show all >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)
	
							%MR_Cli% /C%%i/fall import preview | %grep% "Status = Success" >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										REM   ......................................::.......................................
										@ECHO ........................storcli /C%%i/fall import preview........................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
										%MR_Cli% /C%%i/fall import preview >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
										)


							@ECHO Start_on_Controller_%%i...33 >> misc_output.txt 2>&1
							REM   ......................................::.......................................
							@ECHO .........................storcli /C%%i show eventloginfo......................... >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
							%MR_Cli% /C%%i show eventloginfo >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1
							REM   ......................................::.......................................


							REM   ......................................::.......................................
							@ECHO ...................storcli /C%%i show termlog type=config........................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt

							%MR_Cli% /C%%i show termlog type=config >> %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt 2>&1
							%MR_Cli% /C%%i show termlog type=config >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1


							REM   ......................................::.......................................
							@ECHO ...........................storcli /C%%i show termlog............................ >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt
							%MR_Cli% /C%%i show termlog >> %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt 2>&1
							%MR_Cli% /C%%i show termlog >> %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 2>&1

							@ECHO Start_on_Controller_%%i...34 >> misc_output.txt 2>&1

							REM   ......................................::.......................................
							REM @ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_show_C%%i.txt 2>&1							
							REM @ECHO .....................................storcli /C%%i show events..................................... >> %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_show_C%%i.txt
							REM %MR_Cli% /C%%i show events >> %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_show_C%%i.txt 2>&1

							REM   ......................................::.......................................
							REM @ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_sincereboot_C%%i.txt 2>&1							
							REM @ECHO ............................storcli /C%%i show events type=sincereboot............................. >> %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_sincereboot_C%%i.txt
							REM %MR_Cli% /C%%i show events type=sincereboot >> %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_sincereboot_C%%i.txt 2>&1
							 
							REM   ......................................::.......................................
							REM @ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_sinceshutdown_C%%i.txt 2>&1							
							REM @ECHO ...........................storcli /C%%i show events type=sinceshutdown............................ >> %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_sinceshutdown_C%%i.txt
							REM %MR_Cli% /C%%i show events type=sinceshutdown >> %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_sinceshutdown_C%%i.txt 2>&1

							@ECHO Start_on_Controller_%%i...35 >> misc_output.txt 2>&1
							@ECHO End on Controller %%i... >> misc_output.txt 2>&1
							@ECHO End on MegaRAID Controller %%i... > %TW-WS%End_MegaRAID_storcli_Controller_%%i.txt
							IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_MegaRAID_storcli_Controller_%%i.txt >> misc_output.txt 2>&1)
							IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
							)

@ECHO End of the MegaRAID Controller Data Collection with storcli... >> misc_output.txt 2>&1
@ECHO End of the MegaRAID Controller Data Collection with storcli... > %TW-WS%End_MegaRAID_storcli.txt
IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_MegaRAID_storcli.txt >> misc_output.txt 2>&1)
%grep% -c -e 0 -e 1 -e 2 -e 3 %TW-WS%mr_ctrl_nums.txt | %grep% 1 >> misc_output.txt 2>&1
IF ERRORLEVEL 1	(
		IF NOT [%NOWOW64%]==[YES] (@ECHO Cumulative - storcli Syntax:)
		IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer3\timer3 /s /nologo)
		)


IF NOT [%TWGETSKIPRECORDCAPTURE%]==[YES]	(

						@ECHO .
						IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer4\timer4 /q /nologo)
						REM   ......................................::.......................................   
						
						@ECHO Start of the MegaRAID Event Record Capture... 
						IF [%NOWOW64%]==[YES] (@ECHO %time%)
						@ECHO This will take approx. 1 minute per 78K/0x130B0 Event Records per Controller...
						@ECHO Start of the MegaRAID Event Record Capture...  >> misc_output.txt 2>&1
						@ECHO This will take approx. 1 minute per 78K/0x130B0 Event Records per Controller... >> misc_output.txt 2>&1
						@ECHO Start of the MegaRAID Event Record Capture...  > %TW-WS%Start_MegaRAID_Record_Capture.txt
						@ECHO This will take approx. 1 minute per 78K/0x130B0 Event Records per Controller... >> %TW-WS%Start_MegaRAID_Record_Capture.txt
						xdir /Form=*t %TW-WS%Start_MegaRAID_Record_Capture.txt >> misc_output.txt 2>&1
						
						
						FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
													@ECHO .
													IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
													@ECHO Start on Controller %%i...
													@ECHO Start on Controller %%i... > %TW-WS%Start_MegaRAID_Event_Collection%%i.txt
													IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_MegaRAID_Event_Collection%%i.txt >> misc_output.txt 2>&1)
													%MR_Cli% /C%%i show eventloginfo | %grep% -e "Newest" -e "Oldest"
													
						
													REM   ......................................::.......................................
													IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\Event_Logs mkdir %TW-FN%\LSI_Products\MegaRAID\Event_Logs
													@ECHO %TW-FN% > %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_ID_C%%i.txt 2>&1							
													@ECHO ..................storcli /C%%i show events type=includedeleted.................. >> %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_ID_C%%i.txt
													%MR_Cli% /C%%i show events type=includedeleted file=%TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_ID_C%%i.txt >> misc_output.txt 2>&1
						
													@ECHO End on Controller %%i... >> misc_output.txt 2>&1
													@ECHO End on MegaRAID Controller %%i... > %TW-WS%End_MegaRAID_Event_Collection%%i.txt
													IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_MegaRAID_Event_Collection%%i.txt >> misc_output.txt 2>&1)
													IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
													)
						
						
						@ECHO End of the MegaRAID Event Record Capture... >> misc_output.txt 2>&1
						@ECHO End of the MegaRAID Event Record Capture... > %TW-WS%End_MegaRAID_Record_Capture.txt
						IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_MegaRAID_Record_Capture.txt >> misc_output.txt 2>&1)
						%grep% -c -e 0 -e 1 -e 2 -e 3 %TW-WS%mr_ctrl_nums.txt | %grep% 1 >> misc_output.txt 2>&1
						IF ERRORLEVEL 1	(
								@ECHO Cumulative - Event Capture:
								IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer4\timer4 /s /nologo)
								)
						)

REM ###########################################################################################################################
REM MegaRAID Adapter Event log sorting - Deleted MegaCli syntax version
REM ###########################################################################################################################

IF NOT [%TWGETSKIPRECORDSORT%]==[YES]	( 
					
					IF NOT EXIST %TW-WS%mr_aen_sort mkdir %TW-WS%mr_aen_sort
					IF EXIST %TW-WS%aens_mr.txt move /Y %TW-WS%aens_mr.txt %TW-WS%mr_aen_sort\ >> misc_output.txt 2>&1

					@ECHO .
					IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer5\timer5 /q /nologo)
					REM   ......................................::.......................................
					@ECHO Start of the MegaRAID Event Record Sort...
					IF [%NOWOW64%]==[YES] (@ECHO %time%)
					@ECHO This will take approx. 1 minute per 78,000 Event Records per Controller...
					@ECHO Start of the MegaRAID Event Record Sort... >> misc_output.txt 2>&1
					@ECHO This will take approx. 1 minute per 78,000 Event Records per Controller... >> misc_output.txt 2>&1
					@ECHO Start of the MegaRAID Event Record Sort... > %TW-WS%mr_aen_sort\Start_MegaRAID_Record_Sort.txt
					@ECHO This will take approx. 1 minute per 78,000 Event Records per Controller... >> %TW-WS%mr_aen_sort\Start_MegaRAID_Record_Sort.txt
					IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%mr_aen_sort\Start_MegaRAID_Record_Sort.txt >> misc_output.txt 2>&1)
					
					
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
												IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
												@ECHO Start on Controller %%i...
												@ECHO Start on Controller %%i... >> misc_output.txt 2>&1
												@ECHO Start on Controller %%i... > %TW-WS%mr_aen_sort\Start_MegaRAID_Record_Sort_Controller_%%i.txt
												IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%mr_aen_sort\Start_MegaRAID_Record_Sort_Controller_%%i.txt >> misc_output.txt 2>&1)
					
									
												%grep% "Code: 0x" %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_ID_C%%i.txt > %TW-WS%mr_aen_sort\all_aen_iterations_C%%i.txt
												
												
												FOR /F "tokens=1,2" %%j in (%TW-WS%mr_aen_sort\all_aen_iterations_C%%i.txt) DO	(@ECHO %%j %%k > %TW-WS%mr_aen_sort\"%%k_used_aens_C%%i.txt")
												
												
												dir /B %TW-WS%mr_aen_sort\*_used_aens_C%%i.txt > %TW-WS%mr_aen_sort\all_used_aens_C%%i.txt
												
												
												FOR /F "tokens=1 delims=_" %%j in (%TW-WS%mr_aen_sort\all_used_aens_C%%i.txt) DO	(
																							Echo Number of Events : > %TW-WS%mr_aen_sort\"%%j_AEN_C%%i.txt"
																							%grep% "Code: %%j" %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_ID_C%%i.txt -c >> %TW-WS%mr_aen_sort\"%%j_AEN_C%%i.txt"
																							@ECHO .................................................................................................... >> %TW-WS%mr_aen_sort\"%%j_AEN_C%%i.txt"
																							%grep% -B 3 -A 5 "Code: %%j" %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_ID_C%%i.txt >> %TW-WS%mr_aen_sort\"%%j_AEN_C%%i.txt"
																							%grep% "Code: %%j" %TW-WS%mr_aen_sort\aens_mr.txt >> %TW-WS%mr_aen_sort\aens_mr_used_C%%i.txt
																							)
												
												
												FOR /F "tokens=1,2,3" %%j in (%TW-WS%mr_aen_sort\aens_mr_used_C%%i.txt) DO (move /Y %TW-WS%mr_aen_sort\"%%k_AEN_C%%i.txt" %TW-FN%\LSI_Products\MegaRAID\Event_Logs\%%k_%%l_C%%i.txt >> misc_output.txt 2>&1)
					
												)
					
					
					
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
												dir %TW-FN%\LSI_Products\MegaRAID\Event_Logs\*_C%%i.txt >> misc_output.txt 2>&1
												IF NOT ERRORLEVEL 1	(
															mkdir %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i >> misc_output.txt 2>&1
															copy %TW-FN%\LSI_Products\MegaRAID\Event_Logs\*_C%%i.txt %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i >> misc_output.txt 2>&1
															)
												)
					
					
					FOR /F "usebackq" %%i IN (%TW-WS%mr_aen_types.txt) DO	(
												dir %TW-FN%\LSI_Products\MegaRAID\Event_Logs\*_%%i_* >> misc_output.txt 2>&1
												IF NOT ERRORLEVEL 1	(
															mkdir %TW-FN%\LSI_Products\MegaRAID\Event_Logs\%%i >> misc_output.txt 2>&1
															move /Y %TW-FN%\LSI_Products\MegaRAID\Event_Logs\*_%%i_* %TW-FN%\LSI_Products\MegaRAID\Event_Logs\%%i >> misc_output.txt 2>&1
															)
												)
					
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
												FOR /F "usebackq" %%j IN (%TW-WS%mr_aen_types.txt) DO	(
																			dir %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\*_%%j_* >> misc_output.txt 2>&1
																			IF NOT ERRORLEVEL 1	(
																						mkdir %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\%%j >> misc_output.txt 2>&1
																						move /Y %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\*_%%j_* %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\%%j >> misc_output.txt 2>&1
																						)
																			)
												)	
					
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
												dir %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\*_C%%i.txt >> misc_output.txt 2>&1
												IF NOT ERRORLEVEL 1	(
															IF EXIST %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\evtlog_GE_C%%i.txt del %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\evtlog_GE_C%%i.txt >> misc_output.txt 2>&1
															IF EXIST %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\evtlog_GSR_C%%i.txt del %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\evtlog_GSR_C%%i.txt >> misc_output.txt 2>&1
															IF EXIST %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\evtlog_GSS_C%%i.txt del %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\evtlog_GSS_C%%i.txt >> misc_output.txt 2>&1
															IF EXIST %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\evtlog_ID_C%%i.txt del %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\evtlog_ID_C%%i.txt >> misc_output.txt 2>&1
															IF EXIST %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\Return_getlatest_* del %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\Return_getlatest_* >> misc_output.txt 2>&1
															)
												@ECHO End on Controller %%i... >> misc_output.txt 2>&1
												@ECHO End on MegaRAID Controller %%i... > %TW-WS%mr_aen_sort\End_MegaRAID_Record_Sort_Controller_%%i.txt
												IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%mr_aen_sort\End_MegaRAID_Record_Sort_Controller_%%i.txt >> misc_output.txt 2>&1)
												IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
												)
					
					@ECHO End of the MegaRAID Event Record Sort... >> misc_output.txt 2>&1
					@ECHO End of the MegaRAID Event Record Sort... > %TW-WS%mr_aen_sort\End_MegaRAID_Record_Sort.txt
					IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%mr_aen_sort\End_MegaRAID_Record_Sort.txt >> misc_output.txt 2>&1)
					%grep% -c -e 0 -e 1 -e 2 -e 3 %TW-WS%mr_ctrl_nums.txt | %grep% 1 >> misc_output.txt 2>&1
					IF ERRORLEVEL 1	(
							IF NOT [%NOWOW64%]==[YES] (@ECHO Cumulative - Event Sort:)
							IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer5\timer5 /s /nologo)
							)
					)

REM ###########################################################################################################################
REM # storcli fwtermlog dsply Cx - fwtermlog error screening 
REM # 
REM # Words to look out for... Fault Panic BAIL_OUT Paused REC CRC Unrecoverable Sense
REM ###########################################################################################################################

FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(																
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -e "Fatal firmware error: Line" %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_Fatal.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_Fatal.txt | find /I " 0 fwtermlog_C%%i_Fatal.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_Fatal.txt
															REM                                            .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_Fatal.txt @ECHO ...................Controller C%%i fwtermlog - contains Fatal firmware error: Line.................... >> %TW-FN%\LSI_Products\MegaRAID\Fatal_FW_Error_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Fatal.txt @ECHO .......This indicates that a SERIOUS FW Issue has occured, contact Tech. Support or your FAE........ >> %TW-FN%\LSI_Products\MegaRAID\Fatal_FW_Error_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Fatal.txt type %TW-WS%fwtermlog_C%%i_Fatal.txt >> %TW-FN%\LSI_Products\MegaRAID\Fatal_FW_Error_FWTermLog_C%%i.txt
															)
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -e " Fault " %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_Fault.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_Fault.txt | find /I " 0 fwtermlog_C%%i_Fault.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_Fault.txt
															REM                                            .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_Fault.txt @ECHO ..............................Controller C%%i fwtermlog - contains Fault.............................. >> %TW-FN%\LSI_Products\MegaRAID\Fault_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Fault.txt @ECHO .......This indicates that a SERIOUS FW Issue has occured, contact Tech. Support or your FAE........ >> %TW-FN%\LSI_Products\MegaRAID\Fault_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Fault.txt type %TW-WS%fwtermlog_C%%i_Fault.txt >> %TW-FN%\LSI_Products\MegaRAID\Fault_FWTermLog_C%%i.txt
															)
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -e "Panic" %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_Panic.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_Panic.txt | find /I " 0 fwtermlog_C%%i_Panic.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_Panic.txt
															REM                                            .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_Panic.txt @ECHO ..............................Controller C%%i fwtermlog - contains Panic.............................. >> %TW-FN%\LSI_Products\MegaRAID\Panic_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Panic.txt @ECHO .......This indicates that a SERIOUS FW Issue has occured, contact Tech. Support or your FAE........ >> %TW-FN%\LSI_Products\MegaRAID\Panic_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Panic.txt type %TW-WS%fwtermlog_C%%i_Panic.txt >> %TW-FN%\LSI_Products\MegaRAID\Panic_FWTermLog_C%%i.txt
															)
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -e "BAIL_OUT" %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_BAIL_OUT.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_BAIL_OUT.txt | find /I " 0 fwtermlog_C%%i_BAIL_OUT.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_BAIL_OUT.txt
															REM                                               .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_BAIL_OUT.txt @ECHO .............................Controller C%%i fwtermlog - contains BAIL_OUT............................ >> %TW-FN%\LSI_Products\MegaRAID\BAIL_OUT_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_BAIL_OUT.txt @ECHO .......This indicates that a SERIOUS FW Issue has occured, contact Tech. Support or your FAE........ >> %TW-FN%\LSI_Products\MegaRAID\BAIL_OUT_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_BAIL_OUT.txt type %TW-WS%fwtermlog_C%%i_BAIL_OUT.txt >> %TW-FN%\LSI_Products\MegaRAID\BAIL_OUT_FWTermLog_C%%i.txt
															)
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -e "Paused" %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_Paused.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_Paused.txt | find /I " 0 fwtermlog_C%%i_Paused.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_Paused.txt
															REM                                             .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_Paused.txt @ECHO .............................Controller C%%i fwtermlog - contains Paused.............................. >> %TW-FN%\LSI_Products\MegaRAID\Paused_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Paused.txt @ECHO .....................................This should be investigated.................................... >> %TW-FN%\LSI_Products\MegaRAID\Paused_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Paused.txt type %TW-WS%fwtermlog_C%%i_Paused.txt >> %TW-FN%\LSI_Products\MegaRAID\Paused_FWTermLog_C%%i.txt
															)
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -e "MPI2_EVENT_SAS_QUIESCE_RC_STARTED" -e "MPI2_EVENT_SAS_QUIESCE_RC_COMPLETED" -e "Test event: An unexpected data IO error occurred on PD" %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_Test_Event.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_Test_Event.txt | find /I " 0 fwtermlog_C%%i_Test_Event.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_Test_Event.txt
															REM                                                 .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_Test_Event.txt @ECHO .............................Controller C%%i fwtermlog - contains Test_Event.......................... >> %TW-FN%\LSI_Products\MegaRAID\Test_Event_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Test_Event.txt @ECHO .....................................This should be investigated.................................... >> %TW-FN%\LSI_Products\MegaRAID\Test_Event_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Test_Event.txt type %TW-WS%fwtermlog_C%%i_Test_Event.txt >> %TW-FN%\LSI_Products\MegaRAID\Test_Event_FWTermLog_C%%i.txt
															)
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -e "REC " %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_REC.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_REC.txt | find /I " 0 fwtermlog_C%%i_REC.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_REC.txt >> misc_output.txt 2>&1
															REM                                          .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_REC.txt @ECHO ..............................Controller C%%i fwtermlog - contains REC................................ >> %TW-FN%\LSI_Products\MegaRAID\REC_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_REC.txt @ECHO .....................................This should be investigated..................................... >> %TW-FN%\LSI_Products\MegaRAID\REC_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_REC.txt type %TW-WS%fwtermlog_C%%i_REC.txt >> %TW-FN%\LSI_Products\MegaRAID\REC_FWTermLog_C%%i.txt
															)
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -e "Unrecoverable" %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_Unrecoverable.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_Unrecoverable.txt | find /I " 0 fwtermlog_C%%i_Unrecoverable.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_Unrecoverable.txt >> misc_output.txt 2>&1
															REM                                                    .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_Unrecoverable.txt @ECHO ...........................Controller C%%i fwtermlog - contains Unrecoverable......................... >> %TW-FN%\LSI_Products\MegaRAID\Unrecoverable_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Unrecoverable.txt @ECHO .....................................This should be investigated..................................... >> %TW-FN%\LSI_Products\MegaRAID\Unrecoverable_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_Unrecoverable.txt type %TW-WS%fwtermlog_C%%i_Unrecoverable.txt >> %TW-FN%\LSI_Products\MegaRAID\Unrecoverable_FWTermLog_C%%i.txt
															)
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -e "CRC" %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_CRC.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_CRC.txt | find /I " 0 fwtermlog_C%%i_CRC.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_CRC.txt >> misc_output.txt 2>&1
															REM                                          .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_CRC.txt @ECHO ...............................Controller C%%i fwtermlog - contains CRC............................... >> %TW-FN%\LSI_Products\MegaRAID\CRC_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_CRC.txt @ECHO .....................................This should be investigated..................................... >> %TW-FN%\LSI_Products\MegaRAID\CRC_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_CRC.txt type %TW-WS%fwtermlog_C%%i_CRC.txt >> %TW-FN%\LSI_Products\MegaRAID\CRC_FWTermLog_C%%i.txt
															)
							REM IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															REM %grep% -e "Sense" %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_Sense.txt 2>&1
															REM dir %TW-WS%fwtermlog_C%%i_Sense.txt | find /I " 0 fwtermlog_C%%i_Sense.txt" >> misc_output.txt 2>&1
															REM IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_Sense.txt >> misc_output.txt 2>&1
															REM REM                                            .................................................::.................................................
															REM IF EXIST %TW-WS%fwtermlog_C%%i_Sense.txt @ECHO ...............................Controller C%%i fwtermlog - contains Sense............................. >> %TW-FN%\LSI_Products\MegaRAID\Sense_FWTermLog_C%%i.txt
															REM IF EXIST %TW-WS%fwtermlog_C%%i_Sense.txt type %TW-WS%fwtermlog_C%%i_Sense.txt >> %TW-FN%\LSI_Products\MegaRAID\Sense_FWTermLog_C%%i.txt
															)
							
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt	(
															%grep% -i -e "Battery Put to Sleep" %TW-FN%\LSI_Products\MegaRAID\fwtermlog_C%%i.txt >> %TW-WS%fwtermlog_C%%i_BatterySleep.txt 2>&1
															dir %TW-WS%fwtermlog_C%%i_BatterySleep.txt | find /I " 0 fwtermlog_C%%i_BatterySleep.txt" >> misc_output.txt 2>&1
															IF NOT ERRORLEVEL 1 del %TW-WS%fwtermlog_C%%i_BatterySleep.txt >> misc_output.txt 2>&1
															REM                                                   .................................................::.................................................
															IF EXIST %TW-WS%fwtermlog_C%%i_BatterySleep.txt @ECHO ......................Controller C%%i fwtermlog - contains Battery Put to Sleep....................... >> %TW-FN%\LSI_Products\MegaRAID\BatterySleep_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_BatterySleep.txt @ECHO ............................................Informational........................................... >> %TW-FN%\LSI_Products\MegaRAID\BatterySleep_FWTermLog_C%%i.txt
															IF EXIST %TW-WS%fwtermlog_C%%i_BatterySleep.txt type %TW-WS%fwtermlog_C%%i_BatterySleep.txt >> %TW-FN%\LSI_Products\MegaRAID\BatterySleep_FWTermLog_C%%i.txt
															)
							
							




							REM ###########################################################################################################################
							REM # MegaCli eventlog error screening
							REM # 
							REM # Words to look out for... 
							REM ###########################################################################################################################
							IF EXIST %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Warning\0x00000071_Warning_113d_Unexpected_sense_X_CDBX_Sense_X_C%%i.txt	(
																							%grep% -e "0070 0000 000b 0000 0000 0000 0000 000a 0000 0000 0000 0000 0047 0003" %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Warning\0x00000071_Warning_113d_Unexpected_sense_X_CDBX_Sense_X_C%%i.txt >> %TW-WS%iuCRC_Error_Detected_C%%i.txt 2>&1
																							dir %TW-WS%iuCRC_Error_Detected_C%%i.txt | find /I " 0 iuCRC_Error_Detected_C%%i.txt" >> misc_output.txt 2>&1
																							IF NOT ERRORLEVEL 1 del %TW-WS%iuCRC_Error_Detected_C%%i.txt
																							REM      	                   	            .................................................::.................................................
																							IF EXIST %TW-WS%iuCRC_Error_Detected_C%%i.txt @ECHO .................................Drive sense data contains b/47/03.................................. > %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\Warning\iuCRC_Error_Detected_C%%i.txt
																							IF EXIST %TW-WS%iuCRC_Error_Detected_C%%i.txt type %TW-WS%iuCRC_Error_Detected_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i\Warning\iuCRC_Error_Detected_C%%i.txt
																							IF EXIST %TW-WS%iuCRC_Error_Detected_C%%i.txt @ECHO .................................Drive sense data contains b/47/03.................................. > %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Warning\iuCRC_Error_Detected_C%%i.txt
																							IF EXIST %TW-WS%iuCRC_Error_Detected_C%%i.txt type %TW-WS%iuCRC_Error_Detected_C%%i.txt >> %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Warning\iuCRC_Error_Detected_C%%i.txt
																							)
							)


REM   ......................................::.......................................
@ECHO ..................................Controller #................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Controller =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt | %grep% -m 1 "Controller =" >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ....................................Model #.................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Model =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ................................Serial Number #................................ >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Serial Number =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO .........................Current Controller Date/Time.......................... >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Current Controller Date/Time =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ...................................Mfg Date.................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Mfg Date =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ..................................Rework Date.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Rework Date =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ..................................Revision No.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Revision No =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO .............................Firmware Package Build............................ >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Firmware Package Build =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ..................................Bios Version................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Bios Version =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ................................NVDATA Version................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^NVDATA Version =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ...............................Boot Block Version.............................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Boot Block Version =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ...............................Bootloader Version.............................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Bootloader Version =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ..................................Driver Name.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Driver Name =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ................................Driver Version................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Driver Version =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ...................................Vendor Id................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Vendor Id =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ...................................Device Id................................... >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Device Id =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO .................................SubVendor Id.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^SubVendor Id =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO .................................SubDevice Id.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^SubDevice Id =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ................................Host Interface................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Host Interface =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ...............................Device Interface................................ >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Device Interface =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ...................................Bus Number.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Bus Number =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ..................................Device Number................................ >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Device Number =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO .................................Function Number............................... >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Function Number =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ...................................Image name.................................. >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
%grep% "^Image name =" %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt
								
REM   ......................................::.......................................
@ECHO ...............................Stopped at Status............................... >> %TW-FN%\LSI_Products\MegaRAID\Call_show_all-Compare-All-Parms.txt

:NO_MR_Adapters

IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO END_No_Pause
IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO END_No_Pause
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO END_No_Pause
IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO TWPARTIALMODE
IF [%TWGETPARTIALMODE%]==[G_DPM] GOTO TWPARTIALMODE
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] GOTO TWPARTIALMODE

REM ###########################################################################################################################
REM LSI HBA 
REM ###########################################################################################################################

IF NOT [%TWGETSKIPHBA%]==[YES]	(
				IF [%ENABLE_ALL_IOC_DEBUG%]==[NO]	(
									REM Gen2 - Default Commands
									@ECHO iop show stack > %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show diag >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop pci lnkspdr >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop pci lnkwdr >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl status >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl dev >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl iocount >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl mids >> %TW-WS%gen2_ioc_cli_cmds.txt 
									@ECHO pl reg link >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl task >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg hwcontext >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg hwdevtab >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg hwsatatab >> %TW-WS%gen2_ioc_cli_cmds.txt
									)
				
				IF [%ENABLE_ALL_IOC_DEBUG%]==[YES]	(
									REM Gen2 - SAS2308
									@ECHO iop dbgmask show > %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show mem >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show tlb >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show ver >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show sbr >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show cfg all >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show stack >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show fifo >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show reqfifo >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show diag >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show mreq >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop show hwftrs >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop pm cpuspd >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop pci reg >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop pci status >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop pci lnkspdr >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO iop pci lnkwdr >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl info >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl param >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl mids >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl mids 1 >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl dev >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl iocount >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl status >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl phy >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl cphy >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl port >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl smp >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl encl >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl expconn >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl exp >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl cmdbuf >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg sascfg >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg spinup >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg sgpio >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg qmreg >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg qmctrlgrp >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg qmdmagrp >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg qmctrlstart >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg qmdmastart >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg matfm >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg misfm >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg txctx >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg txdma >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg rxctx >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg rxdma >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg rxfm >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg porttxctrl >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg porttxrte >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg devcache >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg portrxctrl >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg portrxrte >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg rxeedp >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg rxdpbuf >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg phylynk >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg link >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg phyreg >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg rxbuf >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg sdmw >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg dmatq >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg dmaqnp >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg dmaqfp >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg hwdevtab >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg hwsatatab >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg contq >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg hwcontext >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg global >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg sascore >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl reg compq >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl int 0 >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl int 1 >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl task >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl eminfo >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl inittbl >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl hwftrs >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl bt1680 >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl snf >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl pwmview >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl ps >> %TW-WS%gen2_ioc_cli_cmds.txt
									@ECHO pl pmcntr >> %TW-WS%gen2_ioc_cli_cmds.txt
									)
				
				IF [%ENABLE_ALL_IOC_DEBUG%]==[NO]	(
									REM Gen3 - Default Commands
									@ECHO iop show stack > %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show diag >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pci lnkspdr >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pci lnkwdr >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl status >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl dev >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl iocount >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl mids >> %TW-WS%gen3_ioc_cli_cmds.txt 
									@ECHO pl reg link >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl tm task >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl tm outstanding >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg hwcontext >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg hwdevtab >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg hwsatatab >> %TW-WS%gen3_ioc_cli_cmds.txt
									)
				
				IF [%ENABLE_ALL_IOC_DEBUG%]==[YES]	(
									REM Gen3 - SAS3008
									@ECHO iop dbgmask show > %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show mem >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show msgctx >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show tlb >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show ver >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show sbr >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show cfg >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show stack >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show fifo >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show reqfifo >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show diag >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show snap >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show hwftrs >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop show temp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pm seccpu >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pm cpuspd >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pm getmode >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop fpe maxex >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop fpe maxev >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pli contreq >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop isFaulted >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pci lnkspdr >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pci lnkwdr >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pci reg >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop pci status >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop perfmon show >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop mreq m >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop mreq s >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO iop mreq r >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl info >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl param >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl mids >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl mids 1 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl stats all >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl dev >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl iocount >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl status >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl phy >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl cphy >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl port >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl smp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl encl >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl expconn >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl exp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl cmdbuf >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg sascfg >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg spinup >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg sgpio >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmreg >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmctrlgrp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmdmagrp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmctrlstart >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg matfm >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg misfm >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg txctx >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg txdma >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg rxctx >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg rxdma >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg rxfm >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg porttxctrl >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg porttxrte >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg devcache >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg portrxrte >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg rxeedp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg rxdpbuf >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg phylynk >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg link >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg phyQuad0 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg phyQuad1 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg rxbuf >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg starfish >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg dmatq >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg dmaqnp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg dmaqfp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg hwdevtab >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg hwsatatab >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg contq >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg hwcontext >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg global >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg sascore >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg compq >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg fpecompq >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg QMMecControl >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmstrtintfc >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmctrlqctrl >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmdmaenq >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmcmpl >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg hwinitvirtidresp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg virtidorig >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmcmdreceive >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmcmdfreequeue >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmcmdfreepointer >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl reg qmcmdvipidbaseaddr >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl int 0 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl int 1 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl eminfo >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl inittbl >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl hwftrs >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl stallnf >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe rctrl >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe cctrl >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe cpb >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe cpm >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe mst >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe mstap >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe pdl >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe evf >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe cregs >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe sregs >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg intstatus >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg intmask >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg status1 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg status2 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg reqstatus >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg complstatus >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg reqerrstatus >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg complerrstatus >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg fpecontrol >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg startpendingio >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg config1 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg asynceventfifo >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg status3 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg config2 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg config3 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg excpqstatus >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg vfenable >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg ldstatebaselow >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg ldstatebasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg mubaselow >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg mubasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg sascorebaselow >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg sascorebasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg mstbaselow >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg mstbasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg dstbaselow >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg dstbasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg msgtblebaselow >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg msgtblebasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg msgconfig1 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg msgconfig2 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg sascompqbaselow >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg sascomplqbasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg sascomplqhead >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg sascomplqheadmax >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg iopcomplqbaselow >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg iopcompqbasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg iopcomplqhead >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg iopcomplqtail >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg iopcomplqptrmax >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg sascoreoffsets >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg reqpostfifobasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg excpqbasehigh >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg iopstartqpost >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg iopstartqstatus >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg mucoreoffset1 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg mucoreoffset2 >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg timerfunction >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg timerstatus >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg timercontrol >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg dynocomplhead >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg dynocompltail >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg powermgmt >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe reg fperegall >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe mgr fpefwflags >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe mgr fwflags >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe mgr tracetype >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe mgr devstate >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe mgr dst >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe mgr history >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe dev-ac >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe dev-az >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe stats >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl fpe iopcq >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl tbm showregs >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl tm outstanding >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl tm task >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl txinfo >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl temp >> %TW-WS%gen3_ioc_cli_cmds.txt
									@ECHO pl mreq >> %TW-WS%gen3_ioc_cli_cmds.txt
									)
				
				
				IF NOT ["%NO_lsut_LSI_HBAs%"]==["YES"]	(
									@ECHO .
									IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer6\timer6 /q /nologo)
									@ECHO Starting Step 1 of the Broadcom SAS HBA Data Collection...
									IF [%NOWOW64%]==[YES] (@ECHO %time%)
									@ECHO Starting Step 1 of the Broadcom SAS HBA Data Collection... >> misc_output.txt 2>&1
									@ECHO Starting Step 1 of the Broadcom SAS HBA Data Collection... > %TW-WS%Start_Step_1_Broadcom_SAS_HBA.txt
									IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_Step_1_Broadcom_SAS_HBA.txt >> misc_output.txt 2>&1)

									IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
									IF NOT EXIST %TW-FN%\LSI_Products\HBA mkdir %TW-FN%\LSI_Products\HBA
				
									lsut 0 | %grep% Scsi > %TW-WS%hba_num.txt
									FOR /F "tokens=1 delims=. " %%i IN (%TW-WS%hba_num.txt) DO @ECHO %%i >> %TW-WS%hba_numbers.txt
									FOR /F "usebackq" %%i IN (%TW-WS%hba_numbers.txt) DO	(
																IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
																@ECHO Start on HBA %%i... 
																@ECHO Start on HBA %%i... >> misc_output.txt 2>&1
																@ECHO Start on HBA %%i... > %TW-WS%Start_Step_1_on_HBA%%i.txt
																IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_Step_1_on_HBA%%i.txt >> misc_output.txt 2>&1)
																REM   ......................................::.......................................
																@ECHO %TW-FN% > %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																@ECHO ....................................LSITool.................................... >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut 0 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																@ECHO . >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																@ECHO ...................................LSITool 1................................... >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i 1 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																@ECHO ...................................LSITool 8................................... >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i 8 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																@ECHO ...................................LSITool 16.................................. >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i 16 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																@ECHO ...................................LSITool 17.................................. >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i 17 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																REM   ......................................::.......................................
																@ECHO .................................LSITool 21-1-2................................ >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i -a 21,1,2,0,0 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																@ECHO .................................LSITool 25-2-0................................ >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i -a 25,2,0,0 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																@ECHO ..................................LSITool 42................................... >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																32_lsut -p %%i 42 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt 2>&1
																@ECHO ..................................LSITool 47................................... >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i 47 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
				
																REM Check for SAS Generation			
																lsut -p %%i 47 | %grep% RaidPort > %TW-WS%hba_%%i_sas_gen_test.txt
																%grep% LSI_SAS- %TW-WS%hba_%%i_sas_gen_test.txt >> misc_output.txt 2>&1
																IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%gen1_hbas.txt
																%grep% LSI_SAS2- %TW-WS%hba_%%i_sas_gen_test.txt >> misc_output.txt 2>&1
																IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%gen2_hbas.txt
																%grep% LSI_SAS3- %TW-WS%hba_%%i_sas_gen_test.txt >> misc_output.txt 2>&1
																IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%gen3_hbas.txt
																%grep% LSI_SAS4- %TW-WS%hba_%%i_sas_gen_test.txt >> misc_output.txt 2>&1
																IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%gen4_hbas.txt
				
																@ECHO ................................LSITool 64-0-0................................. >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i -a 64,,,0,0, >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																REM   ......................................::.......................................
																@ECHO ..................................LSITool 66................................... >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i 66 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																REM   ......................................::.......................................
																@ECHO ..................................LSITool 68................................... >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																lsut -p %%i 68 >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																REM   ......................................::.......................................
																@ECHO ..................................LSITool 100.................................. >> %TW-FN%\LSI_Products\HBA\100_hba%%i.txt
																lsut -p %%i 100 >> %TW-FN%\LSI_Products\HBA\100_hba%%i.txt
																
																@ECHO REM lsipage is an LSI internal utility > %TW-FN%\LSI_Products\HBA\100_hba%%i.bat
																@ECHO copy 100_hba%%i.txt 100_hba%%i >> %TW-FN%\LSI_Products\HBA\100_hba%%i.bat
																@ECHO lsipage -h -i 100_hba%%i >> %TW-FN%\LSI_Products\HBA\100_hba%%i.bat
																@ECHO del 100_hba%%i >> %TW-FN%\LSI_Products\HBA\100_hba%%i.bat
																
																REM   ......................................::.......................................
																@ECHO .........ManPages 17-31, option 100 does not capture these currently........... >> %TW-FN%\LSI_Products\HBA\ManPages_17-31_hba%%i.txt
																@ECHO ...ManPage 30 Offset 0x8 shows Databolt, 00200000 Enabled, 00200001 Disabled... >> %TW-FN%\LSI_Products\HBA\ManPages_17-31_hba%%i.txt
																@ECHO ............00200002 DataBOLT and Fast Context Switching Disabled.............. >> %TW-FN%\LSI_Products\HBA\ManPages_17-31_hba%%i.txt
																FOR /L %%j IN (17,1,31) DO	(
																				REM   ......................................::.......................................
																				@ECHO .................................ManPage %%j................................... >> %TW-FN%\LSI_Products\HBA\ManPages_17-31_hba%%i.txt
																				lsut -p %%i -a 9,9,%%j,0,,,0 | %grep% -e " : " >> %TW-FN%\LSI_Products\HBA\ManPages_17-31_hba%%i.txt
																				)
																@ECHO End on HBA %%i... >> misc_output.txt 2>&1
																@ECHO End on HBA %%i... > %TW-WS%End_Step_1_on_HBA%%i.txt
																IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_Step_1_on_HBA%%i.txt >> misc_output.txt 2>&1)
																IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
																)
									)
				
				
				IF EXIST %TW-WS%gen1_hbas.txt (SET NO_GEN1_HBAs=NO) ELSE SET NO_GEN1_HBAs=YES
				IF EXIST %TW-WS%gen2_hbas.txt (SET NO_GEN2_HBAs=NO) ELSE SET NO_GEN2_HBAs=YES
				IF EXIST %TW-WS%gen3_hbas.txt (SET NO_GEN3_HBAs=NO) ELSE SET NO_GEN3_HBAs=YES
				IF EXIST %TW-WS%gen4_hbas.txt (SET NO_GEN4_HBAs=NO) ELSE SET NO_GEN4_HBAs=YES
				
				IF EXIST %TW-WS%gen2_hbas.txt type %TW-WS%gen2_hbas.txt > %TW-WS%gen2-3_hbas.txt
				IF EXIST %TW-WS%gen3_hbas.txt type %TW-WS%gen3_hbas.txt >> %TW-WS%gen2-3_hbas.txt
				
		
			
				

				
				IF NOT ["%NO_lsut_LSI_HBAs%"]==["YES"]	(
									@ECHO End Step 1 of the Broadcom SAS HBA Data Collection... >> misc_output.txt 2>&1
									@ECHO End Step 1 of the Broadcom SAS HBA Data Collection... > %TW-WS%End_Step_1_Broadcom_SAS_HBA.txt
									IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_Step_1_Broadcom_SAS_HBA.txt >> misc_output.txt 2>&1)
									%grep% -c -e 0 -e 1 -e 2 -e 3 %TW-WS%hba_numbers.txt | %grep% 1 >> misc_output.txt 2>&1
									IF ERRORLEVEL 1	(
											IF NOT [%NOWOW64%]==[YES] (@ECHO Cumulative - Step 1:)
											IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer6\timer6 /s /nologo)
											)
									)

				REM ###########################################################################################################################
				REM Starting sas2ircu and sas3ircu HBA Data Collection
				REM ###########################################################################################################################
				sas2ircu list | %grep% h: | %cut% -b 4-5 > %TW-WS%sas2ircu_hba_nums.txt
				IF EXIST %TW-WS%sas2ircu_hba_nums.txt dir %TW-WS%sas2ircu_hba_nums.txt | %grep% " 0 sas2ircu_hba_nums.txt" >> misc_output.txt 2>&1
				IF ERRORLEVEL 1	( 			
							SET NO_2ircu_HBAs=NO
							FOR /F "usebackq" %%i IN (%TW-WS%sas2ircu_hba_nums.txt) DO	(
															IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
															IF NOT EXIST %TW-FN%\LSI_Products\HBA mkdir %TW-FN%\LSI_Products\HBA
															IF NOT EXIST %TW-FN%\LSI_Products\HBA\6Gb mkdir %TW-FN%\LSI_Products\HBA\6Gb
															REM   ......................................::.......................................
															@ECHO %TW-FN% > %TW-FN%\LSI_Products\HBA\6Gb\sas2ircu_hba%%i.txt
															@ECHO .................................sas2ircu list................................. >> %TW-FN%\LSI_Products\HBA\6Gb\sas2ircu_hba%%i.txt
															sas2ircu list >> %TW-FN%\LSI_Products\HBA\6Gb\sas2ircu_hba%%i.txt	
															@ECHO ..............................sas2ircu %%i display............................. >> %TW-FN%\LSI_Products\HBA\6Gb\sas2ircu_hba%%i.txt
															sas2ircu %%i display >> %TW-FN%\LSI_Products\HBA\6Gb\sas2ircu_hba%%i.txt	
															)
						)				
				
				sas3ircu list | %grep% h: | %cut% -b 4-5 > %TW-WS%sas3ircu_hba_nums.txt
				IF EXIST %TW-WS%sas3ircu_hba_nums.txt dir %TW-WS%sas3ircu_hba_nums.txt | %grep% " 0 sas3ircu_hba_nums.txt" >> misc_output.txt 2>&1
				IF ERRORLEVEL 1	( 			
							SET NO_3ircu_HBAs=NO				
							sas3ircu list | %grep% h: | %cut% -b 4-5 > %TW-WS%sas3ircu_hba_nums.txt
							FOR /F "usebackq" %%i IN (%TW-WS%sas3ircu_hba_nums.txt) DO	(
															IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
															IF NOT EXIST %TW-FN%\LSI_Products\HBA mkdir %TW-FN%\LSI_Products\HBA
															IF NOT EXIST %TW-FN%\LSI_Products\HBA\12Gb mkdir %TW-FN%\LSI_Products\HBA\12Gb
															REM   ......................................::.......................................
															@ECHO %TW-FN% > %TW-FN%\LSI_Products\HBA\12Gb\sas3ircu_hba%%i.txt
															@ECHO ..................................sas3ircu list................................ >> %TW-FN%\LSI_Products\HBA\12Gb\sas3ircu_hba%%i.txt
															sas3ircu list >> %TW-FN%\LSI_Products\HBA\12Gb\sas3ircu_hba%%i.txt	
															@ECHO ..............................sas3ircu %%i display............................... >> %TW-FN%\LSI_Products\HBA\12Gb\sas3ircu_hba%%i.txt
															sas3ircu %%i display >> %TW-FN%\LSI_Products\HBA\12Gb\sas3ircu_hba%%i.txt	
															)
						)
				REM ###########################################################################################################################
				
				IF EXIST %TW-WS%gen2-3_hbas.txt		(
									@ECHO .
									IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer7\timer7 /q /nologo)
									@ECHO Starting Step 2 of the Broadcom SAS HBA Data Collection...
									IF [%NOWOW64%]==[YES] (@ECHO %time%)
									@ECHO Starting Step 2 of the Broadcom SAS HBA Data Collection... >> misc_output.txt 2>&1
									@ECHO Starting Step 2 of the Broadcom SAS HBA Data Collection... > %TW-WS%Start_Step_2_Broadcom_SAS_HBA.txt
									IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_Step_2_Broadcom_SAS_HBA.txt >> misc_output.txt 2>&1)

									IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
									IF NOT EXIST %TW-FN%\LSI_Products\HBA mkdir %TW-FN%\LSI_Products\HBA
									IF NOT EXIST %TW-FN%\LSI_Products\HBA\Details mkdir %TW-FN%\LSI_Products\HBA\Details
									IF EXIST %TW-WS%gen2_hbas.txt	(			
													FOR /F "usebackq" %%i IN (%TW-WS%gen2_hbas.txt) DO	(
																				IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
																				@ECHO Start on Gen2 HBA %%i...
																				@ECHO Start on Gen2 HBA %%i... >> misc_output.txt 2>&1
																				@ECHO Start on Gen2 HBA %%i... > %TW-WS%Start_Step_2_on_Gen2_HBA%%i.txt
																				IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_Step_2_on_Gen2_HBA%%i.txt >> misc_output.txt 2>&1)
																				FOR /F "tokens=1 delims=?" %%j IN (%TW-WS%gen2_ioc_cli_cmds.txt) DO	( 
																													lsut -p %%i -a 65,"%%jhba%%i.txt","%%j",exit,0, >> misc_output.txt 2>&1
																									  				%grep% -i -e "pl --   pl commands" -e "pl --  pl commands" -e "pl -- pl commands" -e "iop --   iop commands" -e "iop --  iop commands" -e "iop -- iop commands" "%%j"hba%%i.txt >> misc_output.txt 2>&1
																													IF ERRORLEVEL 1	( 
																															REM   ......................................::.......................................
																															@ECHO ..................................%%jhba%%i........................................ >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																															type "%%j"hba%%i.txt >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																															@ECHO . >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																															move /Y "%%j"hba%%i.txt %TW-FN%\LSI_Products\HBA\Details >> misc_output.txt 2>&1
																															)
																													IF EXIST "%%j"hba%%i.txt move /Y "%%j"hba%%i.txt %TW-WS% >> misc_output.txt 2>&1
																													)
																				@ECHO End on Gen2 HBA %%i... >> misc_output.txt 2>&1
																				@ECHO End on Gen2 HBA %%i... > %TW-WS%End_Step_2_on_Gen2_HBA%%i.txt
																				IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_Step_2_on_Gen2_HBA%%i.txt >> misc_output.txt 2>&1)
																				IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
																				)
													)
									
				
									IF NOT EXIST %TW-FN%\LSI_Products\HBA\Details mkdir %TW-FN%\LSI_Products\HBA\Details
									IF EXIST %TW-WS%gen3_hbas.txt	(			
													FOR /F "usebackq" %%i IN (%TW-WS%gen3_hbas.txt) DO	(
																				IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
																				@ECHO Start on Gen3 HBA %%i...
																				@ECHO Start on Gen3 HBA %%i... >> misc_output.txt 2>&1
																				@ECHO Start on Gen3 HBA %%i... > %TW-WS%Start_Step_2_on_Gen3_HBA%%i.txt
																				IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_Step_2_on_Gen3_HBA%%i.txt >> misc_output.txt 2>&1)
																				FOR /F "tokens=1 delims=?" %%j IN (%TW-WS%gen3_ioc_cli_cmds.txt) DO	( 
																													lsut -p %%i -a 65,"%%jhba%%i.txt","%%j",exit,0, >> misc_output.txt 2>&1
																									  				%grep% -i -e "pl --   pl commands" -e "pl --  pl commands" -e "pl -- pl commands" -e "iop --   iop commands" -e "iop --  iop commands" -e "iop -- iop commands" "%%j"hba%%i.txt >> misc_output.txt 2>&1
																													IF ERRORLEVEL 1	( 
																															REM   ......................................::.......................................
																															@ECHO ...................................%%jhba%%i....................................... >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																															type "%%j"hba%%i.txt >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																															@ECHO . >> %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt
																															move /Y "%%j"hba%%i.txt %TW-FN%\LSI_Products\HBA\Details >> misc_output.txt 2>&1
																															)
																													IF EXIST "%%j"hba%%i.txt move /Y "%%j"hba%%i.txt %TW-WS% >> misc_output.txt 2>&1
																													)
																				@ECHO End on Gen3 HBA %%i... >> misc_output.txt 2>&1
																				@ECHO End on Gen3 HBA %%i... > %TW-WS%End_Step_2_on_Gen3_HBA%%i.txt
																				IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_Step_2_on_Gen3_HBA%%i.txt >> misc_output.txt 2>&1)
																				IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
																				)
													)
									)
				
				IF EXIST %TW-WS%gen2-3_hbas.txt		(
									@ECHO End Step 2 of the Broadcom SAS HBA Data Collection... >> misc_output.txt 2>&1
									@ECHO End Step 2 of the Broadcom SAS HBA Data Collection... > %TW-WS%End_Step_2_Broadcom_SAS_HBA.txt
									IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_Step_2_Broadcom_SAS_HBA.txt >> misc_output.txt 2>&1)
									%grep% -c -e 0 -e 1 -e 2 -e 3 %TW-WS%gen2-3_hbas.txt | %grep% 1 >> misc_output.txt 2>&1
									IF ERRORLEVEL 1	(
											IF NOT [%NOWOW64%]==[YES] (@ECHO Cumulative - Step 2:)
											IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer7\timer7 /s /nologo)
											)
									)

				REM ###########################################################################################################################
				REM Starting scl HBA Data Collection
				REM ###########################################################################################################################

				IF NOT [%NO_scl_EXP-IOC%]==[YES]	(
									scl --list | %grep% DeviceId -A 100 | %grep% ")" | %grep% -v -e SAS3x -e SAS35x >> %TW-WS%sc_gen3_hbas_raw.txt 2>&1 
									IF EXIST %TW-WS%sc_gen3_hbas_raw.txt dir %TW-WS%sc_gen3_hbas_raw.txt | %grep% " 0 sc_gen3_hbas_raw.txt" >> misc_output.txt 2>&1
									IF NOT ERRORLEVEL 1 move %TW-WS%sc_gen3_hbas_raw.txt %TW-WS%0Byte_sc_gen3_hbas_raw.txt >> misc_output.txt 2>&1
									IF EXIST %TW-WS%sc_gen3_hbas_raw.txt	(
													 	SET NO_scl_IOC=NO
														@ECHO IN__scl_IOC_Branch_1 >> misc_output.txt 2>&1
														IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
														IF NOT EXIST %TW-FN%\LSI_Products\HBA mkdir %TW-FN%\LSI_Products\HBA
														IF NOT EXIST %TW-FN%\LSI_Products\HBA\12Gb mkdir %TW-FN%\LSI_Products\HBA\12Gb
														IF NOT EXIST %TW-FN%\LSI_Products\HBA\12Gb\Details mkdir %TW-FN%\LSI_Products\HBA\12Gb\Details
														scl --list | %grep% DeviceId -A 100 | %grep% -v -e SAS3x -e SAS35x > %TW-FN%\LSI_Products\HBA\12Gb\Details\sc_hbas.txt
														FOR /F delims^=^)^ tokens^=1 %%i in (%TW-WS%sc_gen3_hbas_raw.txt) DO (@ECHO %%i >> %TW-WS%sc_gen3_hbas_raw1.txt)
														FOR /F "tokens=1 delims= " %%i in (%TW-WS%sc_gen3_hbas_raw1.txt) DO (@ECHO %%i >> %TW-WS%sc_gen3_hba_nums.txt)
														@ECHO IN__scl_IOC_Branch_2 >> misc_output.txt 2>&1
														FOR /F "tokens=1" %%i in (%TW-WS%sc_gen3_hba_nums.txt) DO	(
																						@ECHO IN__scl_IOC_Branch_3 >> misc_output.txt 2>&1
																						scl -i %%i ioc -wwid | %grep% "Current WWID" > %TW-WS%sc_hba_%%i_sasaddr.txt
																						FOR /F "tokens=3 delims=: " %%j in (%TW-WS%sc_hba_%%i_sasaddr.txt) DO (@ECHO %%j > %TW-WS%sc_hba_%%i_sasaddr1.txt)																				
																						FOR /F "tokens=1" %%j in (%TW-WS%sc_hba_%%i_sasaddr1.txt) DO	(
																														@ECHO IN__scl_IOC_Branch_4_HBA%%i >> misc_output.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ................................scli HBAs/IOCs................................. >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl --list | %grep% DeviceId -A 100 | %grep% -v -e SAS3x -e SAS35x >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..................................show -all.................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i show -all >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..................................show -mfg.................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i show -mfg >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..................................show -sys.................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i show -sys >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..................................show -temp................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i show -temp >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..................................show -fwheader............................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i show -fwheader >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..................................logs......................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i logs >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..................................cfg -nondefault.............................. >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i cfg -nondefault >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ....................................phy -da.................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i phy -da >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ...................................phy -port................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i phy -port >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ...................................phy -err.................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i phy -err >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..................................phy -evnt.................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i phy -evnt >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO .................................ioc -diserr................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i ioc -diserr >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ................................ioc -displaysas................................ >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i ioc -displaysas >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..............................ioc -facts -decode............................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i ioc -facts -decode >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..............................cli iop show ver................................. >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i cli iop show ver >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..............................cli iop pci lnkspdr.............................. >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i cli iop pci lnkspdr >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..............................cli iop pci lnkwdr............................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i cli iop pci lnkwdr >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..................................cfg -dumpall................................. >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i cfg -dumpall >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..............................cli iop show diag................................ >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i cli iop show diag >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														@ECHO ..............................cli pl dbg....................................... >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														scl -i %%i cli pl dbg >> %TW-FN%\LSI_Products\HBA\12Gb\%%j_scli_hba%%i.txt 2>&1
																														REM   ......................................::.......................................
																														)
																						)	
														)
									)



				)
				






REM ###########################################################################################################################
REM Starting lsut Expander data collection
REM ###########################################################################################################################

IF [%TWGETSKIPEXPANDER%]==[YES]	GOTO SKIPEXPANDER

REM Expander cli commands
@ECHO date> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO sasaddr>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO rdcfg 0xfe01 0 >> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO showmfg>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO showpost>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO adcread 1 1 1000>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO rev>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO phyinfo>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO serdesinfo>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO counters>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO rtr>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO scedebug>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO flashtblinfo>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO sgpioinfo>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO edfbinfo>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO thread>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO memstat>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO coredump>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO showtrace>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO showlogs detail>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO ssptdebug>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO debuginfo starfish>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO debuginfo edfb>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO debuginfo link>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO debuginfo connection>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO debuginfo config>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO rreg>> %TW-WS%gen3_expander_cli_cmds.txt
@ECHO ipconfig>> %TW-WS%gen3_expander_cli_cmds.txt


IF NOT ["%NO_lsut_LSI_HBAs%"]==["YES"]	(
					IF NOT EXIST %TW-WS%hba_num.txt lsut 0 | %grep% Scsi > %TW-WS%hba_num.txt
					IF NOT EXIST %TW-WS%hba_numbers.txt FOR /F "tokens=1 delims=. " %%i IN (%TW-WS%hba_num.txt) DO (@ECHO %%i >> %TW-WS%hba_numbers.txt)
					FOR /F "usebackq" %%i IN (%TW-WS%hba_numbers.txt) DO	(					
												lsut -p %%i -a 64,,,0,0 | %grep% EnclServ | %grep% -e LSI | %cut% -d. -f1 > %TW-WS%expanders_hba%%i.txt
												dir %TW-WS%expanders_hba%%i.txt | find " 0 expanders_hba%%i.txt" >> misc_output.txt 2>&1
												IF NOT ERRORLEVEL 1 move /Y %TW-WS%expanders_hba%%i.txt %TW-WS%0Byte_expanders_hba%%i.txt >> misc_output.txt 2>&1
												)				
					dir %TW-WS%expanders_hba* >> misc_output.txt 2>&1
					IF NOT ERRORLEVEL 1 @ECHO "Expanders are Present" > %TW-WS%expanders_hbaX.txt
					IF EXIST %TW-WS%expanders_hbaX.txt	(
										@ECHO .
										IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer8\timer8 /q /nologo)
										@ECHO Starting the Broadcom SAS Expander Data Collection...
										IF [%NOWOW64%]==[YES] (@ECHO %time%)
										@ECHO Starting the Broadcom SAS Expander Data Collection... >> misc_output.txt 2>&1
										@ECHO Starting the Broadcom SAS Expander Data Collection... > %TW-WS%Start_Expander.txt
										IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_Expander.txt >> misc_output.txt 2>&1)
										
			
										FOR /F "usebackq" %%i IN (%TW-WS%hba_numbers.txt) DO	(					
																	IF EXIST %TW-WS%expanders_hba%%i.txt	(
																						FOR /F "usebackq" %%j IN (%TW-WS%expanders_hba%%i.txt) DO	(
																														lsut -p %%i -a 64,%%j,Gen_Test_hba%%i_exp%%j.txt,rev,exit,0, >> misc_output.txt 2>&1
																														%grep% "Version Name:" Gen_Test_hba%%i_exp%%j.txt | %grep% -e SAS3xFW -e SAS35xFW >> misc_output.txt 2>&1
																														IF NOT ERRORLEVEL 1	( 
																																	@ECHO %%j >> %TW-WS%gen3_expanders_hba%%i.txt
																																	)
																														%grep% "Version Name:" Gen_Test_hba%%i_exp%%j.txt | %grep% SAS4xFW >> misc_output.txt 2>&1
																														IF NOT ERRORLEVEL 1	( 
																																	@ECHO %%j >> %TW-WS%gen4_expanders_hba%%i.txt
																																	)
																														move /Y Gen_Test_hba%%i_exp%%j.txt %TW-WS% >> misc_output.txt 2>&1
																														)
																						)
																	IF EXIST %TW-WS%gen3_expanders_hba%%i.txt	(
																							FOR /F "usebackq" %%j IN (%TW-WS%gen3_expanders_hba%%i.txt) DO	(
																															lsut -p %%i -a 64,%%j,"sasaddr_hba%%i_exp%%j.txt",sasaddr,exit,0, >> misc_output.txt 2>&1	
																															IF EXIST sasaddr_hba%%i_exp%%j.txt move /Y sasaddr_hba%%i_exp%%j.txt %TW-WS%sasaddr_hba%%i_exp%%j.txt >> misc_output.txt 2>&1
																															)
																							)
																	IF EXIST %TW-WS%gen3_expanders_hba%%i.txt	(
																							FOR /F "usebackq" %%j IN (%TW-WS%gen3_expanders_hba%%i.txt) DO	(									
																															IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
																															@ECHO Start on HBA %%i Expander %%j...
																															@ECHO Start on HBA %%i Expander %%j... >> misc_output.txt 2>&1
																															@ECHO Start on HBA %%i Expander %%j... > %TW-WS%Start_on_HBA%%i_Expander%%j.txt
																															IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_on_HBA%%i_Expander%%j.txt >> misc_output.txt 2>&1)
																															%grep% "SxP Port 1 SAS Address:" %TW-WS%sasaddr_hba%%i_exp%%j.txt | %cut% -d: -f2 | %cut% -dx -f2 | %tr% -d '\r' | %cut% -d: -f2 | %cut% -dx -f2 | %tr% -d '\r' > %TW-WS%gen3_raw_sasaddr_hba%%i_exp%%j.txt
																															IF NOT EXIST %TW-FN%\LSI_Products\Expander mkdir %TW-FN%\LSI_Products\Expander
																															IF NOT EXIST %TW-FN%\LSI_Products\Expander\12Gb mkdir %TW-FN%\LSI_Products\Expander\12Gb
																															IF NOT EXIST %TW-FN%\LSI_Products\Expander\12Gb\Details mkdir %TW-FN%\LSI_Products\Expander\12Gb\Details
																															FOR /F "usebackq" %%k IN (%TW-WS%gen3_raw_sasaddr_hba%%i_exp%%j.txt) DO	(
																																								FOR /F "tokens=1 delims=?" %%l IN (%TW-WS%gen3_expander_cli_cmds.txt) DO	(
																																																		lsut -p %%i -a 64,%%j,"%%l hba%%i_exp%%j.txt","%%l",exit,0, >> misc_output.txt 2>&1
																																																		%grep% -i -e "Invalid Command" "%%l hba%%i_exp%%j.txt" >> misc_output.txt 2>&1
																																																		IF ERRORLEVEL 1	( 
																																														  						                            	 REM   ......................................::.......................................
																																																				IF [%%l]==[rdcfg 0xfe01 0] 	@ECHO .............................Enclosure Logical ID.............................. >> %%k_debuginfo_manual_hba%%i_exp%%j.txt
																																																							      	 REM   ......................................::.......................................																																															
																																																				IF [%%l]==[adcread 1 1 1000] 	@ECHO .................................temperature................................... >> %%k_debuginfo_manual_hba%%i_exp%%j.txt						
																																																				REM   ......................................::.......................................
																																																				@ECHO .....................................%%l......................................... >> %%k_debuginfo_manual_hba%%i_exp%%j.txt
																																																				type "%%l hba%%i_exp%%j.txt" >> %%k_debuginfo_manual_hba%%i_exp%%j.txt
																																																				move /Y "%%l hba%%i_exp%%j.txt" %TW-FN%\LSI_Products\Expander\12Gb\Details\"%%k %%l hba%%i_exp%%j.txt" >> misc_output.txt 2>&1
																																																				)
																																																		IF EXIST "%%l hba%%i_exp%%j.txt" move /Y "%%l hba%%i_exp%%j.txt" %TW-WS%"%%k %%l hba%%i_exp%%j.txt" >> misc_output.txt 2>&1									
																																																		)												
																																								lsut -p %%i -a 64,%%j,"debuginfo hba%%i_exp%%j.txt",debuginfo,exit,0, >> misc_output.txt 2>&1
																																								%grep% -i -e "Invalid Command" "debuginfo hba%%i_exp%%j.txt" >> misc_output.txt 2>&1
																																								IF ERRORLEVEL 1	( 
																																										REM   ......................................::.......................................
																																										@ECHO ..................................debuginfo.................................... >> %%k_debuginfo_hba%%i_exp%%j.txt
																																										type "debuginfo hba%%i_exp%%j.txt" >> %%k_debuginfo_hba%%i_exp%%j.txt
																																										move /Y "debuginfo hba%%i_exp%%j.txt" %TW-FN%\LSI_Products\Expander\12Gb\Details\"%%k debuginfo hba%%i_exp%%j.txt" >> misc_output.txt 2>&1
																																										move /Y %%k_debuginfo_hba%%i_exp%%j.txt %TW-FN%\LSI_Products\Expander\12Gb\%%k_debuginfo_hba%%i_exp%%j.txt >> misc_output.txt 2>&1
																																										)
																																								IF EXIST "debuginfo hba%%i_exp%%j.txt" move /Y "debuginfo hba%%i_exp%%j.txt" %TW-WS%"%%k debuginfo hba%%i_exp%%j.txt" >> misc_output.txt 2>&1	
																																								IF EXIST %TW-FN%\LSI_Products\Expander\12Gb\Details\"%%k coredump hba%%i_exp%%j.txt" %grep% "Checking for valid coredump image...SUCCESS." "%TW-FN%\LSI_Products\Expander\12Gb\Details\%%k coredump hba%%i_exp%%j.txt" >> misc_output.txt 2>&1
																																								IF NOT ERRORLEVEL 1	(
																																											move /Y %TW-FN%\LSI_Products\Expander\12Gb\Details\"%%k coredump hba%%i_exp%%j.txt" %TW-FN%\LSI_Products\Expander\12Gb\Details\"COREDUMP %%k hba%%i_exp%%j.txt" >> misc_output.txt 2>&1													
																																											IF EXIST %TW-FN%\LSI_Products\Expander\12Gb\Details\"COREDUMP %%k hba%%i_exp%%j.txt" copy %TW-FN%\LSI_Products\Expander\12Gb\Details\"COREDUMP %%k hba%%i_exp%%j.txt" %TW-FN%\LSI_Products\Expander\12Gb\"COREDUMP %%k hba%%i_exp%%j.txt" >> misc_output.txt 2>&1
																																											)
																																								IF EXIST %%k_debuginfo_manual_hba%%i_exp%%j.txt move /Y %%k_debuginfo_manual_hba%%i_exp%%j.txt %TW-FN%\LSI_Products\Expander\12Gb\ >> misc_output.txt 2>&1													
																																								)
																															@ECHO End on HBA%%i Expander%%j... >> misc_output.txt 2>&1
																															@ECHO End on HBA%%i Expander%%j... > %TW-WS%End_on_HBA%%i_Expander%%j.txt
																															IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_on_HBA%%i_Expander%%j.txt >> misc_output.txt 2>&1)
																															IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
																															)
					
																							)
																	)
										)					
				)
											

REM ###########################################################################################################################
REM # Get LSI Expander Info with xutils
REM ###########################################################################################################################

	
REM xtools commands
@ECHO exp> %TW-WS%g3xu_cmds_Gen3.txt
@ECHO region>> %TW-WS%g3xu_cmds_Gen3.txt
@ECHO attach>> %TW-WS%g3xu_cmds_Gen3.txt
@ECHO port>> %TW-WS%g3xu_cmds_Gen3.txt
@ECHO phy>> %TW-WS%g3xu_cmds_Gen3.txt
@ECHO trace>> %TW-WS%g3xu_cmds_Gen3.txt
@ECHO log>> %TW-WS%g3xu_cmds_Gen3.txt
@ECHO zgrp>> %TW-WS%g3xu_cmds_Gen3.txt
@ECHO zperm>> %TW-WS%g3xu_cmds_Gen3.txt
REM xtools commands
@ECHO exp> %TW-WS%xu_cmds_Gen2.txt
@ECHO region>> %TW-WS%xu_cmds_Gen2.txt
@ECHO attach>> %TW-WS%xu_cmds_Gen2.txt
@ECHO port>> %TW-WS%xu_cmds_Gen2.txt
@ECHO phy>> %TW-WS%xu_cmds_Gen2.txt
@ECHO trace>> %TW-WS%xu_cmds_Gen2.txt
@ECHO log>> %TW-WS%xu_cmds_Gen2.txt
@ECHO zgrp>> %TW-WS%xu_cmds_Gen2.txt
@ECHO zperm>> %TW-WS%xu_cmds_Gen2.txt
REM xtools commands
@ECHO exp> %TW-WS%xu_cmds_Gen1.txt
@ECHO region>> %TW-WS%xu_cmds_Gen1.txt

REM Gen 3
g3xu -i get avail > %TW-FN%\script_workspace\g3xu_-i_get_avail.txt  2>&1
g3xu -i get avail | %grep% -E [0-9,A-F]+:[0-9,A-F]+ | %grep% -i -e sas3x -e sas_3x -e cobra -e sas35x -e sas_35x -e cub | %grep% -E -o [0-9,A-F]+:[0-9,A-F]+ >> %TW-FN%\script_workspace\Gen3_EXP_SAS_Address_RAW.txt  2>&1
dir %TW-WS% | find " 0 Gen3_EXP_SAS_Address_RAW.txt" >> misc_output.txt 2>&1
IF %ERRORLEVEL%==0 del %TW-FN%\script_workspace\Gen3_EXP_SAS_Address_RAW.txt >> misc_output.txt 2>&1
REM Make sure at least 1 SAS Address is identified

IF NOT EXIST %TW-WS%expanders_hbaX.txt	(
					IF EXIST %TW-WS%Gen3_EXP_SAS_Address_RAW.txt	(
											@ECHO .
											IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer8\timer8 /q /nologo)
											@ECHO Starting the Broadcom SAS Expander Data Collection...
											IF [%NOWOW64%]==[YES] (@ECHO %time%)
											@ECHO Starting the Broadcom SAS Expander Data Collection... >> misc_output.txt 2>&1
											@ECHO Starting the Broadcom SAS Expander Data Collection... > %TW-WS%Start_Expander.txt
											IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_Expander.txt >> misc_output.txt 2>&1)
											)		
					)

IF NOT EXIST %TW-WS%Gen3_EXP_SAS_Address_RAW.txt GOTO NO_Gen3_LSI_Expanders
IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
IF NOT EXIST %TW-FN%\LSI_Products\Expander mkdir %TW-FN%\LSI_Products\Expander
IF NOT EXIST %TW-FN%\LSI_Products\Expander\12Gb mkdir %TW-FN%\LSI_Products\Expander\12Gb
IF NOT EXIST %TW-FN%\LSI_Products\Expander\12Gb\Details mkdir %TW-FN%\LSI_Products\Expander\12Gb\Details
FOR /F "tokens=1,2 delims=:" %%i in (%TW-FN%\script_workspace\Gen3_EXP_SAS_Address_RAW.txt) DO (@ECHO %%i%%j >> %TW-FN%\script_workspace\Gen3_EXP_SAS_Address.txt)
g3xu -i get avail > %TW-FN%\LSI_Products\Expander\12Gb\get_avail.txt 2>&1
FOR /F "usebackq" %%i in (%TW-FN%\script_workspace\Gen3_EXP_SAS_Address.txt) DO	(
										IF NOT EXIST %TW-WS%Existing_12Gb_%%i_Xtools.txt	( 
																	@ECHO %%i > %TW-WS%Existing_12Gb_%%i_Xtools.txt
																	@ECHO %%i > %TW-WS%Start_on_EXP_%%i.txt
																	IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
																	@ECHO Start on Expander %%i
																	@ECHO Start on Expander %%i >> misc_output.txt 2>&1
																	@ECHO Start on Expander %%i > %TW-WS%Start_on_EXP_%%i.txt
																	IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_on_EXP_%%i.txt >> misc_output.txt 2>&1)
																	FOR /L %%j IN (0,1,3) DO	(
																					REM   ......................................::.......................................
																					@ECHO ..................................Region %%j..................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%i_get_ver.txt 2>&1
																					g3xu -i %%i get ver %%j >> %TW-FN%\LSI_Products\Expander\12Gb\%%i_get_ver.txt 2>&1
																					)
																	FOR /L %%j IN (0,1,2) DO	(
																					REM   ......................................::.......................................
																					g3xu -i %%i up fw %TW-FN%\LSI_Products\Expander\12Gb\%%i_region-%%j_up_fw.bin %%j -y >> misc_output.txt 2>&1
																					)
																	FOR /L %%j IN (3,1,3) DO	(
																					REM   ......................................::.......................................
																					g3xu -i %%i up mfg %TW-FN%\LSI_Products\Expander\12Gb\%%i_region-%%j_up_mfg.bin %%j -y >> misc_output.txt 2>&1
																					)
																	IF EXIST %TW-FN%\LSI_Products\Expander\12Gb\get_avail.txt 	(
																									REM   ......................................::.......................................
																									@ECHO ..................................get avail.................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%i_Xtools.txt
																									type %TW-FN%\LSI_Products\Expander\12Gb\get_avail.txt >> %TW-FN%\LSI_Products\Expander\12Gb\%%i_Xtools.txt
																									)
																	IF EXIST %TW-FN%\LSI_Products\Expander\12Gb\%%i_get_ver.txt 	(
																									REM   ......................................::.......................................
																									@ECHO ...................................get ver..................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%i_Xtools.txt
																									type %TW-FN%\LSI_Products\Expander\12Gb\%%i_get_ver.txt >> %TW-FN%\LSI_Products\Expander\12Gb\%%i_Xtools.txt
																									move /Y %TW-FN%\LSI_Products\Expander\12Gb\%%i_get_ver.txt %TW-FN%\LSI_Products\Expander\12Gb\Details\%%i_get_ver.txt >> misc_output.txt 2>&1
																									)
																	FOR /F "usebackq" %%j in (%TW-WS%g3xu_cmds_Gen3.txt) DO	(					
																								g3xu -i %%i get %%j > %TW-FN%\LSI_Products\Expander\12Gb\%%i_get_%%j.txt  2>&1
																								REM   ......................................::.......................................
																								@ECHO .....................................%%j......................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%i_Xtools.txt
																								type %TW-FN%\LSI_Products\Expander\12Gb\%%i_get_%%j.txt >> %TW-FN%\LSI_Products\Expander\12Gb\%%i_Xtools.txt
																								move /Y %TW-FN%\LSI_Products\Expander\12Gb\%%i_get_%%j.txt %TW-FN%\LSI_Products\Expander\12Gb\Details\%%i_get_%%j.txt >> misc_output.txt 2>&1		
																								)
																	@ECHO End on Expander %%i >> misc_output.txt 2>&1
																	@ECHO End on Expander %%i > %TW-WS%End_on_EXP_%%i.txt
																	IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_on_EXP_%%i.txt >> misc_output.txt 2>&1)
																	IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
																	)
										)			
IF EXIST %TW-FN%\LSI_Products\Expander\12Gb\get_avail.txt move /Y %TW-FN%\LSI_Products\Expander\12Gb\get_avail.txt %TW-FN%\LSI_Products\Expander\12Gb\Details\get_avail.txt >> misc_output.txt 2>&1
:NO_Gen3_LSI_Expanders

REM ###########################################################################################################################
REM # Get LSI Expander Info with scl
REM ###########################################################################################################################

IF NOT [%NO_scl_EXP-IOC%]==[YES]	(
					scl --list | %grep% DeviceId -A 100 | %grep% ")" | %grep% -e SAS3x -e SAS35x >> %TW-WS%sc_gen3_exps_raw.txt 2>&1 
					IF EXIST %TW-WS%sc_gen3_exps_raw.txt dir %TW-WS%sc_gen3_exps_raw.txt | %grep% " 0 sc_gen3_exps_raw.txt" >> misc_output.txt 2>&1
					IF NOT ERRORLEVEL 1 move %TW-WS%sc_gen3_exps_raw.txt %TW-WS%0Byte_sc_gen3_exps_raw.txt >> misc_output.txt 2>&1
					IF EXIST %TW-WS%sc_gen3_exps_raw.txt	(
									 	SET NO_scl_EXP=NO
										@ECHO IN__scl_EXP_Branch_1 >> misc_output.txt 2>&1
										IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
										IF NOT EXIST %TW-FN%\LSI_Products\Expander mkdir %TW-FN%\LSI_Products\Expander
										IF NOT EXIST %TW-FN%\LSI_Products\Expander\12Gb mkdir %TW-FN%\LSI_Products\Expander\12Gb
										IF NOT EXIST %TW-FN%\LSI_Products\Expander\12Gb\Details mkdir %TW-FN%\LSI_Products\Expander\12Gb\Details
										scl --list | %grep% DeviceId -A 100 | %grep% -e SAS3x -e SAS35x > %TW-FN%\LSI_Products\Expander\12Gb\Details\sc_expanders.txt
										FOR /F delims^=^)^ tokens^=1 %%i in (%TW-WS%sc_gen3_exps_raw.txt) DO (@ECHO %%i >> %TW-WS%sc_gen3_exps_raw1.txt)
										FOR /F "tokens=1 delims= " %%i in (%TW-WS%sc_gen3_exps_raw1.txt) DO (@ECHO %%i >> %TW-WS%sc_gen3_exp_nums.txt)
										@ECHO IN__scl_EXP_Branch_2 >> misc_output.txt 2>&1
										FOR /F "tokens=1" %%i in (%TW-WS%sc_gen3_exp_nums.txt) DO	(
																		@ECHO IN__scl_EXP_Branch_3_EXP%%i >> misc_output.txt 2>&1
																		scl -i %%i show | %grep% "SAS Address" > %TW-WS%sc_exp_%%i_sasaddr.txt
																		FOR /F "tokens=2 delims=:" %%j in (%TW-WS%sc_exp_%%i_sasaddr.txt) DO (@ECHO %%j > %TW-WS%sc_exp_%%i_sasaddr1.txt)																				
																		FOR /F "tokens=1,2,3,4 delims=- " %%j in (%TW-WS%sc_exp_%%i_sasaddr1.txt) DO (@ECHO %%j%%k%%l%%m > %TW-WS%sc_exp_%%i_sasaddr2.txt)
																		FOR /F "tokens=1" %%j in (%TW-WS%sc_exp_%%i_sasaddr2.txt) DO	(
																										@ECHO IN__scl_EXP_Branch_4_EXP%%i >> misc_output.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ................................scli Expanders................................. >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl --list | %grep% DeviceId >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl --list | %grep% DeviceId -A 100 | %grep% -e SAS3x -e SAS35x >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ..................................show -all.................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i show -all >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ..................................show -temp................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i show -temp >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ..................................show -mfg.................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i show -mfg >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ....................................phy -da.................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i phy -da >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ...................................phy -edfb................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i phy -edfb >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ...................................phy -err.................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i phy -err >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ..................................phy -speed................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i phy -speed >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ..................................encl......................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i encl >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO .....................................trace..................................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i trace >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										REM   ......................................::.......................................
																										@ECHO ..............................healthlogs -decode............................... >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i healthlogs -decode >> %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i.txt 2>&1
																										scl -i %%i ul -fw %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i_up_fw.bin >> misc_output.txt 2>&1
																										scl -i %%i ul -mfg %TW-FN%\LSI_Products\Expander\12Gb\%%j_scli_exp%%i_up_mfg.bin >> misc_output.txt 2>&1
																										)
																		)	
										)
					)

IF [%NOWOW64%]==[YES] GOTO NOWOW64_SKIP_XU
REM Gen 2
xu -i get avail > %TW-FN%\script_workspace\xu_-i_get_avail.txt  2>&1
xu -i get avail | %grep% -E [0-9,A-F]+:[0-9,A-F]+ | %grep% -i -e sas2x -e sas_2x -e bobcat | %grep% -E -o [0-9,A-F]+:[0-9,A-F]+ >> %TW-FN%\script_workspace\Gen2_EXP_SAS_Address_RAW.txt  2>&1
dir %TW-WS% | find " 0 Gen2_EXP_SAS_Address_RAW.txt" >> misc_output.txt 2>&1
IF %ERRORLEVEL%==0 del %TW-FN%\script_workspace\Gen2_EXP_SAS_Address_RAW.txt >> misc_output.txt 2>&1
REM Make sure at least 1 SAS Address is identified

IF NOT EXIST %TW-WS%expanders_hbaX.txt	(
					IF NOT EXIST %TW-WS%Gen3_EXP_SAS_Address_RAW.txt	(
												IF EXIST %TW-WS%Gen2_EXP_SAS_Address_RAW.txt	(
																		@ECHO .
																		IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer8\timer8 /q /nologo)
																		@ECHO Starting the Broadcom SAS Expander Data Collection...
																		@ECHO Starting the Broadcom SAS Expander Data Collection... >> misc_output.txt 2>&1
																		@ECHO Starting the Broadcom SAS Expander Data Collection... > %TW-WS%Start_Expander.txt
																		IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%Start_Expander.txt >> misc_output.txt 2>&1)
																		)		
												)
					)

IF NOT EXIST %TW-WS%Gen2_EXP_SAS_Address_RAW.txt GOTO NO_Gen2_LSI_Expanders
IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
IF NOT EXIST %TW-FN%\LSI_Products\Expander mkdir %TW-FN%\LSI_Products\Expander
IF NOT EXIST %TW-FN%\LSI_Products\Expander\6Gb mkdir %TW-FN%\LSI_Products\Expander\6Gb
IF NOT EXIST %TW-FN%\LSI_Products\Expander\6Gb\Details mkdir %TW-FN%\LSI_Products\Expander\6Gb\Details
FOR /F "tokens=1,2 delims=:" %%i in (%TW-FN%\script_workspace\Gen2_EXP_SAS_Address_RAW.txt) DO (@ECHO %%i%%j >> %TW-FN%\script_workspace\Gen2_EXP_SAS_Address.txt)
xu -i get avail > %TW-FN%\LSI_Products\Expander\6Gb\get_avail.txt 2>&1
FOR /F "usebackq" %%i in (%TW-FN%\script_workspace\Gen2_EXP_SAS_Address.txt) DO	(
										IF NOT EXIST %TW-WS%Existing_6Gb_%%i_Xtools.txt	( 
																@ECHO %%i > %TW-WS%Existing_6Gb_%%i_Xtools.txt
																%TW-WS%timers\timer100\timer100 /q /nologo
																@ECHO Start on Expander %%i
																@ECHO Start on Expander %%i >> misc_output.txt 2>&1
																@ECHO Start on Expander %%i > %TW-WS%Start_on_EXP_%%i.txt
																xdir /Form=*t %TW-WS%Start_on_EXP_%%i.txt >> misc_output.txt 2>&1
																FOR /L %%j IN (0,1,3) DO	(
																				REM   ......................................::.......................................
																				@ECHO ..................................Region %%j..................................... >> %TW-FN%\LSI_Products\Expander\6Gb\%%i_get_ver.txt 2>&1
																				xu -i %%i get ver %%j >> %TW-FN%\LSI_Products\Expander\6Gb\%%i_get_ver.txt 2>&1
																				)
																FOR /L %%j IN (0,1,2) DO	(
																				REM   ......................................::.......................................
																				xu -i %%i up fw %TW-FN%\LSI_Products\Expander\6Gb\%%i_region-%%j_up_fw.bin %%j -y >> misc_output.txt 2>&1
																				)
																FOR /L %%j IN (3,1,3) DO	(
																				REM   ......................................::.......................................
																				xu -i %%i up mfg %TW-FN%\LSI_Products\Expander\6Gb\%%i_region-%%j_up_mfg.bin %%j -y >> misc_output.txt 2>&1
																				)
																IF EXIST %TW-FN%\LSI_Products\Expander\6Gb\get_avail.txt 	(
																								REM   ......................................::.......................................
																								@ECHO ..................................get avail.................................... >> %TW-FN%\LSI_Products\Expander\6Gb\%%i_Xtools.txt
																								type %TW-FN%\LSI_Products\Expander\6Gb\get_avail.txt >> %TW-FN%\LSI_Products\Expander\6Gb\%%i_Xtools.txt
																								)
																IF EXIST %TW-FN%\LSI_Products\Expander\6Gb\%%i_get_ver.txt 	(
																								REM   ......................................::.......................................
																								@ECHO ...................................get ver..................................... >> %TW-FN%\LSI_Products\Expander\6Gb\%%i_Xtools.txt
																								type %TW-FN%\LSI_Products\Expander\6Gb\%%i_get_ver.txt >> %TW-FN%\LSI_Products\Expander\6Gb\%%i_Xtools.txt
																								move /Y %TW-FN%\LSI_Products\Expander\6Gb\%%i_get_ver.txt %TW-FN%\LSI_Products\Expander\6Gb\Details\%%i_get_ver.txt >> misc_output.txt 2>&1
																								)
																FOR /F "usebackq" %%j in (%TW-WS%xu_cmds_Gen2.txt) DO	(					
																							xu -i %%i get %%j > %TW-FN%\LSI_Products\Expander\6Gb\%%i_get_%%j.txt  2>&1
																							REM   ......................................::.......................................
																							@ECHO .....................................%%j......................................... >> %TW-FN%\LSI_Products\Expander\6Gb\%%i_Xtools.txt
																							type %TW-FN%\LSI_Products\Expander\6Gb\%%i_get_%%j.txt >> %TW-FN%\LSI_Products\Expander\6Gb\%%i_Xtools.txt
																							move /Y %TW-FN%\LSI_Products\Expander\6Gb\%%i_get_%%j.txt %TW-FN%\LSI_Products\Expander\6Gb\Details\%%i_get_%%j.txt >> misc_output.txt 2>&1
																							)
																@ECHO End on Expander %%i >> misc_output.txt 2>&1
																@ECHO End on Expander %%i > %TW-WS%End_on_EXP_%%i.txt
																xdir /Form=*t %TW-WS%End_on_EXP_%%i.txt >> misc_output.txt 2>&1
																%TW-WS%timers\timer100\timer100 /s /nologo	
																)
										)
IF EXIST %TW-FN%\LSI_Products\Expander\6Gb\get_avail.txt move /Y %TW-FN%\LSI_Products\Expander\6Gb\get_avail.txt %TW-FN%\LSI_Products\Expander\6Gb\Details\get_avail.txt >> misc_output.txt 2>&1
:NO_Gen2_LSI_Expanders

REM Gen 1
xu -i get avail > %TW-FN%\script_workspace\xu_-i_get_avail.txt  2>&1
xu -i get avail | %grep% -E [0-9,A-F]+:[0-9,A-F]+ | %grep% -i -e sasx -e sas_x -e yeti | %grep% -E -o [0-9,A-F]+:[0-9,A-F]+ >> %TW-FN%\script_workspace\Gen1_EXP_SAS_Address_RAW.txt  2>&1
dir %TW-WS% | find " 0 Gen1_EXP_SAS_Address_RAW.txt" >> misc_output.txt 2>&1
IF %ERRORLEVEL%==0 del %TW-FN%\script_workspace\Gen1_EXP_SAS_Address_RAW.txt >> misc_output.txt 2>&1
REM Make sure at least 1 SAS Address is identified

IF NOT EXIST %TW-WS%expanders_hbaX.txt	(
					IF NOT EXIST %TW-WS%Gen3_EXP_SAS_Address_RAW.txt	(
												IF NOT EXIST %TW-WS%Gen2_EXP_SAS_Address_RAW.txt	(
																			IF EXIST %TW-WS%Gen1_EXP_SAS_Address_RAW.txt	(
																									@ECHO .
																									%TW-WS%timers\timer8\timer8 /q /nologo
																									@ECHO Starting the Broadcom SAS Expander Data Collection...
																									@ECHO Starting the Broadcom SAS Expander Data Collection... >> misc_output.txt 2>&1
																									@ECHO Starting the Broadcom SAS Expander Data Collection... > %TW-WS%Start_Expander.txt
																									xdir /Form=*t %TW-WS%Start_Expander.txt >> misc_output.txt 2>&1
																									)		
																			)
												)
					)

IF NOT EXIST %TW-WS%Gen1_EXP_SAS_Address_RAW.txt GOTO NO_Gen1_LSI_Expanders
IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
IF NOT EXIST %TW-FN%\LSI_Products\Expander mkdir %TW-FN%\LSI_Products\Expander
IF NOT EXIST %TW-FN%\LSI_Products\Expander\3Gb mkdir %TW-FN%\LSI_Products\Expander\3Gb
IF NOT EXIST %TW-FN%\LSI_Products\Expander\3Gb\Details mkdir %TW-FN%\LSI_Products\Expander\3Gb\Details
FOR /F "tokens=1,2 delims=:" %%i in (%TW-FN%\script_workspace\Gen1_EXP_SAS_Address_RAW.txt) DO (@ECHO %%i%%j >> %TW-FN%\script_workspace\Gen1_EXP_SAS_Address.txt)
xu -i get avail > %TW-FN%\LSI_Products\Expander\3Gb\get_avail.txt 2>&1
FOR /F "usebackq" %%i in (%TW-FN%\script_workspace\Gen1_EXP_SAS_Address.txt) DO	(
										IF NOT EXIST %TW-WS%Existing_3Gb_%%i_Xtools.txt	( 
																@ECHO %%i > %TW-WS%Existing_3Gb_%%i_Xtools.txt
																%TW-WS%timers\timer100\timer100 /q /nologo
																@ECHO Start on Expander %%i
																@ECHO Start on Expander %%i >> misc_output.txt 2>&1
																@ECHO Start on Expander %%i > %TW-WS%Start_on_EXP_%%i.txt
																xdir /Form=*t %TW-WS%Start_on_EXP_%%i.txt >> misc_output.txt 2>&1
																FOR /L %%j IN (0,1,3) DO	(
																				REM   ......................................::.......................................
																				@ECHO ..................................Region %%j..................................... >> %TW-FN%\LSI_Products\Expander\3Gb\%%i_get_ver.txt 2>&1
																				xu -i %%i get ver %%j >> %TW-FN%\LSI_Products\Expander\3Gb\%%i_get_ver.txt 2>&1
																				)
																FOR /L %%j IN (0,1,2) DO	(
																				REM   ......................................::.......................................
																				xu -i %%i up fw %TW-FN%\LSI_Products\Expander\3Gb\%%i_region-%%j_up_fw.bin %%j -y >> misc_output.txt 2>&1
																				)
																FOR /L %%j IN (3,1,3) DO	(
																				REM   ......................................::.......................................
																				xu -i %%i up mfg %TW-FN%\LSI_Products\Expander\3Gb\%%i_region-%%j_up_mfg.bin %%j -y >> misc_output.txt 2>&1
																				)
																IF EXIST %TW-FN%\LSI_Products\Expander\3Gb\get_avail.txt 	(
						
																								REM   ......................................::.......................................
																								@ECHO ..................................get avail.................................... >> %TW-FN%\LSI_Products\Expander\3Gb\%%i_Xtools.txt
																								type %TW-FN%\LSI_Products\Expander\3Gb\get_avail.txt >> %TW-FN%\LSI_Products\Expander\3Gb\%%i_Xtools.txt
																								)
																IF EXIST %TW-FN%\LSI_Products\Expander\3Gb\%%i_get_ver.txt 	(
																								REM   ......................................::.......................................
																								@ECHO ...................................get ver..................................... >> %TW-FN%\LSI_Products\Expander\3Gb\%%i_Xtools.txt
																								type %TW-FN%\LSI_Products\Expander\3Gb\%%i_get_ver.txt >> %TW-FN%\LSI_Products\Expander\3Gb\%%i_Xtools.txt
																								move /Y %TW-FN%\LSI_Products\Expander\3Gb\%%i_get_ver.txt %TW-FN%\LSI_Products\Expander\3Gb\Details\%%i_get_ver.txt >> misc_output.txt 2>&1 
																								)
																FOR /F "usebackq" %%j in (%TW-WS%xu_cmds_Gen1.txt) DO	(					
																							xu -i %%i get %%j > %TW-FN%\LSI_Products\Expander\3Gb\%%i_get_%%j.txt  2>&1
																							REM   ......................................::.......................................
																							@ECHO .....................................%%j......................................... >> %TW-FN%\LSI_Products\Expander\3Gb\%%i_Xtools.txt
																							type %TW-FN%\LSI_Products\Expander\3Gb\%%i_get_%%j.txt >> %TW-FN%\LSI_Products\Expander\3Gb\%%i_Xtools.txt
																							move /Y %TW-FN%\LSI_Products\Expander\3Gb\%%i_get_%%j.txt %TW-FN%\LSI_Products\Expander\3Gb\Details\%%i_get_%%j.txt >> misc_output.txt 2>&1
																							)
																@ECHO End on Expander %%i >> misc_output.txt 2>&1
																@ECHO End on Expander %%i > %TW-WS%End_on_EXP_%%i.txt
																xdir /Form=*t %TW-WS%End_on_EXP_%%i.txt >> misc_output.txt 2>&1
																%TW-WS%timers\timer100\timer100 /s /nologo	
																)
										)
IF EXIST %TW-FN%\LSI_Products\Expander\3Gb\get_avail.txt move /Y %TW-FN%\LSI_Products\Expander\3Gb\get_avail.txt %TW-FN%\LSI_Products\Expander\3Gb\Details\get_avail.txt >> misc_output.txt 2>&1
:NO_Gen1_LSI_Expanders
:NOWOW64_SKIP_XU

IF EXIST %TW-WS%Gen4_EXP_SAS_Address_RAW.txt (SET NO_g4xu_GEN4_EXPs=NO) ELSE SET NO_g4xu_GEN4_EXPs=YES
IF EXIST %TW-WS%Gen3_EXP_SAS_Address_RAW.txt (SET NO_g3xu_GEN3_EXPs=NO) ELSE SET NO_g3xu_GEN3_EXPs=YES
IF EXIST %TW-WS%Gen2_EXP_SAS_Address_RAW.txt (SET NO_xu_GEN2_EXPs=NO) ELSE SET NO_xu_GEN2_EXPs=YES
IF EXIST %TW-WS%Gen1_EXP_SAS_Address_RAW.txt (SET NO_xu_GEN1_EXPs=NO) ELSE SET NO_xu_GEN1_EXPs=YES
IF EXIST %TW-WS%Gen4_EXP_SAS_Address_RAW.txt type %TW-WS%Gen4_EXP_SAS_Address_RAW.txt >> %TW-WS%GenX_EXP_SAS_Address.txt
IF EXIST %TW-WS%Gen3_EXP_SAS_Address_RAW.txt type %TW-WS%Gen3_EXP_SAS_Address_RAW.txt >> %TW-WS%GenX_EXP_SAS_Address.txt
IF EXIST %TW-WS%Gen2_EXP_SAS_Address_RAW.txt type %TW-WS%Gen2_EXP_SAS_Address_RAW.txt >> %TW-WS%GenX_EXP_SAS_Address.txt
IF EXIST %TW-WS%Gen1_EXP_SAS_Address_RAW.txt type %TW-WS%Gen1_EXP_SAS_Address_RAW.txt >> %TW-WS%GenX_EXP_SAS_Address.txt
IF EXIST %TW-WS%GenX_EXP_SAS_Address.txt (SET NO_Xxu_GenX_EXPs=NO) ELSE SET NO_Xxu_GenX_EXPs=YES

IF ["%NO_xu_GEN1_EXPs%"]==["YES"]	(
					IF ["%NO_xu_GEN2_EXPs%"]==["YES"]	(SET NO_xu_GEN1-2_EXPs=YES)
					)

IF ["%NO_g3xu_GEN3_EXPs%"]==["YES"]	(
					IF EXIST %TW-WS%GenX_EXP_SAS_Address.txt %grep% -c -e : %TW-WS%GenX_EXP_SAS_Address.txt | %grep% 1 >> misc_output.txt 2>&1
					IF NOT ERRORLEVEL 1 @ECHO No_Exp_Cumulative > %TW-WS%No_Exp_Cumulative.txt
					)

@ECHO End of the Broadcom SAS Expander Data Collection... >> misc_output.txt 2>&1
@ECHO End of the Broadcom SAS Expander Data Collection... > %TW-WS%End_Expander.txt

IF NOT EXIST %TW-WS%No_Exp_Cumulative.txt	(
						IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%End_Expander.txt >> misc_output.txt 2>&1)
						IF NOT [%NOWOW64%]==[YES] (@ECHO Cumulative - Expanders:)
						IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer8\timer8 /s /nologo)
						)


:SKIPEXPANDER
REM ###########################################################################################################################
REM # Partial capture
REM ###########################################################################################################################
IF [%TWGETPARTIALMODE%]==[G_AEC] GOTO NOT_MONITOR_MODE
IF [%TWGETPARTIALMODE%]==[G_DPM] GOTO NOT_MONITOR_MODE
IF [%TWGETPARTIALMODE%]==[G_AEC_DPM] GOTO NOT_MONITOR_MODE

IF [%TWGETPARTIALMODE%]==[E_AEC] GOTO END_No_Pause
IF [%TWGETPARTIALMODE%]==[E_DPM] GOTO END_No_Pause
IF [%TWGETPARTIALMODE%]==[E_AEC_DPM] GOTO END_No_Pause


REM																	
REM ###########################################################################################################################
REM Nytro MegaRaid (CSA)
REM ###########################################################################################################################
IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
					IF NOT ["%NO_MR_Adps%"]==["YES"]	(
										IF EXIST %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt	(
																	%grep% -i nytro %TW-FN%\LSI_Products\MegaRAID\Call_show_all.txt > %TW-WS%Initial_NMR_Test.txt	
																	IF EXIST %TW-WS%Initial_NMR_Test.txt dir %TW-WS%Initial_NMR_Test.txt | %grep% " 0 Initial_NMR_Test.txt" >> misc_output.txt 2>&1
																	IF NOT ERRORLEVEL 1 move /Y %TW-WS%Initial_NMR_Test.txt %TW-WS%0Byte_Initial_NMR_Test.txt >> misc_output.txt 2>&1
																	)
										)
					
					IF EXIST %TW-WS%Initial_NMR_Test.txt	(
										FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
																	%grep% -i nytro %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt >> %TW-WS%c%%i_Second_NMR_Test.txt
																	IF NOT ERRORLEVEL 1 @ECHO %%i >> %TW-WS%nmr_ctrl_nums.txt
																	)
										)
					
					IF EXIST %TW-WS%Initial_NMR_Test.txt	(
										FOR /F "usebackq" %%i IN (%TW-WS%nmr_ctrl_nums.txt) DO	(
																	%MR_Cli% /c%%i show j | %grep% -e "EID:Slt" > %TW-WS%c%%i_show_eidslt1_nmr.txt 2>&1
																	FOR /F delims^=^"^ tokens^=4 %%j IN (%TW-WS%c%%i_show_eidslt1_nmr.txt) DO @ECHO %%j >> %TW-WS%c%%i_show_eidslt_nmr.txt 2>&1
																	)
										)
					
					IF EXIST %TW-WS%Initial_NMR_Test.txt	(
										FOR /F "usebackq" %%i IN (%TW-WS%nmr_ctrl_nums.txt) DO	(
																	FOR /F "tokens=1,2 delims=:" %%j IN (%TW-WS%c%%i_show_eidslt_nmr.txt) DO	(
																											%MR_Cli% /c%%i/e%%j/s%%k show | %grep% -i nytro >> misc_output.txt 2>&1		
																											IF NOT ERRORLEVEL 1 @ECHO %%j:%%k >> %TW-WS%c%%i_nytro_eidslt_nmr.txt
																											)
																	) 
										)
					
					
					
					
					IF EXIST %TW-WS%Initial_NMR_Test.txt	(
										MKDIR %TW-FN%\LSI_Products\NytroMegaRAID
										FOR /F "usebackq" %%i IN (%TW-WS%nmr_ctrl_nums.txt) DO	(
																	IF EXIST %TW-WS%c%%i_nytro_eidslt_nmr.txt	(
																							FOR /F "tokens=1,2 delims=:" %%j IN (%TW-WS%c%%i_nytro_eidslt_nmr.txt) DO	(
																																	%MR_Cli% /c%%i/e%%j/s%%k show diag smartlog > %TW-FN%\LSI_Products\NytroMegaRAID\c%%i_e%%j_s%%ksmartlog.txt
																																	@ECHO %MR_Cli% /c%%i/e%%j/s%%k show diag errorlog "TIMES OUT/REMed Out" > %TW-FN%\LSI_Products\NytroMegaRAID\c%%i_e%%j_s%%kerrorlog.txt
																																	REM %MR_Cli% /c%%i/e%%j/s%%k show diag errorlog > %TW-FN%\LSI_Products\NytroMegaRAID\c%%i_e%%j_s%%kerrorlog.txt
																																	%MR_Cli% /c%%i/e%%j/s%%k show diag paniclog query > %TW-FN%\LSI_Products\NytroMegaRAID\c%%i_e%%j_s%%kpaniclog-query.txt
																																	@ECHO %MR_Cli% /c%%i/e%%j/s%%k show diag paniclog extractslot=x "Need feedback on syntax and when to pull log" > %TW-FN%\LSI_Products\NytroMegaRAID\c%%i_e%%j_s%%kpaniclog-extractslot.txt
																																	REM %MR_Cli% /c%%i/e%%j/s%%k show diag paniclog extractslot=x > %TW-FN%\LSI_Products\NytroMegaRAID\c%%i_e%%j_s%%kerrorlog.txt
																																	)
																							) 
																	)	
										)
					)
					




REM ###########################################################################################################################
REM # 3Ware/MegaRAID/HBA INF File Check - Changed in 2012, REMed out section
REM ###########################################################################################################################

REM @ECHO Copying the 3ware and MegaRAID inf files .....
REM mkdir %TW-FN%\LSI_Products\3Ware\inf
REM mkdir %TW-FN%\LSI_Products\MegaRAID\inf
REM mkdir %TW-FN%\LSI_Products\HBA\inf


REM FOR /L %%i IN (0,1,250) DO	(
REM 				IF EXIST %systemroot%\inf\oem%%i.inf find "3ware" %systemroot%\inf\oem%%i.inf >> misc_output.txt 2>&1
REM 				IF NOT ERRORLEVEL 1 copy %systemroot%\inf\oem%%i.inf %TW-FN%\LSI_Products\3Ware\inf >> misc_output.txt 2>&1
REM 				)
REM FOR /L %%i IN (0,1,250) DO	(
REM 				IF EXIST %systemroot%\inf\oem%%i.inf find "MegaRAID" %systemroot%\inf\oem%%i.inf >> misc_output.txt 2>&1
REM 				IF NOT ERRORLEVEL 1 copy %systemroot%\inf\oem%%i.inf %TW-FN%\LSI_Products\MegaRAID\inf >> misc_output.txt 2>&1
REM 				)
REM FOR /L %%i IN (0,1,250) DO	(
REM 				IF EXIST %systemroot%\inf\oem%%i.inf %grep% -i -e symmpi -e lsi_sas -e lsi_sas2 -e lsi_gen2 %systemroot%\inf\oem%%i.inf >> misc_output.txt 2>&1
REM 				IF NOT ERRORLEVEL 1 copy %systemroot%\inf\oem%%i.inf %TW-FN%\LSI_Products\HBA\inf >> misc_output.txt 2>&1
REM 				)


REM ###########################################################################################################################
REM # System Event Logs using Windows Events Command Line Utility
REM ###########################################################################################################################

IF NOT [%NOWOW64%]==[YES]	(
				@ECHO .
				@ECHO Starting the Event Log Collections...
				wevtutil /? >> misc_output.txt 2>&1
				IF NOT ERRORLEVEL 1	(
							IF NOT EXIST %TW-FN%\System_Logs mkdir %TW-FN%\System_Logs >> misc_output.txt 2>&1
							wevtutil.exe epl System %TW-FN%\System_Logs\system.evt /ow:true
							)
				)

REM ###########################################################################################################################
REM # 3Ware/MegaRAID System/Application Event Logs using eventquery.vbs 
REM ###########################################################################################################################

IF EXIST %systemroot%\system32\eventquery.vbs GOTO HAVE_EVENTQUERY

REM No EVENTQUERY
GOTO USE_DUMPALL

:HAVE_EVENTQUERY

IF EXIST %systemroot%\system32\eventquery.vbs	(
						IF NOT EXIST %TW-FN%\System_Logs mkdir %TW-FN%\System_Logs >> misc_output.txt 2>&1			
						cscript %systemroot%\system32\eventquery.vbs /V /L system > %TW-FN%\System_Logs\system.log  2>&1
						cscript %systemroot%\system32\eventquery.vbs /V /L application > %TW-FN%\System_Logs\application.log  2>&1
						)

REM Removed, can add back if we see a need.
REM @ECHO Starting the Security Event Log Collection...
REM IF EXIST %systemroot%\system32\eventquery.vbs cscript %systemroot%\system32\eventquery.vbs /V /L security > %TW-FN%\security.log  2>&1

GOTO DONT_USE_DUMPEL

REM ###########################################################################################################################
REM # 3Ware/MegaRAID System/Application Event Logs using dumpel
REM ###########################################################################################################################
:USE_DUMPALL

dumpel /? >> misc_output.txt 2>&1
IF NOT ERRORLEVEL 1	(
			IF NOT EXIST %TW-FN%\System_Logs mkdir %TW-FN%\System_Logs >> misc_output.txt 2>&1
			dumpel -f %TW-FN%\System_Logs\system.log -l system >> misc_output.txt 2>&1
			dumpel -f %TW-FN%\System_Logs\application.log -l application >> misc_output.txt 2>&1
			)

REM Removed, can add back if we see a need.
REM @ECHO Starting the Security Event Log Collection...
REM dumpel -f %TW-FN%\security.log -l security  2>&1

:DONT_USE_DUMPEL

REM ###########################################################################################################################
REM # Deciphering System Log AEN's from both Dumpel & EventQuery
REM ###########################################################################################################################

IF NOT [%TWGETSKIP3WARE%]==[YES]	(
					IF EXIST %TW-FN%\System_Logs\system.log %grep% -i -e 3ware10k -e 3wareDrv -e 3wdrv100 -e 3wUpdate -e 3DM2 %TW-FN%\System_Logs\system.log > %TW-WS%system_3w.log  2>&1
					IF NOT ERRORLEVEL 1	(
								IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
								IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware
								move /Y %TW-WS%system_3w.log %TW-FN%\LSI_Products\3Ware\system_3w.log >> misc_output.txt 2>&1
								)	
					IF EXIST %TW-FN%\LSI_Products\3Ware\system_3w.log %grep% AEN %TW-FN%\LSI_Products\3Ware\system_3w.log > %TW-WS%system_AEN_3w.log  2>&1
					IF NOT ERRORLEVEL 1	(
								IF NOT EXIST %TW-FN%\LSI_Products\3Ware\Event_Logs mkdir %TW-FN%\LSI_Products\3Ware\Event_Logs
								move /Y %TW-WS%system_AEN_3w.log %TW-FN%\LSI_Products\3Ware\system_AEN_3w.log >> misc_output.txt 2>&1
								)	
					IF EXIST %TW-FN%\System_Logs\application.log %grep% -e 3wUpdate -e 3DM2 %TW-FN%\System_Logs\application.log > %TW-WS%application_3w.log  2>&1
					IF NOT ERRORLEVEL 1	(
								IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
								IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware
								move /Y %TW-WS%application_3w.log %TW-FN%\LSI_Products\3Ware\application_3w.log >> misc_output.txt 2>&1
								)	
					IF EXIST %TW-FN%\LSI_Products\3Ware\system_AEN_3w.log	(
												@ECHO Deciphering 3Ware System Log AEN's...
												FOR /F "delims==# tokens=1,2 skip=1" %%h in (%TW-WS%aens_3w.txt) DO	(
																					%grep% -e "%%h" %TW-FN%\LSI_Products\3Ware\system_AEN_3w.log > %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_%%i.txt 2>&1
																					for %%R in ("%TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_%%i.txt") do if %%~zR equ 0 del %TW-FN%\LSI_Products\3Ware\Event_Logs\"AEN_%%i.txt" 2>&1
																					)
												)
					)



IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
					IF EXIST %TW-FN%\System_Logs\system.log %grep% -i -e megasas -e megasas2 -e msas2k3 -e MR_MONITOR %TW-FN%\System_Logs\system.log > %TW-WS%system_mr.log  2>&1
					IF NOT ERRORLEVEL 1	(
								IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
								IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID
								move /Y %TW-WS%system_mr.log %TW-FN%\LSI_Products\MegaRAID\system_mr.log >> misc_output.txt 2>&1
								)	
					REM IF EXIST %TW-FN%\System_Logs\application.log %grep% -i -e megasas -e megasas2 -e msas2k3 -e MR_MONITOR %TW-FN%\System_Logs\application.log > %TW-FN%\LSI_Products\MegaRAID\application_mr.log  2>&1
					IF EXIST %TW-FN%\System_Logs\application.log %grep% -e MR_MONITOR %TW-FN%\System_Logs\application.log > %TW-WS%application_mr.log  2>&1
					IF NOT ERRORLEVEL 1	(
								IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
								IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID
								move /Y %TW-WS%application_mr.log %TW-FN%\LSI_Products\MegaRAID\application_mr.log >> misc_output.txt 2>&1
								)
					)				

IF NOT [%TWGETSKIPHBA%]==[YES]	(
				IF EXIST %TW-FN%\System_Logs\system.log %grep% -i -e symmpi -e lsi_sas -e lsi_sas2 -e lsi_gen2 -e lsi_sas3 -e MR_MONITOR %TW-FN%\System_Logs\system.log > %TW-WS%system_hba.log  2>&1
				IF NOT ERRORLEVEL 1	(
							IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
							IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID
							move /Y %TW-WS%system_hba.log %TW-FN%\LSI_Products\HBA\system_hba.log >> misc_output.txt 2>&1
							)
				REM IF EXIST %TW-FN%\System_Logs\application.log %grep% -i -e symmpi -e lsi_sas -e lsi_sas2 -e lsi_gen2 -e lsi_sas3 -e MR_MONITOR %TW-FN%\System_Logs\application_hba.log > %TW-WS%application_hba.log  2>&1
				REM IF NOT ERRORLEVEL 1	(
				REM 			IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
				REM 			IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\MegaRAID
				REM 			move /Y %TW-WS%application_hba.log %TW-FN%\LSI_Products\HBA\application_hba.log >> misc_output.txt 2>&1
				REM 			)
				)

IF EXIST %TW-FN%\System_Logs\system.log %grep% -e "\Device\Harddisk" %TW-FN%\System_Logs\system.log > %TW-WS%system_Device-Harddisk.log  2>&1
IF NOT ERRORLEVEL 1	(
			IF NOT EXIST %TW-FN%\System_Logs mkdir %TW-FN%\System_Logs
			move /Y %TW-WS%system_Device-Harddisk.log %TW-FN%\System_Logs\system_Device-Harddisk.log >> misc_output.txt 2>&1
			)

REM ###########################################################################################################################
REM Work around for Duplicate AEN #'s
REM ###########################################################################################################################
IF [%TWGETSKIP3WARE%]==[YES] GOTO NO_DUPE_3W_AENS		
IF NOT EXIST %TW-FN%\LSI_Products\3Ware\system_AEN_3w.log GOTO NO_DUPE_3W_AENS	
	SET tws1=62
	IF NOT EXIST %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt GOTO NO_AEN_Shared_0x%tws1%
	SET tws2=Enclosure_removed
	%grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF %ERRORLEVEL%==0 %grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws2%.txt
	SET tws2=Local_link_up
	%grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF %ERRORLEVEL%==0 %grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws2%.txt
	SET tws3=Enclosure_removed_OR_link_up
	%grep% "%tws1%:$" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF NOT %ERRORLEVEL%==0 GOTO NO_AEN_Shared_0x%tws1%
	@ECHO "AEN 0x%tws1%: Enclosure_removed__9.5.0_CodeSet_and_Later" >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	@ECHO "AEN 0x%tws1%: Local_link_up__PRE_9.5.0_CodeSet" >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	%grep% "%tws1%:$" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	:NO_AEN_Shared_0x62
	
	SET tws1=63
	IF NOT EXIST %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt GOTO NO_AEN_Shared_0x%tws1%
	SET tws2=Enclosure_added
	%grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF %ERRORLEVEL%==0 %grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws2%.txt
	SET tws2=Local_link_down
	%grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF %ERRORLEVEL%==0 %grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws2%.txt
	SET tws3=Enclosure_added_OR_link_down
	%grep% "%tws1%:$" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF NOT %ERRORLEVEL%==0 GOTO NO_AEN_Shared_0x%tws1%
	@ECHO "AEN 0x%tws1%: Enclosure_added__9.5.0_CodeSet_and_Later" >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	@ECHO "AEN 0x%tws1%: Local_link_down__PRE_9.5.0_CodeSet" >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	%grep% "%tws1%:$" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	:NO_AEN_Shared_0x63
	
	SET tws1=64
	IF NOT EXIST %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt GOTO NO_AEN_Shared_0x%tws1%
	SET tws2=Local_link_up
	%grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF %ERRORLEVEL%==0 %grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws2%.txt
	SET tws2=Enclosure_removed
	%grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF %ERRORLEVEL%==0 %grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws2%.txt
	SET tws3=Link_up_OR_Enclosure_removed
	%grep% "%tws1%:$" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF NOT %ERRORLEVEL%==0 GOTO NO_AEN_Shared_0x%tws1%
	@ECHO "AEN 0x%tws1%: Local_link_up__9.5.0_CodeSet_and_Later" >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	@ECHO "AEN 0x%tws1%: Enclosure_removed__Only_9.4.3_CodeSet" >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	%grep% "%tws1%:$" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	:NO_AEN_Shared_0x64
	
	SET tws1=65
	IF NOT EXIST %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt GOTO NO_AEN_Shared_0x%tws1%
	SET tws2=Local_link_down
	%grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF %ERRORLEVEL%==0 %grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws2%.txt
	SET tws2=Enclosure_added
	%grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF %ERRORLEVEL%==0 %grep% -e "%tws2%" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws2%.txt
	SET tws3=Link_down_OR_Enclosure_added
	%grep% "%tws1%:$" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> misc_output.txt 2>&1
	IF NOT %ERRORLEVEL%==0 GOTO NO_AEN_Shared_0x%tws1%
	@ECHO "AEN 0x%tws1%: Local_link_down__9.5.0_CodeSet_and_Later" >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	@ECHO "AEN 0x%tws1%: Enclosure_added__Only_9.4.3_CodeSet" >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	%grep% "%tws1%:$" %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x%tws1%.txt >> %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_0x%tws1%_%tws3%.txt
	:NO_AEN_Shared_0x65
	
	IF EXIST %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x****.txt copy %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x****.txt %TW-WS% >> misc_output.txt 2>&1
	IF EXIST %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x****.txt del %TW-FN%\LSI_Products\3Ware\Event_Logs\AEN_Shared_0x****.txt >> misc_output.txt 2>&1
:NO_DUPE_3W_AENS	

						
					


REM ###########################################################################################################################
REM # Dumping Registry Keys
REM ###########################################################################################################################

@ECHO .
IF [%HAVE_REG%]==[YES]	(
			IF NOT [%TWGETSKIP3WARE%]==[YES]	(
								IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
													IF NOT [%TWGETSKIPHBA%]==[YES]	(@ECHO Saving the 3Ware/MegaRAID/LSI HBA Registry Keys if present...)
													)
								)
			IF NOT [%TWGETSKIP3WARE%]==[YES]	(
								IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
													IF [%TWGETSKIPHBA%]==[YES] (@ECHO Saving the 3Ware/MegaRAID Registry Keys if present...)
													)
								)
			IF NOT [%TWGETSKIP3WARE%]==[YES]	(
								IF [%TWGETSKIPMEGARAID%]==[YES]	(
												IF [%TWGETSKIPHBA%]==[YES] (@ECHO Saving the 3Ware Registry Key if present...)
												)
								)




			IF NOT [%TWGETSKIP3WARE%]==[YES]	(
								IF [%TWGETSKIPMEGARAID%]==[YES]	(
												IF NOT [%TWGETSKIPHBA%]==[YES]	(@ECHO Saving the 3Ware/LSI HBA Registry Keys if present...)
												)
								)
			IF [%TWGETSKIP3WARE%]==[YES]	(
							IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
												IF NOT [%TWGETSKIPHBA%]==[YES] (@ECHO Saving the MegaRAID/LSI HBA Registry Keys if present...)
												)
							)
			IF [%TWGETSKIP3WARE%]==[YES]	(
							IF [%TWGETSKIPMEGARAID%]==[YES]	(
											IF NOT [%TWGETSKIPHBA%]==[YES] (@ECHO Saving the LSI HBA Registry Key if present...)
											)
							)


			IF [%TWGETSKIP3WARE%]==[YES]	(
							IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
												IF [%TWGETSKIPHBA%]==[YES]	(@ECHO Saving the MegaRAID Registry Key if present...)
												)
							)

			
			reg query HKLM\Hardware\Devicemap\SCSI /S > %TW-WS%sys-reg_hw_devicemap_scsi.txt 2>&1
			reg query HKLM\System\CurrentControlSet\Services\Disk /S > %TW-WS%sys-reg_Disk.txt 2>&1
			reg query HKLM\System\CurrentControlSet\Services\SNMP /S > %TW-WS%sys-reg_SNMP.txt 2>&1
			reg query HKLM\System\CurrentControlSet\Services\Wmi /S > %TW-WS%sys-reg_Wmi.txt 2>&1
			reg query HKLM\System\CurrentControlSet\Enum\PCI /S > %TW-WS%sys-reg_PCI.txt 2>&1
			dir %TW-WS%sys-reg_* /b > %TW-WS%initial_sys_reg-keys.txt
			FOR /F "tokens=1,2 delims=-" %%i IN (%TW-WS%initial_sys_reg-keys.txt) DO	(
													IF EXIST %TW-WS%%%i-%%j %grep% "unable to find the specified registry key" %TW-WS%%%i-%%j >> misc_output.txt 2>&1
													IF ERRORLEVEL 1	(
															IF NOT EXIST %TW-FN%\System_Reg_Keys mkdir %TW-FN%\System_Reg_Keys
															move /Y %TW-WS%%%i-%%j %TW-FN%\System_Reg_Keys\%%j >> misc_output.txt 2>&1
															)
													)
			IF NOT [%TWGETSKIP3WARE%]==[YES]	(
								REM LSI 3Ware RAID controllers
								REM 3ware10k.sys is for 6Gb SAS - StorePort
								reg query HKLM\SYSTEM\CurrentControlSet\Services\3ware10k /S > %TW-WS%3w-reg_3ware10k.txt 2>&1
								REM 3wareDrv.sys is for 3Gb SAS/SATA - MiniPort
								reg query HKLM\SYSTEM\CurrentControlSet\Services\3wareDrv /S > %TW-WS%3w-reg_3wareDrv.txt 2>&1
								REM 3wDrv100.sys is for 1.5Gb SATA 7/8K Series - MiniPort
								reg query HKLM\SYSTEM\CurrentControlSet\Services\3wDrv100 /S > %TW-WS%3w-reg_3wdrv100.txt 2>&1
								REM 3DM is for 1st Gen 3Ware GUI
								reg query HKLM\SYSTEM\CurrentControlSet\Services\3dm /S > %TW-WS%3w-reg_3dm.txt 2>&1
								REM 3DM2 is for 2nd Gen 3Ware GUI
								reg query HKLM\SYSTEM\CurrentControlSet\Services\3dm2 /S > %TW-WS%3w-reg_3dm2.txt 2>&1
								reg query HKEY_USERS\.DEFAULT\Software\3ware\3DM2 /S > %TW-WS%3w-reg_3dm2_config.txt 2>&1
								dir %TW-WS%3w-reg_* /b > %TW-WS%initial_3w_reg-keys.txt
								FOR /f "tokens=1,2 delims=-" %%i IN (%TW-WS%initial_3w_reg-keys.txt) DO	(
																	IF EXIST %TW-WS%%%i-%%j %grep% "unable to find the specified registry key" %TW-WS%%%i-%%j >> misc_output.txt 2>&1
																	IF ERRORLEVEL 1	(
																			IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
																			IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware
																			move /Y %TW-WS%%%i-%%j %TW-FN%\LSI_Products\3Ware\%%j >> misc_output.txt 2>&1
																			)
																	)
								)
			IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
								REM LSI MegaRAID
								reg query HKLM\SYSTEM\CurrentControlSet\Services\megasas /S > %TW-WS%mr-reg_megasas.txt 2>&1
								reg query HKLM\SYSTEM\CurrentControlSet\Services\megasas2 /S > %TW-WS%mr-reg_megasas2.txt 2>&1
								reg query HKLM\SYSTEM\CurrentControlSet\Services\msas2k3 /S > %TW-WS%mr-reg_msas2k3.txt 2>&1
								reg query "HKLM\SOFTWARE\LSI Logic Corporation" /S > %TW-WS%mr-reg_LSILogicCorp.txt 2>&1
								reg query HKLM\SOFTWARE\LSICorp /S > %TW-WS%mr-reg_LSICorp.txt 2>&1
								dir %TW-WS%mr-reg_* /b > %TW-WS%initial_mr_reg-keys.txt
								FOR /f "tokens=1,2 delims=-" %%i IN (%TW-WS%initial_mr_reg-keys.txt) DO	(
																	IF EXIST %TW-WS%%%i-%%j %grep% "unable to find the specified registry key" %TW-WS%%%i-%%j >> misc_output.txt 2>&1
																	IF ERRORLEVEL 1	(
																			IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
																			IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID
																			move /Y %TW-WS%%%i-%%j %TW-FN%\LSI_Products\MegaRAID\%%j >> misc_output.txt 2>&1
																			)
																	)
								)
			IF NOT [%TWGETSKIPHBA%]==[YES]	(
							REM Commented out export, getting load/unload error but only in script. MRR - 012511
							REM LSI HBA's
							REM SYMMPI.sys is for parallel SCSI & Fibre Channel Only - MiniPort
							reg query HKLM\SYSTEM\CurrentControlSet\Services\symmpi /S > %TW-WS%hba-reg_symmpi.txt 2>&1
							REM reg export HKLM\SYSTEM\CurrentControlSet\Services\symmpi\Parameters\Device %TW-WS%hba-backup_symmpi.reg
							REM LSI_SCSI.sys is for Parallel SCSI - StorPort
							reg query HKLM\SYSTEM\CurrentControlSet\Services\lsi_scsi /S > %TW-WS%hba-reg_lsi_scsi.txt 2>&1
							REM reg export HKLM\SYSTEM\CurrentControlSet\Services\lsi_scsi\Parameters\Device %TW-WS%hba-backup_lsi_scsi.reg
							REM LSI_FC.sys is for Fibre Channel - StorPort
							reg query HKLM\SYSTEM\CurrentControlSet\Services\lsi_fc /S > %TW-WS%hba-reg_lsi_fc.txt 2>&1
							REM reg export HKLM\SYSTEM\CurrentControlSet\Services\lsi_fc\Parameters\Device %TW-WS%hba-backup_lsi_fc.reg
							REM LSI_SAS.sys is for 3Gb SAS - StorPort
							reg query HKLM\SYSTEM\CurrentControlSet\Services\lsi_sas /S > %TW-WS%hba-reg_lsi_sas.txt 2>&1
							REM reg export HKLM\SYSTEM\CurrentControlSet\Services\lsi_sas\Parameters\Device %TW-WS%hba-backup_lsi_sas.reg
							REM LSI_GEN2.sys is for 6Gb SAS - MiniPort uses Windows ScsiPort - 32bit XP Only
							reg query HKLM\SYSTEM\CurrentControlSet\Services\lsi_gen2 /S > %TW-WS%hba-reg_lsi_gen2.txt 2>&1
							REM reg export HKLM\SYSTEM\CurrentControlSet\Services\lsi_gen2\Parameters\Device %TW-WS%hba-backup_lsi_gen2.reg
							REM LSI_SAS2.sys is for 6Gb SAS - MiniPort uses Windows StorPort 
							reg query HKLM\SYSTEM\CurrentControlSet\Services\lsi_sas2 /S > %TW-WS%hba-reg_lsi_sas2.txt 2>&1
							REM reg export HKLM\SYSTEM\CurrentControlSet\Services\lsi_sas2\Parameters\Device %TW-WS%hba-backup_lsi_sas2.reg
							REM LSI_SAS3.sys is for 12Gb SAS - MiniPort uses Windows StorPort 
							reg query HKLM\SYSTEM\CurrentControlSet\Services\lsi_sas3 /S > %TW-WS%hba-reg_lsi_sas3.txt 2>&1
							REM reg export HKLM\SYSTEM\CurrentControlSet\Services\lsi_sas3\Parameters\Device %TW-WS%hba-backup_lsi_sas3.reg
							reg query HKLM\SYSTEM\CurrentControlSet\Services\ItSas35 /S > %TW-WS%hba-reg_ItSas35.txt 2>&1
							dir %TW-WS%hba-reg_* /b > %TW-WS%initial_hba_reg-keys.txt
							FOR /f "tokens=1,2 delims=-" %%i IN (%TW-WS%initial_hba_reg-keys.txt) DO	(
																	IF EXIST %TW-WS%%%i-%%j %grep% "unable to find the specified registry key" %TW-WS%%%i-%%j >> misc_output.txt 2>&1
																	IF ERRORLEVEL 1	(
																			IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
																			IF NOT EXIST %TW-FN%\LSI_Products\HBA mkdir %TW-FN%\LSI_Products\HBA
																			move /Y %TW-WS%%%i-%%j %TW-FN%\LSI_Products\HBA\%%j >> misc_output.txt 2>&1
																			)
																	)
							)
			REM Backup of registry entries for Ring Buffer Registry Modification
			REM Issues getting WIndows Ring Buffers MRR 2/27/16
			REM If enabled add to the SKIP List for command line switches, also valid key test like above.
			IF [WILL]==[SKIP]	(
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_symmpi.reg @ECHO symmpi > %TW-WS%HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_lsi_scsi.reg @ECHO lsi_scsi >> %TW-WS%HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_lsi_fc.reg @ECHO lsi_fc >> %TW-WS%HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_lsi_sas.reg @ECHO lsi_sas >> %TW-WS%HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_lsi_gen2.reg @ECHO lsi_gen2 >> %TW-WS%HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_lsi_sas2.reg @ECHO lsi_sas2 >> %TW-WS%HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_lsi_sas3.reg @ECHO lsi_sas3 >> %TW-WS%HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_ItSas35.reg @ECHO ItSas35 >> %TW-WS%HBA_Drivers.txt
						
						REM ###########################################################################################################################
						REM # Determining if HBA Reg entries have been changed for LSITool RingBuffer compatability. If not, saving as originals
						REM # for restoration.
						REM ###########################################################################################################################
						
						IF EXIST %TW-WS%HBA_Drivers.txt	(
										FOR /F "usebackq" %%i IN (%TW-WS%HBA_Drivers.txt) DO	(
																	%grep% -e "The system was unable to find the specified registry key." %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_%%i.reg
																	IF ERRORLEVEL 1	(
																			%grep% -e "EnaDiag=1;SSBuffSize=1048576;TBuffSize=1048576;EXBuffSize=1048576;SSImmed=0;TImmed=0;EXImmed=0;EXType=1;DiagDWord1=0;" %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_%%i.reg
																			IF NOT %ERRORLEVEL%==0 copy %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\backup_%%i.reg %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\Pre_Ring_Buffer_backup_%%i.reg >> misc_output.txt 2>&1
																			)
																	)
										)
						
						
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\Pre_Ring_Buffer_backup_symmpi.reg @ECHO symmpi > %TW-WS%Pre_Ring_Buffer_backup_HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\Pre_Ring_Buffer_backup_lsi_scsi.reg @ECHO lsi_scsi >> %TW-WS%Pre_Ring_Buffer_backup_HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\Pre_Ring_Buffer_backup_lsi_fc.reg @ECHO lsi_fc >> %TW-WS%Pre_Ring_Buffer_backup_HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\Pre_Ring_Buffer_backup_lsi_sas.reg @ECHO lsi_sas >> %TW-WS%Pre_Ring_Buffer_backup_HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\Pre_Ring_Buffer_backup_lsi_gen2.reg @ECHO lsi_gen2 >> %TW-WS%Pre_Ring_Buffer_backup_HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\Pre_Ring_Buffer_backup_lsi_sas2.reg @ECHO lsi_sas2 >> %TW-WS%Pre_Ring_Buffer_backup_HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\Pre_Ring_Buffer_backup_lsi_sas3.reg @ECHO lsi_sas3 >> %TW-WS%Pre_Ring_Buffer_backup_HBA_Drivers.txt
						IF EXIST %TW-FN%\LSI_Products\HBA\Param_Dev_Reg_Keys\Pre_Ring_Buffer_backup_ItSas35.reg @ECHO ItSas35 >> %TW-WS%Pre_Ring_Buffer_backup_HBA_Drivers.txt
						)
			)
			
									

IF NOT [%TWGETSKIP3WARE%]==[YES]	(
					REM ###########################################################################################################################
					REM # Grab 3dm2_3ware logs from all of their possible locations & get 3DM2 Version (32 bit)
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"program files"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\tdm_aen_*.txt copy %systemroot%\..\"program files"\3ware\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\3ware\*.log copy %systemroot%\..\"program files"\3ware\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\3ware\3dm2\tdm_aen_*.txt copy %systemroot%\..\"program files"\3ware\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\3ware\3dm2\*.log copy %systemroot%\..\"program files"\3ware\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1					

					REM ###########################################################################################################################
					REM # Grab 3dm2_3ware logs from all of their possible locations & get 3DM2 Version (64 bit)
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt copy %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\*.log copy %systemroot%\..\"Program Files (x86)"\3ware\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm2\tdm_aen_*.txt copy %systemroot%\..\"Program Files (x86)"\3ware\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm2\*.log copy %systemroot%\..\"Program Files (x86)"\3ware\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware >> misc_output.txt 2>&1	
					
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt copy %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"programdata"\3ware\*.log copy %systemroot%\..\"programdata"\3ware\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm2\tdm_aen_*.txt copy %systemroot%\..\"programdata"\3ware\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm2\*.log copy %systemroot%\..\"programdata"\3ware\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd >> misc_output.txt 2>&1	

					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\tdm_aen_*.txt copy %ALLUSERSPROFILE%\"Application Data"\3ware\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad >> misc_output.txt 2>&1
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\*.log copy %ALLUSERSPROFILE%\"Application Data"\3ware\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad >> misc_output.txt 2>&1
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\tdm_aen_*.txt copy %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad >> misc_output.txt 2>&1
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\*.log copy %ALLUSERSPROFILE%\"Application Data"\3ware\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad >> misc_output.txt 2>&1						

					IF EXIST %USERPROFILE%\tw_mgmt.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %USERPROFILE%\tw_mgmt.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %USERPROFILE%\tw_mgmt.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_3ware_up mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_up >> misc_output.txt 2>&1)
					IF EXIST %USERPROFILE%\tw_mgmt.log copy %USERPROFILE%\tw_mgmt.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware_up\prior_to_3dm2_install_tw_mgmt.log >> misc_output.txt 2>&1

					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware3dm2_3ware_au mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_au >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware3dm2_3ware_au mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_au >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware3dm2_3ware_au mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_au >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware3dm2_3ware_au mkdir %TW-FN%\LSI_Products\3Ware\3dm2_3ware_au >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\tdm_aen_*.txt copy %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware_au >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\*.log copy %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware_au >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\tdm_aen_*.txt copy %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_3ware_au >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\*.log copy %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\3ware\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_3ware_au >> misc_output.txt 2>&1
				
					REM ###########################################################################################################################
					REM # Grab 3dm2_amcc logs from all of their possible locations & get 3DM2 Version (32 bit)
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"program files"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\amcc\tdm_aen_*.txt copy %systemroot%\..\"program files"\amcc\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\amcc\*.log copy %systemroot%\..\"program files"\amcc\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\amcc\3dm2\tdm_aen_*.txt copy %systemroot%\..\"program files"\amcc\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\amcc\3dm2\*.log copy %systemroot%\..\"program files"\amcc\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1

					REM ###########################################################################################################################
					REM # Grab 3dm2_amcc logs from all of their possible locations & get 3DM2 Version (64 bit)
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\tdm_aen_*.txt copy %systemroot%\..\"Program Files (x86)"\amcc\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\*.log copy %systemroot%\..\"Program Files (x86)"\amcc\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\3dm2\tdm_aen_*.txt copy %systemroot%\..\"Program Files (x86)"\amcc\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\amcc\3dm2\*.log copy %systemroot%\..\"Program Files (x86)"\amcc\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc >> misc_output.txt 2>&1
				
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"programdata"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\amcc\tdm_aen_*.txt copy %systemroot%\..\"programdata"\amcc\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"programdata"\amcc\*.log copy %systemroot%\..\"programdata"\amcc\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"programdata"\amcc\3dm2\tdm_aen_*.txt copy %systemroot%\..\"programdata"\amcc\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"programdata"\amcc\3dm2\*.log copy %systemroot%\..\"programdata"\amcc\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd >> misc_output.txt 2>&1

					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad >> misc_output.txt 2>&1)
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\tdm_aen_*.txt copy %ALLUSERSPROFILE%\"Application Data"\amcc\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad >> misc_output.txt 2>&1
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\*.log copy %ALLUSERSPROFILE%\"Application Data"\amcc\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad >> misc_output.txt 2>&1
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\tdm_aen_*.txt copy %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad >> misc_output.txt 2>&1
					IF EXIST %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\*.log copy %ALLUSERSPROFILE%\"Application Data"\amcc\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad >> misc_output.txt 2>&1					

					IF EXIST %USERPROFILE%\tw_mgmt.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %USERPROFILE%\tw_mgmt.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %USERPROFILE%\tw_mgmt.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_up mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_up >> misc_output.txt 2>&1)
					IF EXIST %USERPROFILE%\tw_mgmt.log copy %USERPROFILE%\tw_mgmt.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc_up\prior_to_3dm2_install_tw_mgmt.log >> misc_output.txt 2>&1

					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au mkdir %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\tdm_aen_*.txt copy %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\*.log copy %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\tdm_aen_*.txt copy %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\*.log copy %systemroot%\..\..\"Documents and Settings"\"All Users"\"Application Data"\amcc\3dm2\*.log %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au >> misc_output.txt 2>&1						
					
					REM ###########################################################################################################################
					REM # Grab 3dm_3ware logs from all of their possible locations & get 3DM Version (32 bit)
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"program files"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\3dm\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\3ware\tdm_aen_*.txt copy %systemroot%\..\"program files"\3ware\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\3ware\*.log copy %systemroot%\..\"program files"\3ware\*.log %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\3ware\3dm\tdm_aen_*.txt copy %systemroot%\..\"program files"\3ware\3dm\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\3ware\3dm\*.log copy %systemroot%\..\"program files"\3ware\3dm\*.log %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1	
					
					REM ###########################################################################################################################
					REM # Grab 3dm_3ware logs from all of their possible locations & get 3DM Version (64 bit)
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt copy %systemroot%\..\"Program Files (x86)"\3ware\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\*.log copy %systemroot%\..\"Program Files (x86)"\3ware\*.log %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm\tdm_aen_*.txt copy %systemroot%\..\"Program Files (x86)"\3ware\3dm\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\3ware\3dm\*.log copy %systemroot%\..\"Program Files (x86)"\3ware\3dm\*.log %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1	
					
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm\tdm_aen_*.txt (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm\*.log (IF NOT EXIST %TW-FN%\LSI_Products\3Ware\3dm_3ware mkdir %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt copy %systemroot%\..\"programdata"\3ware\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"programdata"\3ware\*.log copy %systemroot%\..\"programdata"\3ware\*.log %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm\tdm_aen_*.txt copy %systemroot%\..\"programdata"\3ware\3dm\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"programdata"\3ware\3dm\*.log copy %systemroot%\..\"programdata"\3ware\3dm\*.log %TW-FN%\LSI_Products\3Ware\3dm_3ware >> misc_output.txt 2>&1	


					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_3ware> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_3ware_pd>> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_3ware_ad>> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_3ware_up>> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_3ware_au>> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_amcc>> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_amcc_pd>> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_amcc_ad>> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_amcc_up>> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm2_amcc_au>> %TW-WS%3ware_clean_up.txt
					@ECHO %TW-FN%\LSI_Products\3Ware\3dm_3ware>> %TW-WS%3ware_clean_up.txt

					FOR /F "tokens=1 delims=$" %%i IN (%TW-WS%3ware_clean_up.txt) DO	(
														IF EXIST %%i\*.log copy %%i\*.log %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1
														IF EXIST %%i\tdm_aen_*.txt copy %%i\tdm_aen_*.txt %TW-FN%\LSI_Products\3Ware >> misc_output.txt 2>&1
														IF EXIST %%i move /Y %%i %TW-WS% >> misc_output.txt 2>&1	
														)
					)

REM IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
REM Usable Data??
IF NOT [YES]==[YES]			(
					REM ###########################################################################################################################
					REM # Grab MegaRAID MSM Logs and CIM/SNMP files (32bit)
					REM ###########################################################################################################################
					
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\*.properties (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\cimlog.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\Framework\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\*.properties (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\cimlog.txt (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\Framework\*.log (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\*.properties (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\MSM mkdir %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\cimlog.txt (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\MSM mkdir %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\Framework\*.log (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\MSM mkdir %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\*.properties copy %systemroot%\..\"program files"\"MegaRAID Storage Manager"\*.properties %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\cimlog.txt copy %systemroot%\..\"program files"\"MegaRAID Storage Manager"\cimlog.txt %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"program files"\"MegaRAID Storage Manager"\Framework\*.log copy %systemroot%\..\"program files"\"MegaRAID Storage Manager"\Framework\*.log %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1
				
					IF EXIST %systemroot%\..\"program files"\"LSI Corporation"\"CIM Provider"\SAS\*.mof (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"LSI Corporation"\"CIM Provider"\SAS\*.mof (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"LSI Corporation"\"CIM Provider"\SAS\*.mof (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\CIM mkdir %TW-FN%\LSI_Products\MegaRAID\CIM >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"LSI Corporation"\"CIM Provider"\SAS\*.mof copy %systemroot%\..\"program files"\"LSI Corporation"\"CIM Provider"\SAS\*.mof %TW-FN%\LSI_Products\MegaRAID\CIM >> misc_output.txt 2>&1

					IF EXIST %systemroot%\..\"program files"\"LSI Corporation"\SNMPAgent\SAS\*.mib (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"LSI Corporation"\SNMPAgent\SAS\*.mib (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"LSI Corporation"\SNMPAgent\SAS\*.mib (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\SNMP mkdir %TW-FN%\LSI_Products\MegaRAID\SNMP >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"program files"\"LSI Corporation"\SNMPAgent\SAS\*.mib copy %systemroot%\..\"program files"\"LSI Corporation"\SNMPAgent\SAS\*.mib %TW-FN%\LSI_Products\MegaRAID\SNMP >> misc_output.txt 2>&1
					
					
					REM ###########################################################################################################################
					REM # Grab MegaRAID MSM Logs and CIM/SNMP files (64bit)
					REM ###########################################################################################################################

					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\*.properties (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\cimlog.txt (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\Framework\*.log (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\*.properties (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\cimlog.txt (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\Framework\*.log (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\*.properties (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\MSM mkdir %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\cimlog.txt (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\MSM mkdir %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\Framework\*.log (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\MSM mkdir %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\*.properties copy %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\*.properties %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\cimlog.txt copy %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\cimlog.txt %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1
					IF EXIST %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\Framework\*.log copy %systemroot%\..\"Program Files (x86)"\"MegaRAID Storage Manager"\Framework\*.log %TW-FN%\LSI_Products\MegaRAID\MSM >> misc_output.txt 2>&1
				
					IF EXIST %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\"CIM Provider"\SAS\*.mof (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\"CIM Provider"\SAS\*.mof (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\"CIM Provider"\SAS\*.mof (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\CIM mkdir %TW-FN%\LSI_Products\MegaRAID\CIM >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\"CIM Provider"\SAS\*.mof copy %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\"CIM Provider"\SAS\*.mof %TW-FN%\LSI_Products\MegaRAID\CIM >> misc_output.txt 2>&1

					IF EXIST %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\SNMPAgent\SAS\*.mib (IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\SNMPAgent\SAS\*.mib (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID mkdir %TW-FN%\LSI_Products\MegaRAID >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\SNMPAgent\SAS\*.mib (IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\SNMP mkdir %TW-FN%\LSI_Products\MegaRAID\SNMP >> misc_output.txt 2>&1)
					IF EXIST %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\SNMPAgent\SAS\*.mib copy %systemroot%\..\"Program Files (x86)"\"LSI Corporation"\SNMPAgent\SAS\*.mib %TW-FN%\LSI_Products\MegaRAID\SNMP >> misc_output.txt 2>&1
					)


REM ###########################################################################################################################
REM # Copying 3ware and MegaRAID drivers
REM ###########################################################################################################################
REM @ECHO Copying the 3Ware/MegaRAID/HBA Driver(s) if installed...
REM IF EXIST %systemroot%\system32\drivers\3ware10k.sys copy %systemroot%\system32\drivers\3ware10k.sys %TW-FN%\LSI_Products\3Ware\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\3wareDrv.sys copy %systemroot%\system32\drivers\3wareDrv.sys %TW-FN%\LSI_Products\3Ware\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\3wdrv100.sys copy %systemroot%\system32\drivers\3wdrv100.sys %TW-FN%\LSI_Products\3Ware\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\3wflt100.sys copy %systemroot%\system32\drivers\3wflt100.sys %TW-FN%\LSI_Products\3Ware\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\megasas.sys copy %systemroot%\system32\drivers\megasas.sys %TW-FN%\LSI_Products\MegaRAID\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\megasas2.sys copy %systemroot%\system32\drivers\megasas2.sys %TW-FN%\LSI_Products\MegaRAID\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\msas2k3.sys copy %systemroot%\system32\drivers\msas2k3.sys %TW-FN%\LSI_Products\MegaRAID\ >> misc_output.txt 2>&1

REM IF EXIST %systemroot%\system32\drivers\symmpi.sys copy %systemroot%\system32\drivers\symmpi.sys %TW-FN%\LSI_Products\HBA\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\lsi_sas.sys copy %systemroot%\system32\drivers\lsi_sas.sys %TW-FN%\LSI_Products\HBA\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\lsi_sas2.sys copy %systemroot%\system32\drivers\lsi_sas2.sys %TW-FN%\LSI_Products\HBA\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\lsi_gen2.sys copy %systemroot%\system32\drivers\lsi_gen2.sys %TW-FN%\LSI_Products\HBA\ >> misc_output.txt 2>&1
REM IF EXIST %systemroot%\system32\drivers\lsi_sas3.sys copy %systemroot%\system32\drivers\lsi_sas3.sys %TW-FN%\LSI_Products\HBA\ >> misc_output.txt 2>&1

REM ###########################################################################################################################
REM # lspci
REM ###########################################################################################################################

@ECHO Collecting lspci data...

mkdir %TW-FN%\lspci
%lspci% > %TW-FN%\lspci\lspci.txt 2>> misc_output.txt 
%lspci% -t > %TW-FN%\lspci\lspci-t.txt 2>> misc_output.txt 
%lspci% -v > %TW-FN%\lspci\lspci-v.txt 2>> misc_output.txt 
%lspci% -vv > %TW-FN%\lspci\lspci-vv.txt 2>> misc_output.txt 
%lspci% -vvv > %TW-FN%\lspci\lspci-vvv.txt 2>> misc_output.txt 
%lspci% -x > %TW-FN%\lspci\lspci-x.txt 2>> misc_output.txt 
%lspci% -xxx > %TW-FN%\lspci\lspci-xxx.txt 2>> misc_output.txt 
%lspci% -xxxx > %TW-FN%\lspci\lspci-xxxx.txt 2>> misc_output.txt 
%lspci% -vvvxxxx > %TW-FN%\lspci\lspci-vvvxxxx.txt 2>> misc_output.txt 
%lspci% -D > %TW-FN%\lspci\lspci-D.txt 2>> misc_output.txt 
%lspci% -n > %TW-FN%\lspci\lspci-n.txt 2>> misc_output.txt 
%lspci% -nn > %TW-FN%\lspci\lspci-nn.txt 2>> misc_output.txt 
%lspci% -M > %TW-FN%\lspci\lspci-M.txt 2>> misc_output.txt 


REM ###########################################################################################################################
REM # MSINFO32
REM ###########################################################################################################################

IF [%TWGETSKIPWINDOWSREPORTING%]==[YES] GOTO SKIP_WINDOWS_REPORTING
IF [%NOWOW64%]==[YES] GOTO SKIP_WINDOWS_REPORTING

@ECHO .
%TW-WS%timers\timer100\timer100 /q /nologo
@ECHO Collecting MSINFO32 data...
@ECHO Collecting MSINFO32 data... > %TW-WS%Start_MSINFO32.txt
xdir /Form=*t %TW-WS%Start_MSINFO32.txt >> misc_output.txt 2>&1

msinfo32 /report %TW-FN%\msinfo32_report.txt 2>> misc_output.txt 

REM Depricated WINMSD support
REM If ERRORLEVEL 1 WINMSD /report %TW-FN%\winmsd_report.txt 2>> misc_output.txt 


REM   .......................................||.......................................
REM @ECHO .
REM @ECHO Will wait up to 10 additional minutes in 15
REM @ECHO second increments for MSINFO32 output file
REM @ECHO to be CREATED!
REM @ECHO .

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO One minute...

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO Two minutes...

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO Three minutes...

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO Four minutes...

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO Five minutes......

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO Six minutes...

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO Seven minutes...

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO Eight minutes...

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO Nine minutes...

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

If EXIST %TW-FN%\msinfo32_report.txt (GOTO Proceed) ELSE %sleep% 15 

@ECHO Ten minutes......

If EXIST %TW-FN%\msinfo32_report.txt	GOTO Proceed 

@ECHO MSINFO32 Report file NOT CREATED in the alloted time!
@ECHO MSINFO32 Report file NOT CREATED in the alloted time! >> misc_output.txt 2>&1

GOTO MSINFO32_FILE_CREATE_FAILED

:Proceed

REM @ECHO .
REM @ECHO Will wait up to 5 additional minutes in 15
REM @ECHO second increments for MSINFO32 output file
REM @ECHO to be CLOSED!
REM @ECHO .
REM @ECHO File Created...
@ECHO File Created... >> misc_output.txt 2>&1

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

@ECHO One minute......

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

@ECHO Two minute......

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

@ECHO Three minute......

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

@ECHO Four minute......

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE %sleep% 15

@ECHO Five minute......

dir %TW-FN% | find " 0 msinfo32_report.txt" >> misc_output.txt 2>&1

IF %ERRORLEVEL%==1 (GOTO Proceed1) ELSE @ECHO MSINFO32 Report file NOT CLOSED in the alloted time!

REM   .......................................||.......................................
@ECHO .
@ECHO Due to having an open file you will see some errors
@ECHO during file compression. One posibilty for this is
@ECHO MSINFO32 trying to access Outlook files. Click "NO"
@ECHO to OUTLOOKS query about file access if this occurs
@ECHO during the 5 minute retry period and the process
@ECHO will proceed.
@ECHO .
@ECHO .
@ECHO .

@ECHO MSINFO32 Report file NOT CLOSED in the alloted time! >> misc_output.txt 2>&1




:Proceed1
REM @ECHO File Closed...
@ECHO File Closed... >> misc_output.txt 2>&1

:MSINFO32_FILE_CREATE_FAILED


REM @ECHO End of MSINFO32 Data Collection...
@ECHO End of MSINFO32 Data Collection... >> misc_output.txt 2>&1
@ECHO End of MSINFO32 Data Collection... > %TW-WS%End_MSINFO32.txt
xdir /Form=*t %TW-WS%End_MSINFO32.txt >> misc_output.txt 2>&1
%TW-WS%timers\timer100\timer100 /s /nologo


:SKIP_WINDOWS_REPORTING


IF NOT ["%TWGETSKIPCDA%"]==["YES"]	(
					REM ###########################################################################################################################
					REM Controller Disk Association
					REM ###########################################################################################################################

					IF NOT EXIST %TW-WS%cda mkdir %TW-WS%cda
					IF NOT EXIST %TW-FN%\Controller_Disk_Association MKDIR %TW-FN%\Controller_Disk_Association >> misc_output.txt 2>&1										

					@ECHO .
					IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /q /nologo)
					@ECHO Compiling Controller/Disk Associations to the Windows PhysicalDisk PD #'s...
					IF [%NOWOW64%]==[YES] (@ECHO %time%)
					@ECHO Compiling Controller/Disk Associations to the Windows PhysicalDisk PD #'s... >> misc_output.txt 2>&1
					@ECHO Compiling Controller/Disk Associations to the Windows PhysicalDisk PD #'s... > %TW-WS%cda\Start_Compile_Disk_associations.txt
					IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%cda\Start_Compile_Disk_associations.txt >> misc_output.txt 2>&1)

				
					REM ###########################################################################################################################
					REM DiskPart - detail disk
					
					@ECHO list disk > %TW-WS%cda\listdisk.txt
					
					diskpart /s %TW-WS%cda\listdisk.txt > %TW-WS%cda\list_disk.txt
					%grep% -A 10000 -e "--------" %TW-WS%cda\list_disk.txt | %grep% Disk > %TW-WS%cda\diskpart_pds.txt
					FOR /F "tokens=2 delims= " %%i in (%TW-WS%cda\diskpart_pds.txt) DO	(
													@ECHO select disk %%i > %TW-WS%cda\detaildisk_%%i.txt
													@ECHO detail disk >> %TW-WS%cda\detaildisk_%%i.txt
													@ECHO exit >> %TW-WS%cda\detaildisk_%%i.txt
													)
					FOR /F "tokens=2 delims= " %%i in (%TW-WS%cda\diskpart_pds.txt) DO	(
													dir /b  %TW-WS%cda\detaildisk_%%i.txt >> %TW-WS%cda\diskpart_scripts.txt
													)
					FOR /F "tokens=1,2,3 delims=_." %%i in (%TW-WS%cda\diskpart_scripts.txt) DO	(
														REM   ......................................::.......................................
														@ECHO ...........................diskpart detail disk PD%%j............................ > %TW-WS%cda\dp-detail_disk_%%j.txt
														diskpart /s %TW-WS%cda\%%i_%%j.%%k >> %TW-WS%cda\dp-detail_disk_%%j.txt 2>&1
														)
					FOR /F "tokens=2 delims= " %%i in (%TW-WS%cda\diskpart_pds.txt) DO	(
													dir /b  %TW-WS%cda\dp-detail_disk_%%i.txt >> %TW-WS%cda\dp-detail_disk_all.txt
													)
					REM ###########################################################################################################################
					REM DiskPart - Location Path
					
					FOR /F "tokens=1,2,3,4 delims=_." %%i in (%TW-WS%cda\dp-detail_disk_all.txt) DO	(
															%grep% "Location Path :" %TW-WS%cda\%%i_%%j_%%k.%%l >> %TW-WS%cda\location-path_%%k.txt
															)
					REM ###########################################################################################################################
					REM sg_vpd - Page 0x83
											
					
					%sg_scan% -b -s -v > %TW-WS%cda\sg_scan-b-s-v.txt
					%sg_scan% -b -v > %TW-WS%cda\sg_scan-b-v.txt
					%sg_scan% -s -v | %gawk% $1~/SCSI/ > %TW-WS%cda\sg_scan-s-v.txt
					%sg_scan% | %gawk% "{print $1, $NF}" | %gawk% $1~/PD/ > %TW-WS%cda\pd_unid.txt
					FOR /F "tokens=2 delims= " %%i in (%TW-WS%cda\diskpart_pds.txt) DO	(
													REM   ......................................::.......................................
													@ECHO ..............................sg_vpd -p 0x83 PD%%i............................... > %TW-WS%cda\sg_vpd-0x83_%%i.txt
													%sg_vpd% -p 0x83 PD%%i >> %TW-WS%cda\sg_vpd-0x83_%%i.txt 2>&1
													dir /b %TW-WS%cda\sg_vpd-0x83_%%i.txt >> %TW-WS%cda\sg_vpd-0x83_all.txt 2>>misc_output.txt	
													) 
					
					
					REM ###########################################################################################################################
					REM storcli /cx/vx with NAA ID
					
					REM %TW-WS%cda\diskpart_pds.txt 	= diskpart PD #'s second token
					REM %TW-WS%cda\sg_scan-b-v.txt		= List of all PDs with additional info, i.e. PD19            <RAID >  LSI       MR9381-4i4e       4.23  004ba3d55b92dd5d1e50efa709b00506
					REM %TW-WS%cda\location-path_%%k.txt	= Location path in PD # designated 
					REM %TW-WS%cda\cv_pd_%%p.txt 		= MR /cx/vx # in PD # designated file
					REM %TW-WS%cda\cu_pd_%%p.txt		= 3Ware /cx/ux # in PD # designated file
					
					IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
										IF NOT ["%NO_MR_Adps%"]==["YES"]	(
															%MR_Cli% /call/vall show all | %grep% -e "/c" -e "SCSI NAA Id =" > %TW-WS%cda\call_vall_cv_naa.txt
															IF NOT ERRORLEVEL 1	(	
																		%MR_Cli% /call/vall show all | %grep% -e "/c"  > %TW-WS%cda\call_vall_cv.txt
																			
																		FOR /F "tokens=1,2 delims=/:" %%i in (%TW-WS%cda\call_vall_cv.txt) DO	(
																											%grep% -A 1 "/%%i/%%j" %TW-WS%cda\call_vall_cv_naa.txt >> "%TW-WS%cda\cv_naa_%%i_%%j.txt"
																											)
																		FOR /F "tokens=1,2 delims=/:" %%i in (%TW-WS%cda\call_vall_cv.txt) DO	(
																											%grep% "SCSI NAA Id =" "%TW-WS%cda\cv_naa_%%i_%%j.txt" >> "%TW-WS%cda\naa_%%i_%%j.txt"
																											@ECHO naa_%%i_%%j.txt >> %TW-WS%cda\naa_all.txt
																											)
																		IF EXIST %TW-WS%cda\naa_all.txt	(FOR /F "tokens=1,2" %%i in (%TW-WS%cda\naa_all.txt) DO	(move /Y "%TW-WS%cda\%%i %%j" "%TW-WS%cda\%%i%%j" >> misc_output.txt 2>&1))
													
																	
																			
																		FOR /F "tokens=1,2 delims=/: " %%i in (%TW-WS%cda\call_vall_cv.txt) DO	(
																											FOR /F "tokens=4 delims== " %%k in (%TW-WS%cda\naa_%%i_%%j.txt) DO	(
																																			FOR /F "tokens=2 delims= " %%l in (%TW-WS%cda\diskpart_pds.txt) DO	(
																																											%grep% %%k %TW-WS%cda\sg_vpd-0x83_%%l.txt >> misc_output.txt 2>&1
																																											IF NOT ERRORLEVEL 1	( 
																																														@ECHO /%%i/%%j >> %TW-WS%cda\cv_pd_%%l.txt
																																														REM   ......................................::.......................................
																																														@ECHO ..........................storcli /%%i/%%j show all............................ > %TW-WS%cda\cvsa_pd_%%l.txt
																																														%MR_Cli% /%%i/%%j show all >> %TW-WS%cda\cvsa_pd_%%l.txt
																																														)
																																											)
																																				)
																											)
																		)
															)
										)
													
					IF EXIST %TW-WS%cda\call_vall_cv.txt	(
										dir %TW-WS%cda\call_vall_cv.txt | %grep% " 0 call_vall_cv.txt" >> misc_output.txt 2>&1
										IF NOT ERRORLEVEL 1 move /Y %TW-WS%cda\call_vall_cv.txt %TW-WS%cda\0Byte_call_vall_cv.txt >> misc_output.txt 2>&1	
										)
		
										

					
					IF NOT [%TWGETSKIP3WARE%]==[YES]	(
										IF NOT ["%NO_3WARE_VDs%"]==["YES"]	(
															FOR /F "tokens=1,2,3,4,5 delims=_." %%i in (%TW-WS%cda\3ware_sn_cX_uX.txt) DO	(
																									FOR /F "tokens=1,2,3,4 delims== " %%n in (%TW-WS%cda\3ware_sn_%%k_%%l.txt) DO	(
																																			FOR /F "tokens=2 delims= " %%r in (%TW-WS%cda\diskpart_pds.txt) DO	(
																																											%grep% %%q %TW-WS%cda\sg_vpd-0x83_%%r.txt >> misc_output.txt 2>&1	
																																											IF NOT ERRORLEVEL 1 	( 
																																														@ECHO /%%k/%%l >> %TW-WS%cda\cu_pd_%%r.txt
																																														REM   ......................................::.......................................
																																														@ECHO ............................tw_cli /%%k/%%l show all............................. > %TW-WS%cda\cusa_pd_%%r.txt
																																														tw_cli /%%k/%%l show all >> %TW-WS%cda\cusa_pd_%%r.txt
																																														)
																																											)
																																			)
																									)
															)
										)

					IF EXIST %TW-FN%\System_Reg_Keys\reg_hw_devicemap_scsi.txt	(
													%grep% "Logical Unit Id" %TW-FN%\System_Reg_Keys\reg_hw_devicemap_scsi.txt > %TW-WS%cda\reg_scsi_lun_id.txt 
													FOR /F "tokens=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 delims=\ " %%i in (%TW-WS%cda\reg_scsi_lun_id.txt) DO (%grep% -F -A 5 "%%i\%%j\%%k\%%l\%%m %%n %%o\%%p %%q %%r\%%s %%t %%u\%%v %%w %%x %%y" %TW-FN%\System_Reg_Keys\reg_hw_devicemap_scsi.txt | %grep% -e "Logical Unit Id" -e "InquiryData" -e "SerialNumber" -e "Identifier" -e "DeviceType" -e "DeviceIdentifierPage" > %TW-WS%cda\reg-scsi-lun-id_%%o_%%r_%%u_%%y.txt)
													dir /b %TW-WS%cda\reg-scsi-lun-id_* > %TW-WS%cda\reg-scsi-lun-id-all.txt
													FOR /F "tokens=2 delims= " %%i in (%TW-WS%cda\diskpart_pds.txt) DO	(
																						%grep% "PD%%i " %TW-WS%cda\pd_unid.txt > %TW-WS%cda\pd_unid_%%i.txt
																						)
													FOR /F "tokens=2 delims= " %%i in (%TW-WS%cda\diskpart_pds.txt) DO	(
																						FOR /F "tokens=2 delims= " %%j in (%TW-WS%cda\pd_unid_%%i.txt) DO	(
																															FOR /F "tokens=1,2,3,4,5,6 delims=_." %%k in (%TW-WS%cda\reg-scsi-lun-id-all.txt) DO	(
																																										%grep% %%j %TW-WS%cda\%%k_%%l_%%m_%%n_%%o.%%p  >> misc_output.txt 2>&1
																																										IF NOT ERRORLEVEL 1	(
																																													copy %TW-WS%cda\%%k_%%l_%%m_%%n_%%o.%%p %TW-WS%cda\%%k-PD_%%i.txt >> misc_output.txt 2>&1
																																													%grep% "Logical Unit Id" %TW-WS%cda\%%k-PD_%%i.txt > %TW-WS%cda\presum-%%k-PD_%%i.txt 
																																													)												
																																										)
																															)
																						)
													FOR /F "tokens=2 delims= " %%i in (%TW-WS%cda\diskpart_pds.txt) DO	(IF EXIST %TW-WS%cda\presum-reg-scsi-lun-id-PD_%%i.txt @ECHO %%i >> %TW-WS%cda\reg-scsi-lun-id-pds.txt)
													IF EXIST %TW-WS%cda\reg-scsi-lun-id-pds.txt	( 
																			FOR /F "tokens=1" %%i in (%TW-WS%cda\reg-scsi-lun-id-pds.txt) DO	(
																												FOR /F "tokens=5,6,7,8 delims=\" %%j in (%TW-WS%cda\presum-reg-scsi-lun-id-PD_%%i.txt) DO (@ECHO \%%j\%%k\%%l\%%m > %TW-WS%cda\sum-reg-scsi-lun-id-PD_%%i.txt)
																												)
																			)
													)
					
																		
					FOR /F "tokens=2 delims= " %%i in (%TW-WS%cda\diskpart_pds.txt) DO	(
														REM   ......................................::.......................................
														@ECHO ............................................................................... >> %TW-FN%\Controller_Disk_Association\CDA_Summary.txt
														%grep% "PD%%i   " %TW-WS%cda\sg_scan-b-v.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary.txt
														IF EXIST %TW-WS%cda\location-path_%%i.txt type %TW-WS%cda\location-path_%%i.txt	>> %TW-FN%\Controller_Disk_Association\CDA_Summary.txt
														IF EXIST %TW-WS%cda\location-path_%%i.txt type %TW-WS%cda\location-path_%%i.txt	>> %TW-WS%cda\location-path_all.txt
														IF EXIST %TW-WS%cda\sum-reg-scsi-lun-id-PD_%%i.txt type %TW-WS%cda\sum-reg-scsi-lun-id-PD_%%i.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary.txt
														IF EXIST %TW-WS%cda\cv_pd_%%i.txt	(
																			type %TW-WS%cda\cv_pd_%%i.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary.txt
																			@ECHO %%i >> %TW-WS%cda\mr_pds.txt
																			)
														IF EXIST %TW-WS%cda\cu_pd_%%i.txt	(
																			type %TW-WS%cda\cu_pd_%%i.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary.txt
																			@ECHO %%i >> %TW-WS%cda\3w_pds.txt
																			)												
														)
					FOR /F "tokens=2 delims= " %%i in (%TW-WS%cda\diskpart_pds.txt) DO	(
														%grep% "PD%%i   " %TW-WS%cda\sg_scan-b-v.txt >> %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt
														IF EXIST %TW-WS%cda\dp-detail_disk_%%i.txt type %TW-WS%cda\dp-detail_disk_%%i.txt >> %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt
														IF EXIST %TW-WS%cda\sg_vpd-0x83_%%i.txt type %TW-WS%cda\sg_vpd-0x83_%%i.txt >> %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt
														IF EXIST %TW-WS%cda\reg-scsi-lun-id-PD_%%i.txt	( 
																				REM   ......................................::.......................................
																				@ECHO .................................Registry Key.................................. >> %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt
																				type %TW-WS%cda\reg-scsi-lun-id-PD_%%i.txt >> %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt
																				)
														IF EXIST %TW-WS%cda\cvsa_pd_%%i.txt type %TW-WS%cda\cvsa_pd_%%i.txt >> %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt 
														IF EXIST %TW-WS%cda\cusa_pd_%%i.txt type %TW-WS%cda\cusa_pd_%%i.txt >> %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt
														)
					IF NOT [%TWGETSKIPMEGARAID%]==[YES]	(
										IF EXIST %TW-WS%cda\call_vall_cv.txt	(
															FOR /F "tokens=1" %%i in (%TW-WS%cda\mr_pds.txt) DO	(
																						REM   ......................................::.......................................
																						@ECHO ............................................................................... >> %TW-FN%\Controller_Disk_Association\CDA_Summary_MegaRAID.txt
																						%grep% "PD%%i   " %TW-WS%cda\sg_scan-b-v.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary_MegaRAID.txt
																						IF EXIST %TW-WS%cda\location-path_%%i.txt type %TW-WS%cda\location-path_%%i.txt	>> %TW-FN%\Controller_Disk_Association\CDA_Summary_MegaRAID.txt
																						IF EXIST %TW-WS%cda\sum-reg-scsi-lun-id-PD_%%i.txt type %TW-WS%cda\sum-reg-scsi-lun-id-PD_%%i.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary_MegaRAID.txt
																						type %TW-WS%cda\cv_pd_%%i.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary_MegaRAID.txt
																						IF EXIST %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt move /Y %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i_MegaRAID.txt >> misc_output.txt 2>&1
																						)
															)
										)
					IF NOT [%TWGETSKIP3WARE%]==[YES]	(
										IF NOT ["%NO_3WARE_VDs%"]==["YES"]	(
															FOR /F "tokens=1" %%i in (%TW-WS%cda\3w_pds.txt) DO	(
																						REM   ......................................::.......................................
																						@ECHO ............................................................................... >> %TW-FN%\Controller_Disk_Association\CDA_Summary_3Ware.txt
																						%grep% "PD%%i   " %TW-WS%cda\sg_scan-b-v.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary_3Ware.txt
																						IF EXIST %TW-WS%cda\location-path_%%i.txt type %TW-WS%cda\location-path_%%i.txt	>> %TW-FN%\Controller_Disk_Association\CDA_Summary_3Ware.txt
																						IF EXIST %TW-WS%cda\sum-reg-scsi-lun-id-PD_%%i.txt type %TW-WS%cda\sum-reg-scsi-lun-id-PD_%%i.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary_3Ware.txt
																						type %TW-WS%cda\cu_pd_%%i.txt >> %TW-FN%\Controller_Disk_Association\CDA_Summary_3Ware.txt
																						IF EXIST %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt move /Y %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i.txt %TW-FN%\Controller_Disk_Association\Physical_Disk_%%i_3Ware.txt >> misc_output.txt 2>&1
																						)					
															)
										)
					
					IF EXIST %TW-WS%cda\sg_scan-b-s-v.txt move /Y %TW-WS%cda\sg_scan-b-s-v.txt %TW-FN%\Controller_Disk_Association\sg_scan-b-s-v.txt >> misc_output.txt 2>&1
										
					
					
					@ECHO Completed... >> misc_output.txt 2>&1
					@ECHO Completed Compiling Controller/Disk Associations to the Windows PhysicalDisk PD #'s... > %TW-WS%cda\End_Compile_Disk_associations.txt
					IF NOT [%NOWOW64%]==[YES] (xdir /Form=*t %TW-WS%cda\End_Compile_Disk_associations.txt >> misc_output.txt 2>&1)
					IF NOT [%NOWOW64%]==[YES] (%TW-WS%timers\timer100\timer100 /s /nologo)
					)

REM ###########################################################################################################################
REM # Summary File
REM ###########################################################################################################################


IF EXIST %TW-FN%\comment.txt	(
				REM   ......................................::.......................................
				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
				@ECHO .............................Comment/Config Info............................... >> %TW-FN%\Summary.txt 2>&1
				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
				type %TW-FN%\comment.txt >> %TW-FN%\Summary.txt 2>&1
				)

REM 3Ware
IF EXIST %TW-WS%ctrl_nums.txt	(
				FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
											IF EXIST %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt 	(
																			REM   ......................................::.......................................
																			@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																			@ECHO ..........................3ware Controller %%i Info.............................. >> %TW-FN%\Summary.txt 2>&1
																			@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																			type %TW-FN%\LSI_Products\3Ware\Controller_C%%i.txt >> %TW-FN%\Summary.txt 2>&1
													)						)
				)
REM MegaRAID



IF EXIST %TW-WS%mr_ctrl_nums.txt	(
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
												IF EXIST %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt 	(
																				REM   ......................................::.......................................
																				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																				@ECHO ........................MegaRAID Controller %%i Info............................. >> %TW-FN%\Summary.txt 2>&1
																				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																				type %TW-FN%\LSI_Products\MegaRAID\Controller_C%%i.txt >> %TW-FN%\Summary.txt 2>&1
																				REM   ......................................::.......................................
																				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																				@ECHO ........................MegaRAID Cx_show_all_C%%i.txt............................ >> %TW-FN%\Summary.txt 2>&1
																				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																				type %TW-FN%\LSI_Products\MegaRAID\Cx_show_all_C%%i.txt >> %TW-FN%\Summary.txt 2>&1
																				REM   ......................................::.......................................
																				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																				@ECHO .............MegaRAID Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt........... >> %TW-FN%\Summary.txt 2>&1
																				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																				type %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-Compare-All-Parms_C%%i.txt  >> %TW-FN%\Summary.txt 2>&1
																				REM   ......................................::....................................... 
																				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																				@ECHO ..................MegaRAID Cx_Eall_Sall_show_all-plus_C%%i.txt................... >> %TW-FN%\Summary.txt 2>&1
																				@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																				type %TW-FN%\LSI_Products\MegaRAID\Cx_Eall_Sall_show_all-plus_C%%i.txt >> %TW-FN%\Summary.txt 2>&1
																				)
												)
					)

IF EXIST %TW-WS%mr_ctrl_nums.txt	(
					FOR /F "usebackq" %%i IN (%TW-WS%mr_ctrl_nums.txt) DO	(
												IF EXIST %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_ID_C%%i.txt		(
																						REM   ......................................::.......................................
																						@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																						@ECHO ..MegaRAID AEN Eventlog Summary of All AENs Including Deleted Entries C%%i Info.. >> %TW-FN%\Summary.txt 2>&1
																						@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																						dir /s /n %TW-FN%\LSI_Products\MegaRAID\Event_Logs\Controller_C%%i >> %TW-FN%\Summary.txt 2>&1
																						REM   ......................................::.......................................
																						@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																						@ECHO ............MegaRAID AEN Eventlog Including Deleted Entries C%%i Info............ >> %TW-FN%\Summary.txt 2>&1
																						@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																						type %TW-FN%\LSI_Products\MegaRAID\Event_Logs\evtlog_ID_C%%i.txt >> %TW-FN%\Summary.txt 2>&1
																						)
												)
					)



REM HBA
IF EXIST %TW-WS%hba_numbers.txt		(
					FOR /F "usebackq" %%i IN (%TW-WS%hba_numbers.txt) DO	(
												IF EXIST %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt	(
																			REM   ......................................::.......................................
																			@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																			@ECHO ..................................HBA %%i Info................................... >> %TW-FN%\Summary.txt 2>&1
																			@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																			type %TW-FN%\LSI_Products\HBA\properties_hba%%i.txt >> %TW-FN%\Summary.txt 2>&1
																			)
												)
				)


REM Expanders
IF EXIST %TW-WS%Gen1_EXP_SAS_Address.txt	(
						FOR /F "usebackq" %%i IN (%TW-WS%Gen1_EXP_SAS_Address.txt) DO	(
														REM   ......................................::.......................................
														@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
														@ECHO ..........................Gen 1 xutil %%i......................... >> %TW-FN%\Summary.txt 2>&1
														@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1											
														IF EXIST %TW-FN%\LSI_Products\Expander\3Gb\%%i_Xtools.txt type %TW-FN%\LSI_Products\Expander\3Gb\%%i_Xtools.txt >> %TW-FN%\Summary.txt 2>&1
														)
						)

IF EXIST %TW-WS%Gen2_EXP_SAS_Address.txt	(
						FOR /F "usebackq" %%i IN (%TW-WS%Gen2_EXP_SAS_Address.txt) DO	(
														REM   ......................................::.......................................
														@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
														@ECHO ..........................Gen 2 xutil %%i......................... >> %TW-FN%\Summary.txt 2>&1
														@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1											
														IF EXIST %TW-FN%\LSI_Products\Expander\6Gb\%%i_Xtools.txt type %TW-FN%\LSI_Products\Expander\6Gb\%%i_Xtools.txt >> %TW-FN%\Summary.txt 2>&1
														)
						)

IF EXIST %TW-WS%Gen3_EXP_SAS_Address.txt	(
						FOR /F "usebackq" %%i IN (%TW-WS%Gen3_EXP_SAS_Address.txt) DO	(
														REM   ......................................::.......................................
														@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
														@ECHO ........................Gen 3 g3xutil %%i......................... >> %TW-FN%\Summary.txt 2>&1
														@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1											
														IF EXIST %TW-FN%\LSI_Products\Expander\12Gb\%%i_Xtools.txt type %TW-FN%\LSI_Products\Expander\12Gb\%%i_Xtools.txt >> %TW-FN%\Summary.txt 2>&1
														)
						)

IF EXIST %TW-FN%\Controller_Disk_Association\CDA_Summary.txt	(
								REM   ......................................::.......................................
								@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
								@ECHO ................................CDA_Summary.txt................................ >> %TW-FN%\Summary.txt 2>&1
								@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
								type %TW-FN%\Controller_Disk_Association\CDA_Summary.txt >> %TW-FN%\Summary.txt 2>&1
								)

IF EXIST %TW-FN%\msinfo32_report.txt	(
					REM   ......................................::.......................................
					@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
					@ECHO .............................msinfo32_report.txt............................... >> %TW-FN%\Summary.txt 2>&1
					@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
					type %TW-FN%\msinfo32_report.txt >> %TW-FN%\Summary.txt 2>&1
					)

IF EXIST %TW-FN%\lspci\lspci-vvv.txt	(
					REM   ......................................::.......................................
					@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
					@ECHO .............................lspci-vvvxxxx.txt................................. >> %TW-FN%\Summary.txt 2>&1
					@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
					type %TW-FN%\lspci\lspci-vvvxxxx.txt >> %TW-FN%\Summary.txt 2>&1
					)

IF EXIST %TW-FN%\System_Logs\system.log	(
					REM   ......................................::.......................................
					@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
					@ECHO ..................................system.log................................... >> %TW-FN%\Summary.txt 2>&1
					@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
					type IF EXIST %TW-FN%\System_Logs\system.log >> %TW-FN%\Summary.txt 2>&1
					)

IF EXIST %TW-FN%\System_Logs\application.log	(
						REM   ......................................::.......................................
						@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
						@ECHO ...............................application.log................................. >> %TW-FN%\Summary.txt 2>&1
						@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
						type IF EXIST %TW-FN%\System_Logs\application.log >> %TW-FN%\Summary.txt 2>&1
						)


IF [%HAVE_REG%]==[YES]	(
			REM Registry Keys
			
			REM OS
			dir /b  %TW-FN%\System_Reg_Keys > %TW-WS%os_reg-keys.txt

			FOR /f "usebackq" %%i IN (%TW-WS%os_reg-keys.txt) DO	(
										REM   ......................................::.......................................
										@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
										@ECHO ................................%%i................................ >> %TW-FN%\Summary.txt 2>&1
										@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
										type %TW-FN%\System_Reg_Keys\%%i >> %TW-FN%\Summary.txt 2>&1
										)
			
			
			REM 3Ware
			@ECHO reg_3ware10k.txt > %TW-WS%3w_reg-keys.txt
			@ECHO reg_3wareDrv.txt >> %TW-WS%3w_reg-keys.txt
			@ECHO reg_3wdrv100.txt >> %TW-WS%3w_reg-keys.txt
			@ECHO reg_3dm.txt >> %TW-WS%3w_reg-keys.txt
			@ECHO reg_3dm2.txt >> %TW-WS%3w_reg-keys.txt
			@ECHO reg_3dm2_config.txt >> %TW-WS%3w_reg-keys.txt
			
			FOR /f "usebackq" %%i IN (%TW-WS%3w_reg-keys.txt) DO	(
										IF EXIST %TW-FN%\LSI_Products\3Ware\%%i	(
															REM   ......................................::.......................................
															@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
															@ECHO ..............................%%i............................... >> %TW-FN%\Summary.txt 2>&1
															@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
															type %TW-FN%\LSI_Products\3Ware\%%i >> %TW-FN%\Summary.txt 2>&1
															)
										)
			
			
			
			REM MegaRAID
			@ECHO reg_megasas.txt > %TW-WS%mr_reg-keys.txt
			@ECHO reg_megasas2.txt >> %TW-WS%mr_reg-keys.txt
			@ECHO reg_msas2k3.txt >> %TW-WS%mr_reg-keys.txt
			
			FOR /f "usebackq" %%i IN (%TW-WS%mr_reg-keys.txt) DO	(
										IF EXIST %TW-FN%\LSI_Products\MegaRAID\%%i	(
																REM   ......................................::.......................................
																@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																@ECHO ..............................%%i............................... >> %TW-FN%\Summary.txt 2>&1
																@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
																type %TW-FN%\LSI_Products\MegaRAID\%%i >> %TW-FN%\Summary.txt 2>&1
																)
										)
										
			
			
			REM HBA
			@ECHO reg_symmpi.txt > %TW-WS%hba_reg-keys.txt
			@ECHO reg_lsi_scsi.txt >> %TW-WS%hba_reg-keys.txt
			@ECHO reg_lsi_fc.txt  >> %TW-WS%hba_reg-keys.txt
			@ECHO reg_lsi_sas.txt >> %TW-WS%hba_reg-keys.txt
			@ECHO reg_lsi_gen2.txt >> %TW-WS%hba_reg-keys.txt
			@ECHO reg_lsi_sas2.txt >> %TW-WS%hba_reg-keys.txt
			@ECHO reg_lsi_sas3.txt >> %TW-WS%hba_reg-keys.txt
			@ECHO reg_LSILogicCorp.txt >> %TW-WS%hba_reg-keys.txt
			@ECHO reg_LSICorp.txt >> %TW-WS%hba_reg-keys.txt
			
			FOR /f "usebackq" %%i IN (%TW-WS%hba_reg-keys.txt) DO	(
										IF EXIST %TW-FN%\LSI_Products\HBA\%%i	(
															REM   ......................................::.......................................
															@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
															@ECHO ..............................%%i............................... >> %TW-FN%\Summary.txt 2>&1
															@ECHO ############################################################################### >> %TW-FN%\Summary.txt 2>&1
															type %TW-FN%\LSI_Products\HBA\%%i >> %TW-FN%\Summary.txt 2>&1
															)
										)
			)
			


REM ###########################################################################################################################
REM ###########################################################################################################################
REM # Monitor Mode - Supports 8 controllers
REM ###########################################################################################################################
REM ###########################################################################################################################

IF [%TWGETSKIP3WARE%]==[YES] SET TWGETMONITORMODE=TWGETSKIP3WARE
IF NOT [%TWGETMONITORMODE%]==[MONITOR] GOTO NOT_MONITOR_MODE

REM First Run
IF NOT EXIST %TW-FN%\LSI_Products\3Ware\MONITOR GOTO FIRST_RUN
GOTO NOT_FIRST_RUN

:FIRST_RUN
IF NOT EXIST %TW-FN%\LSI_Products mkdir %TW-FN%\LSI_Products
IF NOT EXIST %TW-FN%\LSI_Products\3Ware mkdir %TW-FN%\LSI_Products\3Ware
IF NOT EXIST %TW-FN%\LSI_Products\3Ware\MONITOR mkdir %TW-FN%\LSI_Products\3Ware\MONITOR
IF NOT EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace mkdir %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace

REM Carriage Return embedded on end of line!
@ECHO ------------------------------------------------------------------------------ > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\no_alarms_check.txt

REM ###########################################################################################################################
REM # Monitor Mode - Blank added to EOL in monitor_point_C%%i.txt
REM # Getting latest AEN "monitor_point" to compare new AEN's against
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO (tw_cli /c%%i show alarms > %TW-FN%\LSI_Products\3Ware\MONITOR\script_orkspace\initial_alarms_C%%i.txt 2>&1)
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO (FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\initial_alarms_C%%i.txt) DO (@ECHO %%j > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C%%i.txt))
REM ###########################################################################################################################
REM # Monitor Mode - 
REM # Verify monitor_point_C%%i.txt is valid
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C%%i.txt) DO	(
																						FOR /F "usebackq delims=" %%l IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\no_alarms_check.txt) DO	(
																																			IF [%%k]==[%%l] ECHO "There were no alarms" > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C%%i.txt
																																			)
																						)
							)


:NOT_FIRST_RUN

REM Default 60 Second wait for checking Alarms/AENs with "show diag"
%sleep% 60
@ECHO .
@ECHO lsigetwin Monitor Mode - Command line "%0 %*" %time%
@ECHO Saves Internal Controller Log daily and on specific errors.
@ECHO .
@ECHO To terminate hit CTRL-C
@ECHO .
@ECHO If manually terminated and you still need to send the output to Support/your FAE, run;
@ECHO .
@ECHO 7z -mx=9 a %TW-FN%.7z %TW-FN% 
@ECHO .
@ECHO Send just the file %TW-FN%.7z to Support/your FAE.
@ECHO .
@ECHO .
@ECHO .
REM ###########################################################################################################################
REM # Monitor Mode - Blank added to EOL in alarms_C%%i.txt
REM # Getting latest AENs to compare "monitor_point" against, changed order to get latest AENs on top
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							tw_cli /c%%i show alarms reverse > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\initial_reverse_alarms_C%%i.txt 2>&1 
							IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C%%i.txt 
							del %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C%%i.txt >> misc_output.txt 2>&1
							FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\initial_reverse_alarms_C%%i.txt) DO	(
																							@ECHO %%j >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C%%i.txt
																							)
							)
REM ###########################################################################################################################
REM # Monitor Mode - Blank match j & k
REM # Comparing "monitor_point" and AENs, printing new AENs to new_alarms_C%%i.txt 2>&1 
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO (IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C%%i.txt del %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C%%i.txt >> misc_output.txt 2>&1)

IF EXIST %TW-WS%controller_number_C0.txt	(
						FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C0.txt) DO	(
																				FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C0.txt) DO	(
																																IF [%%j]==[%%k] (GOTO DONE_NEW_ALARMS_C0) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C0.txt 2>&1 
																																)
																				)
						)
:DONE_NEW_ALARMS_C0

IF EXIST %TW-WS%controller_number_C1.txt	(
						FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C1.txt) DO	(
																				FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C1.txt) DO	(
																																IF [%%j]==[%%k] (GOTO DONE_NEW_ALARMS_C1) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C1.txt 2>&1 
																																)
																				)
						)
:DONE_NEW_ALARMS_C1

IF EXIST %TW-WS%controller_number_C2.txt	(
						FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C2.txt) DO	(
																				FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C2.txt) DO	(
																																IF [%%j]==[%%k] (GOTO DONE_NEW_ALARMS_C2) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C2.txt 2>&1 
																																)
																				)
						)
:DONE_NEW_ALARMS_C2

IF EXIST %TW-WS%controller_number_C3.txt	(
						FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C3.txt) DO	(
																				FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C3.txt) DO	(
																																IF [%%j]==[%%k] (GOTO DONE_NEW_ALARMS_C3) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C3.txt 2>&1 
																																)
																				)
						)
:DONE_NEW_ALARMS_C3

IF EXIST %TW-WS%controller_number_C4.txt	(
						FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C4.txt) DO	(
																				FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C4.txt) DO	(
																																IF [%%j]==[%%k] (GOTO DONE_NEW_ALARMS_C4) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C4.txt 2>&1 
																																)
																				)
						)
:DONE_NEW_ALARMS_C4

IF EXIST %TW-WS%controller_number_C5.txt	(
						FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C5.txt) DO	(
																				FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C5.txt) DO	(
																																IF [%%j]==[%%k] (GOTO DONE_NEW_ALARMS_C5) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C5.txt 2>&1 
																																)
																				)
						)
:DONE_NEW_ALARMS_C5

IF EXIST %TW-WS%controller_number_C6.txt	(
						FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C6.txt) DO	(
																				FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C6.txt) DO	(
																																IF [%%j]==[%%k] (GOTO DONE_NEW_ALARMS_C6) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C6.txt 2>&1 
																																)
																				)
						)
:DONE_NEW_ALARMS_C6

IF EXIST %TW-WS%controller_number_C7.txt	(
						FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\monitor_point_C7.txt) DO	(
																				FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C7.txt) DO	(
																																IF [%%j]==[%%k] (GOTO DONE_NEW_ALARMS_C7) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C7.txt 2>&1 
																																)
																				)
						)
:DONE_NEW_ALARMS_C7
REM ###########################################################################################################################
REM # Monitor Mode - Blank match j & k
REM # Comparing "monitor_point" and AENs, printing new AENs to AnyError_new_alarms_C%%i.txt 2>&1 
REM # "Couldn't strip blank spaces on the end of the AEN strings to use one set of AEN files."
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO (IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C%%i.txt del %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C%%i.txt >> misc_output.txt 2>&1)

IF EXIST %TW-WS%controller_number_C0.txt	(
						IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C0.txt	(
																		FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C0.txt) DO	(
																																	FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C0.txt) DO	(
																																													IF [%%j]==[%%k] (GOTO DONE_AnyError_NEW_ALARMS_C0) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C0.txt 2>&1 
																																													)
																																	)
																		)
						)
:DONE_AnyError_NEW_ALARMS_C0

IF EXIST %TW-WS%controller_number_C1.txt	(
						IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C1.txt	(
																		FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C1.txt) DO	(
																																	FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C1.txt) DO	(
																																													IF [%%j]==[%%k] (GOTO DONE_AnyError_NEW_ALARMS_C1) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C1.txt 2>&1 
																																													)
																																	)
																		)
						)
:DONE_AnyError_NEW_ALARMS_C1

IF EXIST %TW-WS%controller_number_C1.txt	(
						IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C1.txt	(
																		FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C1.txt) DO	(
																																	FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C1.txt) DO	(
																																													IF [%%j]==[%%k] (GOTO DONE_AnyError_NEW_ALARMS_C1) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C1.txt 2>&1 
																																													)
																																	)
																		)
						)
:DONE_AnyError_NEW_ALARMS_C2

IF EXIST %TW-WS%controller_number_C2.txt	(
						IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C2.txt	(
																		FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C2.txt) DO	(
																																	FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C2.txt) DO	(
																																													IF [%%j]==[%%k] (GOTO DONE_AnyError_NEW_ALARMS_C2) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C2.txt 2>&1 
																																													)
																																	)
																		)
						)
:DONE_AnyError_NEW_ALARMS_C3

IF EXIST %TW-WS%controller_number_C3.txt	(
						IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C3.txt	(
																		FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C3.txt) DO	(
																																	FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C3.txt) DO	(
																																													IF [%%j]==[%%k] (GOTO DONE_AnyError_NEW_ALARMS_C3) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C3.txt 2>&1 
																																													)
																																	)
																		)
						)
:DONE_AnyError_NEW_ALARMS_C4

IF EXIST %TW-WS%controller_number_C4.txt	(
						IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C4.txt	(
																		FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C4.txt) DO	(
																																	FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C4.txt) DO	(
																																													IF [%%j]==[%%k] (GOTO DONE_AnyError_NEW_ALARMS_C4) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C4.txt 2>&1 
																																													)
																																	)
																		)
						)
:DONE_AnyError_NEW_ALARMS_C5

IF EXIST %TW-WS%controller_number_C5.txt	(
						IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C5.txt	(
																		FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C5.txt) DO	(
																																	FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C5.txt) DO	(
																																													IF [%%j]==[%%k] (GOTO DONE_AnyError_NEW_ALARMS_C5) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C5.txt 2>&1 
																																													)
																																	)
																		)
						)
:DONE_AnyError_NEW_ALARMS_C6

IF EXIST %TW-WS%controller_number_C6.txt	(
						IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C6.txt	(
																		FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C6.txt) DO	(
																																	FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\alarms_C6.txt) DO	(
																																													IF [%%j]==[%%k] (GOTO DONE_AnyError_NEW_ALARMS_C6) ELSE ECHO %%k >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C6.txt 2>&1 
																																													)
																																	)
																		)
						)
:DONE_AnyError_NEW_ALARMS_C7

REM ###########################################################################################################################
REM # Monitor Mode - 
REM # log time/date stamps
REM ###########################################################################################################################
SET mtw_date=%date%
SET mtw_date=%mtw_date:~-10%
SET mtw_date=%mtw_date:/=%
SET mtw_date=%mtw_date: =%
SET mtw_date=%mtw_date::=%
SET mtw_date=%mtw_date:.=%
SET mtw_year=%mtw_date:~-2%
SET mtw_daymonth=%mtw_date:~0,-4%
SET mtw_date=%mtw_daymonth%%mtw_year%
SET mtw_time=%time%
SET mtw_time=%mtw_time: =%
SET mtw_time=%mtw_time::=%
SET mtw_time=%mtw_time:.=%
SET mtw_time=%mtw_time:,=%
SET mtw_time=%mtw_time:~0,-2%
REM ###########################################################################################################################
REM # Monitor Mode - 
REM # Searching for 3 specific AENs to stop test also just do a "show diag" on any "ERROR" and continue.
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							%grep% -e "Controller reset occurred: resets=" %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C%%i.txt >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1	(
										@ECHO "Controller reset occurred: resets=" > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\ResetDegradeRebuild_C%%i.txt
										GOTO STOP
										)
							%grep% -e "Degraded unit: unit=" %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C%%i.txt >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1 	(
							@ECHO "Degraded unit: unit=" > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\ResetDegradeRebuild_C%%i.txt
										GOTO STOP
										)
							%grep% -e "Rebuild started:" %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C%%i.txt >> misc_output.txt 2>&1
							IF NOT ERRORLEVEL 1 	(
							@ECHO "Rebuild started:" > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\ResetDegradeRebuild_C%%i.txt
							GOTO STOP
										)
							)

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\CREATEAnyErrorMONITORPOINT_C%%i.txt del %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\CREATEAnyErrorMONITORPOINT_C%%i.txt 
							IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C%%i.txt	( 
																			%grep% -e "]  ERROR" %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C%%i.txt >> misc_output.txt 2>&1
																			IF NOT ERRORLEVEL 1 @ECHO "Dummy File - AnyError_new_alarms" > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\CREATEAnyErrorMONITORPOINT_C%%i.txt 
																			)
							)

FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF NOT EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_new_alarms_C%%i.txt	( 
																			%grep% -e "]  ERROR" %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C%%i.txt >> misc_output.txt 2>&1
																			IF NOT ERRORLEVEL 1 @ECHO "Dummy File - new_alarms" > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\CREATEAnyErrorMONITORPOINT_C%%i.txt 
																			)
							)

REM ###########################################################################################################################
REM # Monitor Mode - Blank added to EOL in monitor_point_C%%i.txt
REM # Getting latest AEN "AnyError_monitor_point" to compare new AEN's against
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\CREATEAnyErrorMONITORPOINT_C%%i.txt	(
																				tw_cli /c%%i show alarms > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_initial_alarms_C%%i.txt 2>&1
																				FOR /F "usebackq delims=" %%j IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_initial_alarms_C%%i.txt) DO	(
																																				@ECHO %%j > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C%%i.txt
																																				)
																				)
							)
REM ###########################################################################################################################
REM # Verify AnyError_monitor_point_C%%i.txt is valid
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
							IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\CREATEAnyErrorMONITORPOINT_C%%i.txt	(
																				FOR /F "usebackq delims=" %%k IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C%%i.txt) DO	(
																																				FOR /F "usebackq delims=" %%l IN (%TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\no_alarms_check.txt) DO	(
																																																		IF [%%k]==[%%l] ECHO "There were no alarms" > %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\AnyError_monitor_point_C%%i.txt
																																																		)
																																				)
																				)
							)
REM ###########################################################################################################################
REM # Monitor Mode - 
REM # Default 60 Second Alarm Check wait * 60 Iterations = approx. 1 hour * 24 = approx. 1 day standard "show diag"
REM # 60 * 24 = 1440 lines 
REM ###########################################################################################################################
ECHO 1 >> %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\Count.txt 2>&1
find /N "1" %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\Count.txt | find "[1440]" >> misc_output.txt 2>&1
IF NOT ERRORLEVEL 1	(
			FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO	(
										tw_cli /c%%i show diag > %TW-FN%\LSI_Products\3Ware\MONITOR\daily_%mtw_date%_%mtw_time%_diag_C%%i.txt 2>&1
										del %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\Count.txt >> misc_output.txt 2>&1
										)
			)
REM ###########################################################################################################################
REM # Monitor Mode - 
REM # The "show diag" on any error, not including the main three.
REM ###########################################################################################################################
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO 	(
							IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\CREATEAnyErrorMONITORPOINT_C%%i.txt	(
																				tw_cli /c%%i show diag > %TW-FN%\LSI_Products\3Ware\MONITOR\AnyError_%mtw_date%_%mtw_time%_diag_C%%i.txt 2>&1
																				del %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\new_alarms_C%%i.txt >> misc_output.txt 2>&1
																				)
							)
GOTO NOT_FIRST_RUN
REM ###########################################################################################################################
REM # Monitor Mode - 
REM # The "show diag" on the main three AENs.
REM ###########################################################################################################################
:STOP
FOR /F "usebackq" %%i IN (%TW-WS%ctrl_nums.txt) DO 	(
							IF EXIST %TW-FN%\LSI_Products\3Ware\MONITOR\script_workspace\ResetDegradeRebuild_C%%i.txt	(
																			tw_cli /c%%i show diag > %TW-FN%\LSI_Products\3Ware\MONITOR\ResetDegradeRebuild_%mtw_date%_%mtw_time%_diag_C%%i.txt 2>&1
																			%sleep% 300
																			tw_cli /c%%i show diag > %TW-FN%\LSI_Products\3Ware\MONITOR\ResetDegradeRebuild_5min_%mtw_date%_%mtw_time%_diag_C%%i.txt 2>&1
																			)
							)
:NOT_MONITOR_MODE
:TWPARTIALMODE
REM ###########################################################################################################################
REM Clean up unused files
REM ###########################################################################################################################

mkdir native_test >> misc_output.txt 2>&1
cd native_test


REM   ......................................::.......................................
@ECHO ############################################################################### > ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO Installed Utils in Path >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
lsut 0 >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
scl -i 1 list >> ..\%TW-WS%Utility_Versions.txt 2>&1
REM   ......................................::.......................................
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
IF NOT [%NOWOW64%]==[YES] (xu  >> ..\%TW-WS%Utility_Versions.txt 2>&1)
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
g3xu  >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
sasflash -ver >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
sas2flash -ver >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
sas3flash -ver >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
flashoem -ver >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
sas2ircu >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
sas3ircu >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
tw_cli ? >> ..\%TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> ..\%TW-WS%Utility_Versions.txt 2>&1
%MR_Cli% -v >> ..\%TW-WS%Utility_Versions.txt 2>&1

cd ..
rmdir /Q /S native_test >> misc_output.txt 2>&1

REM   ......................................::.......................................
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO Script supplied Utils >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
lsut 0 >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
scl -i 1 list >> %TW-WS%Utility_Versions.txt 2>&1
REM   ......................................::.......................................
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
IF NOT [%NOWOW64%]==[YES] (xu  >> %TW-WS%Utility_Versions.txt 2>&1)
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
g3xu  >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
sasflash -ver >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
sas2flash -ver >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
sas3flash -ver >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
flashoem -ver >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
sas2ircu >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
sas3ircu >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
tw_cli ? >> %TW-WS%Utility_Versions.txt 2>&1
@ECHO ############################################################################### >> %TW-WS%Utility_Versions.txt 2>&1
%MR_Cli% -v >> %TW-WS%Utility_Versions.txt 2>&1


IF ["%NO_lsut_LSI_HBAs%"]==["YES"] move /Y lsiutil.exe Utils >> misc_output.txt 2>&1
IF ["%NO_scl_EXP-IOC%"]==["YES"] move /Y scli.exe Utils >> misc_output.txt 2>&1

sasflash -listall >> misc_output.txt 2>&1
IF ERRORLEVEL 1 move /Y sasflash.exe Utils >> misc_output.txt 2>&1
sas2flash -listall >> misc_output.txt 2>&1
IF ERRORLEVEL 1 move /Y sas2flash.exe Utils >> misc_output.txt 2>&1
sas3flash -listall >> misc_output.txt 2>&1
IF ERRORLEVEL 1 move /Y sas3flash.exe Utils >> misc_output.txt 2>&1
flashoem -listall >> misc_output.txt 2>&1
IF ERRORLEVEL 1	(
		flashoem -ctype sas3 -listall >> misc_output.txt 2>&1
		IF ERRORLEVEL 1 move /Y flashoem.exe Utils >> misc_output.txt 2>&1
		)

IF ["%NO_2ircu_HBAs%"]==["YES"] move /Y sas2ircu.exe Utils >> misc_output.txt 2>&1
IF ["%NO_3ircu_HBAs%"]==["YES"] move /Y sas3ircu.exe Utils >> misc_output.txt 2>&1

IF ["%NO_MR_Adps%"]==["YES"] move /Y %MR_Cli% Utils  >> misc_output.txt 2>&1
IF ["%NO_MR_Adps%"]==["YES"] move /Y storelibir-2.dll Utils >> misc_output.txt 2>&1
IF ["%NO_3Ware_Ctrls%"]==["YES"] move /Y tw_cli.exe Utils >> misc_output.txt 2>&1
IF ["%NO_xu_GEN1-2_EXPs%"]==["YES"] move /Y xutil.exe Utils >> misc_output.txt 2>&1
IF ["%NO_g3xu_GEN3_EXPs%"]==["YES"] move /Y g3xutil.exe Utils >> misc_output.txt 2>&1
IF ["%NO_g3xu_GEN3_EXPs%"]==["YES"] move /Y bootstrapCobra.bin Utils >> misc_output.txt 2>&1


IF EXIST %TW-FN%\LSI_Products\MegaRAID	(
					IF NOT EXIST %TW-FN%\LSI_Products\MegaRAID\Notes mkdir %TW-FN%\LSI_Products\MegaRAID\Notes
					move /Y MegaRAID_Terminology.txt %TW-FN%\LSI_Products\MegaRAID\Notes >> misc_output.txt 2>&1
					)	

IF [%NOWOW64%]==[YES] IF EXIST timer.exe del timer.exe >> misc_output.txt 2>&1
IF [%NOWOW64%]==[YES] IF EXIST xdir.exe del xdir.exe >> misc_output.txt 2>&1

REM ###########################################################################################################################
REM # Script Diag
REM ###########################################################################################################################

REM   ......................................::.......................................
@ECHO .....................Name of user executing lsigetwin.bat...................... >> %TW-WS%script_diag.txt
@ECHO %USERNAME% >> %TW-WS%script_diag.txt
IF NOT [%NOWOW64%]==[YES] (@ECHO ..................................whoami /all.................................. >> %TW-WS%script_diag.txt)
IF NOT [%NOWOW64%]==[YES] (whoami /all >> %TW-WS%script_diag.txt)
REM   ......................................::.......................................
@ECHO ...............Directory contents where lsigetwin.bat was executed............. >> %TW-WS%script_diag.txt
dir >> %TW-WS%script_diag.txt
REM   ......................................::.......................................
@ECHO ......................................set...................................... >> %TW-WS%script_diag.txt
set >> %TW-WS%script_diag.txt
@ECHO ......................................ver...................................... >> %TW-WS%script_diag.txt
ver >> %TW-WS%script_diag.txt
@ECHO ...........................Command Line and Options............................ >> %TW-WS%script_diag.txt
@ECHO %0 %* >> %TW-WS%script_diag.txt

REM ###########################################################################################################################
REM # Script Start/Stop times
REM ###########################################################################################################################
SET TWGETWINSTOP=%time%
@ECHO %TWGETWINSTART% > %TW-WS%Script_Start_Stop_Time.txt
@ECHO %TWGETWINSTOP% >> %TW-WS%Script_Start_Stop_Time.txt


REM ###########################################################################################################################
REM # Compressing the file output and cleaning temporary workspace 
REM ###########################################################################################################################

REM WarpDrive
IF EXIST Valid_wd_test.txt move /Y Valid_wd_test.txt %TW-WS% >> misc_output.txt 2>&1
REM 3Ware
IF EXIST Valid_controller_test.txt move /Y Valid_controller_test.txt %TW-WS% >> misc_output.txt 2>&1
REM HBA
IF EXIST Valid_hba_test.txt move /Y Valid_hba_test.txt %TW-WS% >> misc_output.txt 2>&1
REM MegaCli MegaRAID
IF EXIST adpcount.txt move /Y adpcount.txt %TW-WS% >> misc_output.txt 2>&1
REM storcli MegaRAID
IF EXIST pre_mr_ctrl_nums.txt move /Y pre_mr_ctrl_nums.txt %TW-WS% >> misc_output.txt 2>&1

IF EXIST misc_output.txt move /Y misc_output.txt %TW-WS% > nul 2>&1

IF [%TWGETSKIPCOMPRESSION%]==[YES]	( 
					@ECHO End of script...
					IF [%NOWOW64%]==[YES] (@ECHO %time%)
					@ECHO End of script... > %TW-WS%End_of_script.txt
					@ECHO .
					IF NOT [%NOWOW64%]==[YES] (@ECHO Elapsed Time for entire script:)
					IF NOT [%NOWOW64%]==[YES] (timer /s /nologo)
					@ECHO .
					@ECHO "lsigetwin -H" provides a help screen.
					@ECHO . 
					@ECHO The data collection is in the following subdirectory;
					@ECHO .
					@ECHO %TW-FN%
					@ECHO .
					)

IF NOT [%TWGETSKIPCOMPRESSION%]==[YES]	( 
					@ECHO End of script, please wait while compressing output file...
					IF [%NOWOW64%]==[YES] (@ECHO %time%)
					@ECHO End of script, please wait while compressing output file... > %TW-WS%End_of_script.txt
					IF NOT [%NOWOW64%]==[YES] (Utils\timer_comp\timer_comp /q /nologo)
					7z -pbroadcom -mx=9 a %TW-FN%.7z %TW-FN% >> misc_output.txt 2>&1
					%grep% "Everything is Ok" misc_output.txt > nul 2>&1
					IF NOT ERRORLEVEL 1 (del misc_output.txt > nul 2>&1)
					IF EXIST misc_output.txt 	(
									@ECHO .
									@ECHO .
									@ECHO .
									@ECHO .
									@ECHO .
									@ECHO Issue with 7z file compression, see misc_output.txt...
									@ECHO .
									@ECHO .
									@ECHO .
									@ECHO .
									@ECHO .
									)
					IF NOT [%NOWOW64%]==[YES] (Utils\timer_comp\timer_comp /s /nologo)
					REM   .......................................||.......................................
					IF NOT [%NOWOW64%]==[YES] (@ECHO .)
					IF NOT [%NOWOW64%]==[YES] (@ECHO Elapsed Time for entire script including file compression:)
					IF NOT [%NOWOW64%]==[YES] (timer /s /nologo)
					IF NOT EXIST misc_output.txt 	(
									@ECHO .
									@ECHO The file name is;
									@ECHO .
									@ECHO %TW-FN%.7z
									@ECHO .
									@ECHO Send JUST this file to your support rep, do NOT rename. 
									@ECHO The file is PASSWORD Protected to get through the Broadcom firewall. 
									@ECHO Password=broadcom
									@ECHO .
									@ECHO "lsigetwin -H" provides a help screen.
									@ECHO . 
									)	
					IF NOT [%TWGETDIRECTORYKEEP%]==[YES] 	(rd /s /q %TW-FN%)
					IF [%TWGETDIRECTORYKEEP%]==[YES]	(
										@ECHO The following subdir was left for your use;
										@ECHO .
										@ECHO %TW-FN%
										@ECHO .
										)
					)


REM ###########################################################################################################################
REM # Clean old or temp files if they exist 
REM ###########################################################################################################################

IF [%TWGETBATCHMODE%]==[BATCH] GOTO END_No_Pause
IF [%TWGETBATCHMODE%]==[QUIET] GOTO END_No_Pause

:END
IF EXIST cleanup_all.txt	(FOR /F "usebackq" %%i IN (cleanup_all.txt) DO	(
										IF EXIST %%i (del %%i > nul 2>&1)
										) 
				IF NOT [%NOWOW64%]==[YES]	(
								@ECHO End of script... > End_of_script.txt
								xdir /Form=*t End_of_script.txt
								@ECHO .	
								del End_of_script.txt > nul 2>&1
								del xdir.exe > nul 2>&1
								del timer.exe > nul 2>&1
								del timer.txt > nul 2>&1
								rmdir Utils\timer_comp /S /Q > nul 2>&1
								)
				IF [%EXTRACTUTILS%]==[YES] del misc_output.txt > nul 2>&1
				IF [%NOWOW64%]==[YES] (@ECHO %time%)
				IF [%NOWOW64%]==[YES] (@ECHO %time%)
				)
del cleanup_all.txt > nul 2>&1 
PAUSE
GOTO END1

:END_No_Pause
IF EXIST cleanup_all.txt	(FOR /F "usebackq" %%i IN (cleanup_all.txt) DO	(
										IF EXIST %%i (del %%i > nul 2>&1)
										) 
				IF NOT [%NOWOW64%]==[YES]	(
								@ECHO End of script... > End_of_script.txt
								xdir /Form=*t End_of_script.txt
								@ECHO .
								del End_of_script.txt > nul 2>&1
								del xdir.exe > nul 2>&1
								del timer.exe > nul 2>&1
								del timer.txt > nul 2>&1
								rmdir Utils\timer_comp /S /Q > nul 2>&1
								)
				IF [%EXTRACTUTILS%]==[YES] del misc_output.txt > nul 2>&1
				IF [%NOWOW64%]==[YES] (@ECHO %time%)
				)
del cleanup_all.txt > nul 2>&1 

:END1

