#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: Tobias Rouiller Script Function: Checks whether the PC contains solid state drives on RAID, if it's the case then disable the scheduled defragmentation #ce ---------------------------------------------------------------------------- ; Script Start ;Run the command line and export to the file log RunWait(@ComSpec & " /c " & 'MegaCli -PDList -aALL>' & @ComputerName &".log", @ScriptDir, @SW_HIDE) ; don't forget " " before "/c" Local $file = FileOpen(@ComputerName & ".log", 0) ; Check if file opened for reading OK If $file = -1 Then Exit(2) EndIf $is_ssd = 0 ; Read in lines of text until the EOF is reached or that we get the good value While 1 Local $line = FileReadLine($file) If @error = -1 Then ExitLoop If "Media Type: Solid State Device" = $line Then ;ConsoleWrite("is ssd...") $is_ssd = 1 ExitLoop EndIf WEnd FileClose($file) ;Remove the log file FileDelete(@ComputerName & ".log") ;If it's ssd then disable the sheduled task If $is_ssd = 1 Then RunWait(@ComSpec & " /c " & 'schtasks.exe /change /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" /Disable', @ScriptDir, @SW_HIDE) ; don't forget " " before "/c" EndIf