Check a Volume for errors (VBScript)
This code can be found in
Chapter 7 of Windows XP Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' From the book, "Windows XP Cookbook"
' ISBN: 0596007256
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
strDrive = "<Drive>" ' e.g. D:
boolFixErrors = True ' True = chkdsk /f, False = chkdsk
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objDisk = objWMI.Get("Win32_LogicalDisk.DeviceID='" & strDrive & "'")
intRC = objDisk.ChkDsk(boolFixErrors)
if intRC = 0 then
WScript.Echo "Chkdsk completed successfully."
elseif intRC = 1 then
WScript.Echo "Chkdsk scheduled on next reboot."
else
WScript.Echo "Error running chkdsk: " & intRC
end if
|
This code has been viewed 1273 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|