@echo off
set source=%~dp0
if "%source%x"=="x" set source=.\
set name=output
cd /d "%source%
echo.
echo ++++++++++++++++++++++++++++++++++++++++++++++
echo +                                            +
echo +  SMART Gather Tool v1.0T                   +
echo +                                            +
echo +  Andrew Sharrad 7th February 2026          +
echo +                                            +
echo ++++++++++++++++++++++++++++++++++++++++++++++
echo.
echo This program will gather the SMART information from
echo all available devices
if not "%1x"=="x" (
set name=%1
) else (
echo.
echo Usage: SGT [filename] to save the output using a different filename,
echo such as the system serial number.
)
echo.
del "%source%%name%.old" /q >NUL 2>&1
ren "%source%%name%.txt" "%name%.old" >NUL 2>&1
echo ++++++++++++++++++++++++++++++++++++++++++++++ >"%source%%name%.txt"
echo +                                            + >>"%source%%name%.txt"
echo +  SMART Gather Tool v1.0S                   + >>"%source%%name%.txt"
echo +                                            + >>"%source%%name%.txt"
echo +  Andrew Sharrad 30th January 2024          + >>"%source%%name%.txt"
echo +                                            + >>"%source%%name%.txt"
echo ++++++++++++++++++++++++++++++++++++++++++++++ >>"%source%%name%.txt"
echo. >>"%source%%name%.txt"
echo Traditional HDD - Analyse the RAW_VALUE column, especially these values: >>"%source%%name%.txt"
echo   5 Reallocated_Sector_Ct >>"%source%%name%.txt"
echo  10 Spin_Retry_Count >>"%source%%name%.txt"
echo  11 Calibration_Retry_Count >>"%source%%name%.txt"
echo 196 Reallocated_Event_Count >>"%source%%name%.txt"
echo 197 Current_Pending_Sector >>"%source%%name%.txt"
echo 198 Offline_Uncorrectable >>"%source%%name%.txt"
echo 199 UDMA_CRC_Error_Count >>"%source%%name%.txt"
echo. >>"%source%%name%.txt"
echo SSD - Analyse the RAW_VALUE column, especially these values: >>"%source%%name%.txt"
echo   5 Reallocated_Sector_Ct >>"%source%%name%.txt"
echo 177 Wear_Leveling_Count >>"%source%%name%.txt"
echo 179 Used_Rsvd_Blk_Cnt_Tot >>"%source%%name%.txt"
echo 181 Program_Fail_Cnt_Total >>"%source%%name%.txt"
echo 182 Erase_Fail_Count_Total >>"%source%%name%.txt"
echo 183 Runtime_Bad_Block >>"%source%%name%.txt"
echo 187 Uncorrectable_Error_Cnt >>"%source%%name%.txt"
echo 190 Airflow_Temperature_Cel >>"%source%%name%.txt"
echo 195 ECC_Error_Rate >>"%source%%name%.txt"
echo 199 UDMA_CRC_Error_Count >>"%source%%name%.txt"
echo 235 POR_Recovery_Count >>"%source%%name%.txt"
echo 241 Total_LBAs_Written >>"%source%%name%.txt"
echo. >>"%source%%name%.txt"
del "%source%drives.txt" /q >NUL 2>&1
echo Generating List of Installed Devices...
echo Generating List of Installed Devices... >>"%source%%name%.txt"
echo.
echo. >>"%source%%name%.txt"
smartctl --scan-open >"%source%drives.txt"
type "%source%drives.txt" >>"%source%%name%.txt"
type "%source%drives.txt"
echo. >>"%source%%name%.txt"
echo Use the results below to determine if the drives are healthy or if they require >>"%source%%name%.txt"
echo further manufacturer diagnostic tool testing. >>"%source%%name%.txt"
echo.
echo. >>"%source%%name%.txt"
echo Gathering SMART information from Devices...
echo Gathering SMART information from Devices... >>"%source%%name%.txt"
echo.
for /F "usebackq tokens=1" %%G in ( "%source%drives.txt" ) DO (
echo ============================================================================================ >>"%source%%name%.txt"
echo. >>"%source%%name%.txt"
echo Processing drive %%G
echo Processing drive %%G >>"%source%%name%.txt"
echo. >>"%source%%name%.txt"
"%source%smartctl" -a %%G >>"%source%%name%.txt"
echo. >>"%source%%name%.txt"
)
echo. >>"%source%%name%.txt"
echo ============================================================================================ >>"%source%%name%.txt"
echo. >>"%source%%name%.txt"
echo.
echo Complete. Examine the output file "%source%%name%.txt" and then look at the Raw Values tables.
echo.
del "%source%drives.txt" /q >NUL 2>&1
echo Traditional HDD - Analyse the RAW_VALUE column, especially these values:
echo   5 Reallocated_Sector_Ct
echo  10 Spin_Retry_Count
echo  11 Calibration_Retry_Count
echo 196 Reallocated_Event_Count
echo 197 Current_Pending_Sector
echo 198 Offline_Uncorrectable
echo 199 UDMA_CRC_Error_Count
echo.
echo SSD - Analyse the RAW_VALUE column, especially these values:
echo Especially these values:
echo   5 Reallocated_Sector_Ct
echo 177 Wear_Leveling_Count
echo 179 Used_Rsvd_Blk_Cnt_Tot
echo 181 Program_Fail_Cnt_Total
echo 182 Erase_Fail_Count_Total
echo 183 Runtime_Bad_Block
echo 187 Uncorrectable_Error_Cnt
echo 190 Airflow_Temperature_Cel
echo 195 ECC_Error_Rate
echo 199 UDMA_CRC_Error_Count
echo 235 POR_Recovery_Count
echo 241 Total_LBAs_Written
echo.
echo Use these outputs to determine if the drives are healthy or if they require
echo further manufacturer diagnostic tool testing.
:end
pause >nul

