Solved

Using Regedit to force disk check at reboot

Posted on 2007-11-21
7
4,407 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

There are 2 things you must have in order to connect to the internet behind a router, The "Gateway IP" of the router, which is usually something like 192.168.xxx.1, I've seen routers with default values of: 192.168.0.1, 192.168.1.1, 192.168.11.1, …
If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article (http://rdsrc.us/u3GP7A) first and run the tool TDSSKiller (http://rdsrc.us/GDBBs4) to get rid of the infection. Once done, and if the …
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

630 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