Jump to content

CHKDSK by GUID


careca
 Share

Recommended Posts

Hi, i created this after i was trying to clone a disk and it kept giving me errors from bad sector, i ran CHKDSK on the offending drive multiple times, not finding anything, then i learned that there are hidden partitions on which chkdsk can run on, but i need to supply the partition GUID.

This tool is the simple and easy way to chkdsk /R those partitions, it retrieves a list of all, with and without assigned letter, and then the user can use the context menu on them to run chkdsk /r command.

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=chkdsk.ico
#AutoIt3Wrapper_Res_Icon_Add=chkdsk.ico
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;=============================================================================
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <GuiListView.au3>
;=============================================================================
Opt("GUIOnEventMode", 1)
Opt("GUIEventOptions", 0)
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Opt("TrayMenuMode", 3)
Opt("TrayIconHide", 0)
Opt("TrayIconDebug", 1)
Opt("TrayAutoPause", 0)
Opt("TrayOnEventMode", 1)
;=============================================================================
Local $Form1, $DSK, $Str, $Read, $List, $Letter, $VolSplit, $GUID, $cListView, $ContextMenu, $Selection, $GetItemPos, $ExitItem
$Form1 = GUICreate("CheckDisk Tool", 600, 360, 190, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
$cListView = GUICtrlCreateListView("Drive Letter|GUID", 10, 10, 580, 300)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 175)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 400)
$List = GUICtrlCreateButton("List Drives", 10, 320, 75, 25)
GUICtrlSetOnEvent($List, "List")
$ContextMenu = GUICtrlCreateContextMenu($cListView)
$Selection = GUICtrlCreateMenuItem("CHKDSK", $ContextMenu, 1)
GUICtrlSetOnEvent(-1, "CHKDSK")
GUICtrlSetTip(-1, "CHKDSK the volume with this GUID", 'CHKDSK')
GUISetIcon('chkdsk.ico')
TraySetIcon('chkdsk.ico')
$ExitItem = TrayCreateItem("Close")
TrayItemSetOnEvent(-1, "Close")
GUISetState(@SW_SHOW)
;=============================================================================
Func List()
    WinSetTitle($Form1, "", "Reading Volumes...")
    _GUICtrlListView_DeleteAllItems($cListView)
    $DSK = Run('mountvol', '', @SW_HIDE, $STDOUT_CHILD) ;@SW_HIDE
    WinWaitActive('[CLASS:ConsoleWindowClass]', '', 2)
    SendKeepActive('[CLASS:ConsoleWindowClass]')
    Sleep(1000)
    Do
        Sleep(100)
        $Read = StdoutRead($DSK, True, False)
        $Str = StringInStr($Read, ':\')
    Until $Str <> 0
    $VolSplit = StringSplit($Read, '\\?\Volume{', 1)
    For $v = 2 To $VolSplit[0]
        $Letter = StringStripWS(StringTrimLeft($VolSplit[$v], 48), 8)
        $GUID = '\\?\Volume{' & StringLeft($VolSplit[$v], 37)
        If $Letter = '***NOMOUNTPOINTS***' Then
            $Letter = 'No Letter'
        EndIf
        GUICtrlCreateListViewItem($Letter & '|' & $GUID, $cListView)
    Next
    WinSetTitle($Form1, "", "CheckDisk Tool")
EndFunc   ;==>List
;=============================================================================
Func CHKDSK()
    $GetItemPos = _GUICtrlListView_GetNextItem($cListView, -1, 0, 8)
    $GUID = _GUICtrlListView_GetItemText($cListView, $GetItemPos, 1)
    ConsoleWrite($GUID & @CRLF)
    $DSK = ShellExecute('chkdsk', $GUID & ' /r', '', '', @SW_SHOW)
    WinWaitActive('[CLASS:ConsoleWindowClass]', '', 2)
    SendKeepActive('[CLASS:ConsoleWindowClass]')
    ;GUISetState(@SW_SHOW)
EndFunc   ;==>CHKDSK
;=============================================================================
Func Close()
    Exit
EndFunc   ;==>Close
;=============================================================================
Do
    Sleep(100)
Until $Form1 = 0
;=============================================================================

 

Screenshot 2021-11-25 023928.png

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...