Scheduling CHKDSK and DEFRAG for unattended execution

B

Blue Max

We would like to safely schedule CHKDSK and DEFRAG for automated, unattended
execution once a week for routine maintenance. However, we seem to have
problems configuring these tasks. For example, we can schedule CHKDSK to
run, but it also indicates that it must dismount the volume and we will
loose any current handles and then offers to schedule the operation at the
next startup because there are open files. Is there a way to automatically
run CHKDSK so that it will automatically schedule itself for the next reboot
and then automatically reboot the system so that the CHKDSK will be
performed?
 
W

Wesley Vogel

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
Value Name: BootExecute
Data Type: REG_MULTI_SZ
Value Data: autocheck autochk /r \??\C:

chkdsk c: /f /r
adds the following entry to the BootExecute value:

autocheck autochk /r \??\C:

from...
CHKNTFS.EXE: What You Can Use It For
http://support.microsoft.com/kb/160963

So does running the Check Disk tool from Drive Properties.
Right click Drive | Properties | Tools tab | Check Now button |
Select both boxes in Check Disk Local Disk (C:)

<quote>
Registry value Function
----------------------------------------------------------------------------
/P \??\Volume: Schedules an unconditional Chkdsk against the
volume.
/p \??\VOLUME{GUID} Schedules an unconditional Chkdsk against a volume
mount point.
/k:Volume * Excludes Chkdsk from running against the volume.
/m \??\Volume: Tells Autochk to look only at the dirty bit on the
volume, and if set, run Chkdsk.

Sample command Resulting registry entry
-------------------------------------------------------------------------
Chkdsk C: /F Autocheck autochk /p \??\C:
Chkdsk C:\mountpoint /F Autocheck autochk /p \??\VOLUME{GUID}
Chkntfs D: E: /X Autocheck autochk /k:D /k:E *
Chkntfs G: /C Autocheck autochk /m \??\G:
<quote>
from...
Description of Enhanced Chkdsk, Autochk, and Chkntfs Tools in Windows 2000
http://support.microsoft.com/kb/218461

<quote>
BootExecute Data Item
The BootExecute data item contains one or more commands that Session Manager
runs before it loads any services. The default value for this item is
Autochk.exe, which is the Windows NT version of Chkdsk.exe. The default
setting is shown in this example:

BootExecute : REG_MULTI_SZ : autocheck autochk*
<quote>
from...
Windows NT Workstation Resource Kit: What Happens When You Start Your
Computer
http://www.microsoft.com/technet/archive/ntwrkstn/reskit/booting.mspx?mfr=true

If Chkdsk is to run in write-mode to attempt to remedy corruption, in most
cases, there will be locked files and it requires restarting to have
exclusive access to the partition or partitions. This process can be
automated and requires no user intervention. Usually, a user needs to press
"y" to schedule Chkdsk to run in write-mode on the next restart; however,
this process can be automated as follows:

@echo off
echo y|chkdsk C: /f/r

How to Automate Chkdsk
http://support.microsoft.com/kb/197527

http://www.ericphelps.com/batch/samples/today.bat.txt

For Chkdsk help...
Paste the following line into Start | Run and click OK...

hh ntcmds.chm::/chkdsk.htm

You could use the chkntfs or the FSUTIL dirty commands to set or query the
volume's dirty bit (indicating corruption) so that Windows runs chkdsk when
the computer is restarted. On volumes marked as "dirty," Windows
automatically runs chkdsk when the computer is restarted.

chkntfs c: /c

/C
Schedules a drive to be checked at boot time; chkdsk will run if the drive
is dirty.

chkntfs /?
and
hh ntcmds.chm::/chkntfs.htm

FSUTIL dirty set c:

FSUTIL /?
and
hh ntcmds.chm::/fsutil_dirty.htm

:: If the command for the day requires user input, for
:: example, you have to hit enter or answer yes or no,
:: you should run a separate batch file instead of
:: running the command directly. Assume you want to run
:: CHKDSK with the /F option to fix errors. If it finds
:: errors, it will ask you to type "y" or "n". You can
:: create a batch file which will do this for you:
:: ECHO Y|CHKDSK /F
:: If all you need is to press "Enter", you can do this:
:: ECHO.|CHKDSK /F
:: If you need to press "y", AND THEN HIT "Enter", it
:: gets more complicated. You have to create what is
:: generally called a "script" containing the exact
:: keystrokes you need to press. You can create it
:: ahead of time, or as needed like this:
:: ECHO Y>SCRIPT.TXT
:: ECHO.>>SCRIPT.TXT
:: TYPE SCRIPT.TXT|CHKDSK /F
:: Notice the first line had only one ">", but the
:: second line had two ">>". Just one will cause
:: the SCRIPT.TXT to be created new (if it already
:: exists, it will be erased to start over fresh).
:: The two >> will cause things to be appended to
:: the existing SCRIPT.TXT
:: http://www.ericphelps.com
from...
http://www.ericphelps.com/batch/samples/today.bat.txt

--------------------

How to Automate Disk Defragmenter Using Task Scheduler Tool in Windows XP
http://support.microsoft.com/kb/555098

There are two defrag tools in XP.

dfrg.msc is the pretty one that opens from
Start\All Programs\Accessories\System Tools.

defrag.exe is the command line tool that runs from the command prompt.

defrag.exe is the one that you can schedule.

Description of the New Command Line Defrag.exe Included with Windows XP
http://support.microsoft.com/kb/283080

How To Schedule Tasks in Windows XP
http://support.microsoft.com/kb/308569

How to Defragment Your Disk Drive Volumes in Windows XP
http://support.microsoft.com/kb/314848

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
B

Blue Max

Thanks, Wesley, there appears to be a lot of good information here and it
will take me awhile to digest it all. Meantime, a few more novice questions
if we may:

1. Is a hard disk volume the same as a logical drive?
2. What is a mount point?
3. What is the fundamental difference between chkdsk, chkntfs, and autochk?
4. Isn't there a utility or powertoy that can allow us to schedule
automated checks without playing Russian-Roulette with the registry?

Thanks

*************************
 
W

Wesley Vogel

In line.
1. Is a hard disk volume the same as a logical drive?

volume
[[An area of storage on a hard disk. A volume is formatted by using a file
system, such as FAT or NTFS, and has a drive letter assigned to it. You can
view the contents of a volume by clicking its icon in Windows Explorer or in
My Computer. A single hard disk can have multiple volumes, and volumes can
also span multiple disks.

See also: disk; drive letter; file allocation table (FAT); NTFS file system;
simple volume; spanned volume]]

logical drive
[[A volume that you create within an extended partition on a basic master
boot record (MBR) disk. Logical drives are similar to primary partitions,
except that you are limited to four primary partitions per disk, whereas you
can create an unlimited number of logical drives per disk. A logical drive
can be formatted and assigned a drive letter.

See also: basic disk; basic volume; drive letter; extended partition; master
boot record (MBR); primary partition; volume]]

both from Windows Glossary in Help and Support.
2. What is a mount point?

mount point
[[Volume mount points and folder junctions allow an empty folder on an NTFS
volume to point to the root or subfolder on another volume.]]

<quote>
Mount
In computers, to mount is to make a group of files in a file system
structure accessible to a user or user group. In some usages, it means to
make a device physically accessible. For instance, in data storage, to mount
is to place a data medium (such as a tape cartridge) on a drive in a
position to operate. Macintosh calls it mounting when a user inserts a disc
into the machine.

In a Unix environment, the mount command attaches discs, or directories
logically rather than physically. The Unix mount command makes a directory
accessible by attaching a root directory of one file system to another
directory, which makes all the file systems usable as if they were
subdirectories of the file system they are attached to. Unix recognizes
devices by their location, as compared to Windows, which recognizes them by
their names (C: drive, for example). Unix organizes directories in a
tree-like structure, in which directories are attached by mounting them on
the branches of the tree. The file system location where the device is
attached is called a mount point.

Mounts may be local or remote. A local mount connects disc drives on one
machine so that they behave as one logical system. A remote mount uses
Network File System (NFS) to connect to directories on other machines so
that they can be used as if they were all part of the user's file system.
<quote>
Glossary from Diskeeper Corporation
http://www.diskeeper.com/glossary.asp?RId=1&SId=1&CId=1&Aeid=0&Apid=0

<quote>
Mounted Drives on NTFS Volumes
Mounted drives, also known as volume mount points or drive paths, are
volumes attached to an empty folder on an NTFS volume. Mounted drives
function the same way as any other volume, but are assigned a label or name
instead of a drive letter. Mounted drives are robust against system changes
that occur when devices are added or removed from a computer. They are not
subject to the 26-volume limit imposed by drive letters, so you can use them
for access to more than 26 volumes on your computer.
<quote>
How NTFS Works
http://www.microsoft.com/technet/pr...Ref/8cc5891d-bf8e-4164-862d-dac5418c5948.mspx
3. What is the fundamental difference between chkdsk, chkntfs, and
autochk?

Description of Enhanced Chkdsk, Autochk, and Chkntfs Tools
http://support.microsoft.com/kb/218461

chkdsk.exe = Check Disk Utility. Creates and displays a status report for a
disk based on the file system. Chkdsk also lists and corrects errors on the
disk. Used without parameters, chkdsk displays the status of the disk in the
current drive.

chkntfs.exe = NTFS Volume Maitenance Utility. Displays or specifies whether
automatic system checking is scheduled to be run on a FAT, FAT32, or NTFS
volume when the computer is started.

autochk.exe = Auto Check Utility. Only runs at boot before Windows loads,
cannot be run in Win 32 mode. Every time Windows restarts, Autochk.exe is
called by the Kernel to scan all volumes to check if the volume dirty bit is
set. If the dirty bit is set, autochk performs an immediate chkdsk /f on
that volume. CHKDSK /f verifies file system integrity and attempts to fix
any problems with the volume.

<quote>
Autochk.exe is a version of Chkdsk that runs only before Windows XP starts.
Autochk runs in the following situations:

* Autochk runs if you try to run Chkdsk on the boot volume. Chkdsk cannot
dismount the boot volume, so Chkdsk offers to run the repair process by
using Autochk when the computer is restarted. If you press the Y key to
schedule Autochk, you have 10 seconds after the computer restarts to press
any key and cancel the repair process. If you cancel Autochk before the
10-second delay lapses, Autochk does not run the next time you restart the
computer. If you want to run Chkdsk again, you can do so from the command
line.

* Autochk runs if Chkdsk cannot gain exclusive use of the volume. If Chkdsk
cannot gain exclusive use of a volume when you run Chkdsk from the command
line, Chkdsk offers to dismount the volume. If you press the Y key and
Chkdsk still cannot dismount the volume, or if you press the N key, then
Chkdsk offers to run the repair process by using Autochk when the computer
is restarted. If you press the Y key to schedule Autochk, you have 10
seconds after the computer restarts to press any key and cancel the repair
process. If you cancel Autochk before the 10-second delay lapses, Autochk
does not run the next time you restart the computer. If you want to run
Chkdsk again, you can do so from the command line.

* Autochk runs if the volume is flagged as dirty. If the file system has
flagged the volume as dirty, Autochk runs the repair process at startup.
Volumes are flagged as dirty when the file system detects an error on the
volume. If Autochk detects a dirty volume, it provides a 10-second delay and
then begins the repair process. If you cancel Autochk when a volume is
dirty, Autochk attempts to run again after a 10-second delay each time the
computer is restarted.
<quote>
from...
Running Autochk When the Computer Restarts
4. Isn't there a utility or powertoy that can allow us to schedule
automated checks without playing Russian-Roulette with the registry?

How many machines are you talking about?

This schedules chkdsk for the next reboot.

Error Checking (chkdsk.exe).
1. In My Computer or Windows Explorer, right-click the drive you want to
check and then click Properties.
2. On the Tools tab, click Check Now.
3. Check both boxes:

* Automatically fix file system errors
* Scan for and attempt recovery of bad sectors

A message will popup.

[[The disk check could not be performed because the disk check utility needs
exclusive access to some Windows files on the disk. These files can be
accessed only by restarting Windows. Do you want to schedule this disk check
to occur the next time you restart the computer?]]

Click YES.

Chkdsk will run on the next reboot.

Use the chkntfs or the FSUTIL dirty commands to set or query the volume's
dirty bit (indicating corruption) so that Windows runs chkdsk when the
computer is restarted.
On volumes marked as "dirty," Windows automatically runs chkdsk when the
computer is restarted.

chkntfs /c volume:

The /c switch schedules the specified volume to be checked when the computer
starts.

volume: is the drive letter, C:

chkntfs /c c:

FSUTIL dirty set <volume pathname>

dirty set, sets the dirty bit.

FSUTIL dirty set c:

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
B

Blue Max

Thank you, Wes, the explanation was both comprehensive and helpful!

**********************
Wesley Vogel said:
In line.
1. Is a hard disk volume the same as a logical drive?

volume
[[An area of storage on a hard disk. A volume is formatted by using a file
system, such as FAT or NTFS, and has a drive letter assigned to it. You
can
view the contents of a volume by clicking its icon in Windows Explorer or
in
My Computer. A single hard disk can have multiple volumes, and volumes can
also span multiple disks.

See also: disk; drive letter; file allocation table (FAT); NTFS file
system;
simple volume; spanned volume]]

logical drive
[[A volume that you create within an extended partition on a basic master
boot record (MBR) disk. Logical drives are similar to primary partitions,
except that you are limited to four primary partitions per disk, whereas
you
can create an unlimited number of logical drives per disk. A logical drive
can be formatted and assigned a drive letter.

See also: basic disk; basic volume; drive letter; extended partition;
master
boot record (MBR); primary partition; volume]]

both from Windows Glossary in Help and Support.
2. What is a mount point?

mount point
[[Volume mount points and folder junctions allow an empty folder on an
NTFS
volume to point to the root or subfolder on another volume.]]

<quote>
Mount
In computers, to mount is to make a group of files in a file system
structure accessible to a user or user group. In some usages, it means to
make a device physically accessible. For instance, in data storage, to
mount
is to place a data medium (such as a tape cartridge) on a drive in a
position to operate. Macintosh calls it mounting when a user inserts a
disc
into the machine.

In a Unix environment, the mount command attaches discs, or directories
logically rather than physically. The Unix mount command makes a directory
accessible by attaching a root directory of one file system to another
directory, which makes all the file systems usable as if they were
subdirectories of the file system they are attached to. Unix recognizes
devices by their location, as compared to Windows, which recognizes them
by
their names (C: drive, for example). Unix organizes directories in a
tree-like structure, in which directories are attached by mounting them on
the branches of the tree. The file system location where the device is
attached is called a mount point.

Mounts may be local or remote. A local mount connects disc drives on one
machine so that they behave as one logical system. A remote mount uses
Network File System (NFS) to connect to directories on other machines so
that they can be used as if they were all part of the user's file system.
<quote>
Glossary from Diskeeper Corporation
http://www.diskeeper.com/glossary.asp?RId=1&SId=1&CId=1&Aeid=0&Apid=0

<quote>
Mounted Drives on NTFS Volumes
Mounted drives, also known as volume mount points or drive paths, are
volumes attached to an empty folder on an NTFS volume. Mounted drives
function the same way as any other volume, but are assigned a label or
name
instead of a drive letter. Mounted drives are robust against system
changes
that occur when devices are added or removed from a computer. They are not
subject to the 26-volume limit imposed by drive letters, so you can use
them
for access to more than 26 volumes on your computer.
<quote>
How NTFS Works
http://www.microsoft.com/technet/pr...Ref/8cc5891d-bf8e-4164-862d-dac5418c5948.mspx
3. What is the fundamental difference between chkdsk, chkntfs, and
autochk?

Description of Enhanced Chkdsk, Autochk, and Chkntfs Tools
http://support.microsoft.com/kb/218461

chkdsk.exe = Check Disk Utility. Creates and displays a status report for
a
disk based on the file system. Chkdsk also lists and corrects errors on
the
disk. Used without parameters, chkdsk displays the status of the disk in
the
current drive.

chkntfs.exe = NTFS Volume Maitenance Utility. Displays or specifies
whether
automatic system checking is scheduled to be run on a FAT, FAT32, or NTFS
volume when the computer is started.

autochk.exe = Auto Check Utility. Only runs at boot before Windows loads,
cannot be run in Win 32 mode. Every time Windows restarts, Autochk.exe is
called by the Kernel to scan all volumes to check if the volume dirty bit
is
set. If the dirty bit is set, autochk performs an immediate chkdsk /f on
that volume. CHKDSK /f verifies file system integrity and attempts to fix
any problems with the volume.

<quote>
Autochk.exe is a version of Chkdsk that runs only before Windows XP
starts.
Autochk runs in the following situations:

* Autochk runs if you try to run Chkdsk on the boot volume. Chkdsk cannot
dismount the boot volume, so Chkdsk offers to run the repair process by
using Autochk when the computer is restarted. If you press the Y key to
schedule Autochk, you have 10 seconds after the computer restarts to press
any key and cancel the repair process. If you cancel Autochk before the
10-second delay lapses, Autochk does not run the next time you restart the
computer. If you want to run Chkdsk again, you can do so from the command
line.

* Autochk runs if Chkdsk cannot gain exclusive use of the volume. If
Chkdsk
cannot gain exclusive use of a volume when you run Chkdsk from the command
line, Chkdsk offers to dismount the volume. If you press the Y key and
Chkdsk still cannot dismount the volume, or if you press the N key, then
Chkdsk offers to run the repair process by using Autochk when the computer
is restarted. If you press the Y key to schedule Autochk, you have 10
seconds after the computer restarts to press any key and cancel the repair
process. If you cancel Autochk before the 10-second delay lapses, Autochk
does not run the next time you restart the computer. If you want to run
Chkdsk again, you can do so from the command line.

* Autochk runs if the volume is flagged as dirty. If the file system has
flagged the volume as dirty, Autochk runs the repair process at startup.
Volumes are flagged as dirty when the file system detects an error on the
volume. If Autochk detects a dirty volume, it provides a 10-second delay
and
then begins the repair process. If you cancel Autochk when a volume is
dirty, Autochk attempts to run again after a 10-second delay each time the
computer is restarted.
<quote>
from...
Running Autochk When the Computer Restarts
4. Isn't there a utility or powertoy that can allow us to schedule
automated checks without playing Russian-Roulette with the registry?

How many machines are you talking about?

This schedules chkdsk for the next reboot.

Error Checking (chkdsk.exe).
1. In My Computer or Windows Explorer, right-click the drive you want to
check and then click Properties.
2. On the Tools tab, click Check Now.
3. Check both boxes:

* Automatically fix file system errors
* Scan for and attempt recovery of bad sectors

A message will popup.

[[The disk check could not be performed because the disk check utility
needs
exclusive access to some Windows files on the disk. These files can be
accessed only by restarting Windows. Do you want to schedule this disk
check
to occur the next time you restart the computer?]]

Click YES.

Chkdsk will run on the next reboot.

Use the chkntfs or the FSUTIL dirty commands to set or query the volume's
dirty bit (indicating corruption) so that Windows runs chkdsk when the
computer is restarted.
On volumes marked as "dirty," Windows automatically runs chkdsk when the
computer is restarted.

chkntfs /c volume:

The /c switch schedules the specified volume to be checked when the
computer
starts.

volume: is the drive letter, C:

chkntfs /c c:

FSUTIL dirty set <volume pathname>

dirty set, sets the dirty bit.

FSUTIL dirty set c:

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Blue Max said:
Thanks, Wesley, there appears to be a lot of good information here and it
will take me awhile to digest it all. Meantime, a few more novice
questions if we may:


Thanks

*************************
 
G

Guest

If you are working with Windows XP Home Edition, and shutdown in Hibernation
mode with a desktop PC will it wake up to run scheduled tasks?
--
dove


Wesley Vogel said:
In line.
1. Is a hard disk volume the same as a logical drive?

volume
[[An area of storage on a hard disk. A volume is formatted by using a file
system, such as FAT or NTFS, and has a drive letter assigned to it. You can
view the contents of a volume by clicking its icon in Windows Explorer or in
My Computer. A single hard disk can have multiple volumes, and volumes can
also span multiple disks.

See also: disk; drive letter; file allocation table (FAT); NTFS file system;
simple volume; spanned volume]]

logical drive
[[A volume that you create within an extended partition on a basic master
boot record (MBR) disk. Logical drives are similar to primary partitions,
except that you are limited to four primary partitions per disk, whereas you
can create an unlimited number of logical drives per disk. A logical drive
can be formatted and assigned a drive letter.

See also: basic disk; basic volume; drive letter; extended partition; master
boot record (MBR); primary partition; volume]]

both from Windows Glossary in Help and Support.
2. What is a mount point?

mount point
[[Volume mount points and folder junctions allow an empty folder on an NTFS
volume to point to the root or subfolder on another volume.]]

<quote>
Mount
In computers, to mount is to make a group of files in a file system
structure accessible to a user or user group. In some usages, it means to
make a device physically accessible. For instance, in data storage, to mount
is to place a data medium (such as a tape cartridge) on a drive in a
position to operate. Macintosh calls it mounting when a user inserts a disc
into the machine.

In a Unix environment, the mount command attaches discs, or directories
logically rather than physically. The Unix mount command makes a directory
accessible by attaching a root directory of one file system to another
directory, which makes all the file systems usable as if they were
subdirectories of the file system they are attached to. Unix recognizes
devices by their location, as compared to Windows, which recognizes them by
their names (C: drive, for example). Unix organizes directories in a
tree-like structure, in which directories are attached by mounting them on
the branches of the tree. The file system location where the device is
attached is called a mount point.

Mounts may be local or remote. A local mount connects disc drives on one
machine so that they behave as one logical system. A remote mount uses
Network File System (NFS) to connect to directories on other machines so
that they can be used as if they were all part of the user's file system.
<quote>
Glossary from Diskeeper Corporation
http://www.diskeeper.com/glossary.asp?RId=1&SId=1&CId=1&Aeid=0&Apid=0

<quote>
Mounted Drives on NTFS Volumes
Mounted drives, also known as volume mount points or drive paths, are
volumes attached to an empty folder on an NTFS volume. Mounted drives
function the same way as any other volume, but are assigned a label or name
instead of a drive letter. Mounted drives are robust against system changes
that occur when devices are added or removed from a computer. They are not
subject to the 26-volume limit imposed by drive letters, so you can use them
for access to more than 26 volumes on your computer.
<quote>
How NTFS Works
http://www.microsoft.com/technet/pr...Ref/8cc5891d-bf8e-4164-862d-dac5418c5948.mspx
3. What is the fundamental difference between chkdsk, chkntfs, and
autochk?

Description of Enhanced Chkdsk, Autochk, and Chkntfs Tools
http://support.microsoft.com/kb/218461

chkdsk.exe = Check Disk Utility. Creates and displays a status report for a
disk based on the file system. Chkdsk also lists and corrects errors on the
disk. Used without parameters, chkdsk displays the status of the disk in the
current drive.

chkntfs.exe = NTFS Volume Maitenance Utility. Displays or specifies whether
automatic system checking is scheduled to be run on a FAT, FAT32, or NTFS
volume when the computer is started.

autochk.exe = Auto Check Utility. Only runs at boot before Windows loads,
cannot be run in Win 32 mode. Every time Windows restarts, Autochk.exe is
called by the Kernel to scan all volumes to check if the volume dirty bit is
set. If the dirty bit is set, autochk performs an immediate chkdsk /f on
that volume. CHKDSK /f verifies file system integrity and attempts to fix
any problems with the volume.

<quote>
Autochk.exe is a version of Chkdsk that runs only before Windows XP starts.
Autochk runs in the following situations:

* Autochk runs if you try to run Chkdsk on the boot volume. Chkdsk cannot
dismount the boot volume, so Chkdsk offers to run the repair process by
using Autochk when the computer is restarted. If you press the Y key to
schedule Autochk, you have 10 seconds after the computer restarts to press
any key and cancel the repair process. If you cancel Autochk before the
10-second delay lapses, Autochk does not run the next time you restart the
computer. If you want to run Chkdsk again, you can do so from the command
line.

* Autochk runs if Chkdsk cannot gain exclusive use of the volume. If Chkdsk
cannot gain exclusive use of a volume when you run Chkdsk from the command
line, Chkdsk offers to dismount the volume. If you press the Y key and
Chkdsk still cannot dismount the volume, or if you press the N key, then
Chkdsk offers to run the repair process by using Autochk when the computer
is restarted. If you press the Y key to schedule Autochk, you have 10
seconds after the computer restarts to press any key and cancel the repair
process. If you cancel Autochk before the 10-second delay lapses, Autochk
does not run the next time you restart the computer. If you want to run
Chkdsk again, you can do so from the command line.

* Autochk runs if the volume is flagged as dirty. If the file system has
flagged the volume as dirty, Autochk runs the repair process at startup.
Volumes are flagged as dirty when the file system detects an error on the
volume. If Autochk detects a dirty volume, it provides a 10-second delay and
then begins the repair process. If you cancel Autochk when a volume is
dirty, Autochk attempts to run again after a 10-second delay each time the
computer is restarted.
<quote>
from...
Running Autochk When the Computer Restarts
4. Isn't there a utility or powertoy that can allow us to schedule
automated checks without playing Russian-Roulette with the registry?

How many machines are you talking about?

This schedules chkdsk for the next reboot.

Error Checking (chkdsk.exe).
1. In My Computer or Windows Explorer, right-click the drive you want to
check and then click Properties.
2. On the Tools tab, click Check Now.
3. Check both boxes:

* Automatically fix file system errors
* Scan for and attempt recovery of bad sectors

A message will popup.

[[The disk check could not be performed because the disk check utility needs
exclusive access to some Windows files on the disk. These files can be
accessed only by restarting Windows. Do you want to schedule this disk check
to occur the next time you restart the computer?]]

Click YES.

Chkdsk will run on the next reboot.

Use the chkntfs or the FSUTIL dirty commands to set or query the volume's
dirty bit (indicating corruption) so that Windows runs chkdsk when the
computer is restarted.
On volumes marked as "dirty," Windows automatically runs chkdsk when the
computer is restarted.

chkntfs /c volume:

The /c switch schedules the specified volume to be checked when the computer
starts.

volume: is the drive letter, C:

chkntfs /c c:

FSUTIL dirty set <volume pathname>

dirty set, sets the dirty bit.

FSUTIL dirty set c:

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Blue Max said:
Thanks, Wesley, there appears to be a lot of good information here and it
will take me awhile to digest it all. Meantime, a few more novice
questions if we may:


Thanks

*************************
 
W

Wesley Vogel

From XP HELP...

To set power management options for a scheduled task
1. Open Scheduled Tasks.
2. Right-click the task for which you want to set power management options,
and then click Properties.
3. On the Settings tab, under Power Management, do one or more of the
following:
* To conserve the battery power of your computer, select the Don't start
the task if the computer is running on batteries check box.
* To stop the task if the computer starts running on battery power,
select the Stop the task if battery mode begins check box.
* To wake your computer to run a task if the computer is running on
battery power, select the Wake the computer to run this task check box.
(This option is only available on computers that support it.)

Notes
* To open Scheduled Tasks, click Start, point to Programs, point to
Accessories, point to System Tools, and then click Scheduled Tasks.
* By default, power management is set to refrain from starting scheduled
tasks if the computer is running on battery power. If you are using a
portable computer that runs on batteries, and you want a scheduled task to
run, clear the default check boxes.
* If the power is interrupted or if the battery fails, the scheduled task
that is running might not complete.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
dove said:
If you are working with Windows XP Home Edition, and shutdown in
Hibernation mode with a desktop PC will it wake up to run scheduled tasks?
--
dove


Wesley Vogel said:
In line.
1. Is a hard disk volume the same as a logical drive?

volume
[[An area of storage on a hard disk. A volume is formatted by using a
file system, such as FAT or NTFS, and has a drive letter assigned to it.
You can view the contents of a volume by clicking its icon in Windows
Explorer or in My Computer. A single hard disk can have multiple
volumes, and volumes can also span multiple disks.

See also: disk; drive letter; file allocation table (FAT); NTFS file
system; simple volume; spanned volume]]

logical drive
[[A volume that you create within an extended partition on a basic master
boot record (MBR) disk. Logical drives are similar to primary partitions,
except that you are limited to four primary partitions per disk, whereas
you can create an unlimited number of logical drives per disk. A logical
drive can be formatted and assigned a drive letter.

See also: basic disk; basic volume; drive letter; extended partition;
master boot record (MBR); primary partition; volume]]

both from Windows Glossary in Help and Support.
2. What is a mount point?

mount point
[[Volume mount points and folder junctions allow an empty folder on an
NTFS volume to point to the root or subfolder on another volume.]]

<quote>
Mount
In computers, to mount is to make a group of files in a file system
structure accessible to a user or user group. In some usages, it means to
make a device physically accessible. For instance, in data storage, to
mount is to place a data medium (such as a tape cartridge) on a drive in
a position to operate. Macintosh calls it mounting when a user inserts a
disc into the machine.

In a Unix environment, the mount command attaches discs, or directories
logically rather than physically. The Unix mount command makes a
directory accessible by attaching a root directory of one file system to
another directory, which makes all the file systems usable as if they
were subdirectories of the file system they are attached to. Unix
recognizes devices by their location, as compared to Windows, which
recognizes them by their names (C: drive, for example). Unix organizes
directories in a tree-like structure, in which directories are attached
by mounting them on the branches of the tree. The file system location
where the device is attached is called a mount point.

Mounts may be local or remote. A local mount connects disc drives on one
machine so that they behave as one logical system. A remote mount uses
Network File System (NFS) to connect to directories on other machines so
that they can be used as if they were all part of the user's file system.
<quote>
Glossary from Diskeeper Corporation
http://www.diskeeper.com/glossary.asp?RId=1&SId=1&CId=1&Aeid=0&Apid=0

<quote>
Mounted Drives on NTFS Volumes
Mounted drives, also known as volume mount points or drive paths, are
volumes attached to an empty folder on an NTFS volume. Mounted drives
function the same way as any other volume, but are assigned a label or
name instead of a drive letter. Mounted drives are robust against system
changes that occur when devices are added or removed from a computer.
They are not subject to the 26-volume limit imposed by drive letters, so
you can use them for access to more than 26 volumes on your computer.
<quote>
How NTFS Works
http://www.microsoft.com/technet/pr...Ref/8cc5891d-bf8e-4164-862d-dac5418c5948.mspx
3. What is the fundamental difference between chkdsk, chkntfs, and
autochk?

Description of Enhanced Chkdsk, Autochk, and Chkntfs Tools
http://support.microsoft.com/kb/218461

chkdsk.exe = Check Disk Utility. Creates and displays a status report
for a disk based on the file system. Chkdsk also lists and corrects
errors on the disk. Used without parameters, chkdsk displays the status
of the disk in the current drive.

chkntfs.exe = NTFS Volume Maitenance Utility. Displays or specifies
whether automatic system checking is scheduled to be run on a FAT,
FAT32, or NTFS volume when the computer is started.

autochk.exe = Auto Check Utility. Only runs at boot before Windows
loads, cannot be run in Win 32 mode. Every time Windows restarts,
Autochk.exe is called by the Kernel to scan all volumes to check if the
volume dirty bit is set. If the dirty bit is set, autochk performs an
immediate chkdsk /f on that volume. CHKDSK /f verifies file system
integrity and attempts to fix any problems with the volume.

<quote>
Autochk.exe is a version of Chkdsk that runs only before Windows XP
starts. Autochk runs in the following situations:

* Autochk runs if you try to run Chkdsk on the boot volume. Chkdsk cannot
dismount the boot volume, so Chkdsk offers to run the repair process by
using Autochk when the computer is restarted. If you press the Y key to
schedule Autochk, you have 10 seconds after the computer restarts to
press any key and cancel the repair process. If you cancel Autochk
before the 10-second delay lapses, Autochk does not run the next time
you restart the computer. If you want to run Chkdsk again, you can do so
from the command line.

* Autochk runs if Chkdsk cannot gain exclusive use of the volume. If
Chkdsk cannot gain exclusive use of a volume when you run Chkdsk from
the command line, Chkdsk offers to dismount the volume. If you press the
Y key and Chkdsk still cannot dismount the volume, or if you press the N
key, then Chkdsk offers to run the repair process by using Autochk when
the computer is restarted. If you press the Y key to schedule Autochk,
you have 10 seconds after the computer restarts to press any key and
cancel the repair process. If you cancel Autochk before the 10-second
delay lapses, Autochk does not run the next time you restart the
computer. If you want to run Chkdsk again, you can do so from the
command line.

* Autochk runs if the volume is flagged as dirty. If the file system has
flagged the volume as dirty, Autochk runs the repair process at startup.
Volumes are flagged as dirty when the file system detects an error on the
volume. If Autochk detects a dirty volume, it provides a 10-second delay
and then begins the repair process. If you cancel Autochk when a volume
is dirty, Autochk attempts to run again after a 10-second delay each
time the computer is restarted.
<quote>
from...
Running Autochk When the Computer Restarts
4. Isn't there a utility or powertoy that can allow us to schedule
automated checks without playing Russian-Roulette with the registry?

How many machines are you talking about?

This schedules chkdsk for the next reboot.

Error Checking (chkdsk.exe).
1. In My Computer or Windows Explorer, right-click the drive you want to
check and then click Properties.
2. On the Tools tab, click Check Now.
3. Check both boxes:

* Automatically fix file system errors
* Scan for and attempt recovery of bad sectors

A message will popup.

[[The disk check could not be performed because the disk check utility
needs exclusive access to some Windows files on the disk. These files
can be accessed only by restarting Windows. Do you want to schedule this
disk check to occur the next time you restart the computer?]]

Click YES.

Chkdsk will run on the next reboot.

Use the chkntfs or the FSUTIL dirty commands to set or query the volume's
dirty bit (indicating corruption) so that Windows runs chkdsk when the
computer is restarted.
On volumes marked as "dirty," Windows automatically runs chkdsk when the
computer is restarted.

chkntfs /c volume:

The /c switch schedules the specified volume to be checked when the
computer starts.

volume: is the drive letter, C:

chkntfs /c c:

FSUTIL dirty set <volume pathname>

dirty set, sets the dirty bit.

FSUTIL dirty set c:

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Blue Max said:
Thanks, Wesley, there appears to be a lot of good information here and
it will take me awhile to digest it all. Meantime, a few more novice
questions if we may:


Thanks

*************************
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
Value Name: BootExecute
Data Type: REG_MULTI_SZ
Value Data: autocheck autochk /r \??\C:

chkdsk c: /f /r
adds the following entry to the BootExecute value:

autocheck autochk /r \??\C:

from...
CHKNTFS.EXE: What You Can Use It For
http://support.microsoft.com/kb/160963

So does running the Check Disk tool from Drive Properties.
Right click Drive | Properties | Tools tab | Check Now button |
Select both boxes in Check Disk Local Disk (C:)

<quote>
Registry value Function
-------------------------------------------------------------------------
--- /P \??\Volume: Schedules an unconditional Chkdsk against
the volume.
/p \??\VOLUME{GUID} Schedules an unconditional Chkdsk against a volume
mount point.
/k:Volume * Excludes Chkdsk from running against the
volume. /m \??\Volume: Tells Autochk to look only at the
dirty bit on the
volume, and if set, run Chkdsk.

Sample command Resulting registry entry
-------------------------------------------------------------------------
Chkdsk C: /F Autocheck autochk /p \??\C:
Chkdsk C:\mountpoint /F Autocheck autochk /p \??\VOLUME{GUID}
Chkntfs D: E: /X Autocheck autochk /k:D /k:E *
Chkntfs G: /C Autocheck autochk /m \??\G:
<quote>
from...
Description of Enhanced Chkdsk, Autochk, and Chkntfs Tools in Windows
2000 http://support.microsoft.com/kb/218461

<quote>
BootExecute Data Item
The BootExecute data item contains one or more commands that Session
Manager
runs before it loads any services. The default value for this item is
Autochk.exe, which is the Windows NT version of Chkdsk.exe. The default
setting is shown in this example:

BootExecute : REG_MULTI_SZ : autocheck autochk*
<quote>
from...
Windows NT Workstation Resource Kit: What Happens When You Start Your
Computer
http://www.microsoft.com/technet/archive/ntwrkstn/reskit/booting.mspx?mfr=true

If Chkdsk is to run in write-mode to attempt to remedy corruption, in
most cases, there will be locked files and it requires restarting to
have exclusive access to the partition or partitions. This process can
be automated and requires no user intervention. Usually, a user needs
to press
"y" to schedule Chkdsk to run in write-mode on the next restart;
however, this process can be automated as follows:

@echo off
echo y|chkdsk C: /f/r

How to Automate Chkdsk
http://support.microsoft.com/kb/197527

http://www.ericphelps.com/batch/samples/today.bat.txt

For Chkdsk help...
Paste the following line into Start | Run and click OK...

hh ntcmds.chm::/chkdsk.htm

You could use the chkntfs or the FSUTIL dirty commands to set or query
the volume's dirty bit (indicating corruption) so that Windows runs
chkdsk when
the computer is restarted. On volumes marked as "dirty," Windows
automatically runs chkdsk when the computer is restarted.

chkntfs c: /c

/C
Schedules a drive to be checked at boot time; chkdsk will run if the
drive is dirty.

chkntfs /?
and
hh ntcmds.chm::/chkntfs.htm

FSUTIL dirty set c:

FSUTIL /?
and
hh ntcmds.chm::/fsutil_dirty.htm

If the command for the day requires user input, for
example, you have to hit enter or answer yes or no,
you should run a separate batch file instead of
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top