Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using Regedit to force disk check at reboot

Posted on 2007-11-21
7
Medium Priority
?
4,433 Views
Last Modified: 2010-04-21
I am creating an AutoIt script that produces a menu with shortcuts to frequently used programs I run to perform routine maintenance on the Windows XP-based computers at the office where I work.  One menu item will have the computer run error-checking on the hard drive when the computer reboots. The long way of doing this is double-click on My Computer, right-click on C, go to Properties, click on the Tools tab, click Check Now in the Error Check section and checking both items in the window that opens.

I know something's written to the registry for the error checking to take place when the computer reboots, but I don't know what entries these are or where they're written. I'd like my script to write these entries to the registry without having to go through the lengthy process I've described above.
0
Comment
Question by:mjbtec
7 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 20329210
See the description at http://support.microsoft.com/kb/218461 ("Description of Enhanced Chkdsk, Autochk, and Chkntfs Tools in Windows 2000"), that applies to XP as well. The scoop is to set

HKLM\System\CurrentControlSet\Control\Session Manager\ BootExecute:REG_MULTI_SZ: autocheck autochk *

You will find a description of the additional parameters in the article.
0
 
LVL 86

Expert Comment

by:jkr
ID: 20329268
BTW, why don't you just launch

chkdsk.exe c:

from your script?
0
 
LVL 3

Expert Comment

by:RealityLord
ID: 20330820
Hello.
You can set dirty bit, and on reboot windows will chkdsk targeted partition.
Something like this:

RunWait("cmd /c fsutil dirty set C:")

Hope it helps.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 13

Expert Comment

by:lciprianionut
ID: 20331956
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager under BootExecute key

example from vista business (for C and H drives)

autocheck autochk /r \??\H:
autocheck autochk /r \??\C:
autocheck autochk *
0
 
LVL 86

Expert Comment

by:jkr
ID: 20332411
lciprianionut,

I am under the impression that this has already bee mentioned.
0
 

Author Closing Comment

by:mjbtec
ID: 31410410
That's exactly what I was looking for. I wanted my script to run the menu items invisibly in the background without any prompts popping up, so I didn't want to use CHKDSK.

I modified my AutoIt script to write the line in the registry for the error checking to take place on the next reboot and it worked like a charm when the computer restarted. Here are the lines from my AutoIt script that made it all happen.

RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager", "BootExecute", "REG_MULTI_SZ", "autocheck autochk /r \??\C:")
MsgBox (4096, "MaintMan", "Scandisk will run next time you reboot.")

Thanks everyone for their help.
0
 

Author Comment

by:mjbtec
ID: 20350062
JKR, that was exactly what I was looking for. I wanted my script to work its magic invisibly in the background without any annoying prompts, so I didn't want to use CHKDSK.

I had my script write the lines to the registry to force the disk checking to take place when the computer restarted and it worked like a charm. Here are the lines from my script that made it all happen.

RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager", "BootExecute", "REG_MULTI_SZ", "autocheck autochk /r \??\C:")
MsgBox (4096, "MaintMan", "Scandisk will run next time you reboot.")

Thanks everyone for their help.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question