Scandisk & Defragmenting

G

Guest

Dear All,

Dose anyone know how to control scandisk and defragmenter on WinXP and Win2k
OS systems centrally. What I'm trying to achieve is a schedule for these
tools to run on scheduled basis as a part of file system maintenance.

Any ideas? I have see a few 3rd party software which deal with these issues,
but I wane know if there is a cheaper solution for this.

Thank you.
 
W

Wesley Vogel

scandisk does not exist on XP or Win2k, chkdsk.exe is used instead.

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.

Also type: defrag /? in a command prompt for help.

Description of the New Command Line Defrag.exe Included with Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;283080

How To Schedule Tasks in Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;308569

How to Defragment Your Disk Drive Volumes in Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;314848

----------

As far as I know, you can only schedule a chkdsk on a reboot. Running
chkdsk without rebooting (chkdsk in read-only mode) is a waste of time.

To schedule chkdsk...

Scandisk has been retired. Use Error Checking (chkdsk.exe) in XP.

1. In My Computer or Windows Explorer, right-click the volume you want to
check, and then click Properties.
2. On the Tools tab, click Check Now.
3. Select both of these:

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

You have to reboot for Error-checking to run.

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.

Then reboot.

For a look at the chkdsk log.

Open the Event Viewer...
Start | Run | Type: eventvwr | Click OK |
Look in Application | Listed as Information |
Event ID: 1001
Source: Winlogon
[[Description: This includes file system type; drive letter or GUID, and
volume name or serial number to help determine what volume Chkdsk ran
against. Also included is whether Chkdsk ran because a user scheduled it or
because the dirty bit was set.]]

[[When Autochk runs against a volume at boot time it records its output to a
file called Bootex.log in the root of the volume being checked. The Winlogon
service then moves the contents of each Bootex.log file to the Application
Event log.]]

[[This file states whether Chkdsk encountered any errors and, if so,
whether they were fixed.]]

Also type: chkdsk /? in a command prompt for help.


--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
G

Guest

Dear Wesley,

Thanks for the info. You write scandisk is not used anymore in XP, I'm still
using the old name when I'm referring to check disk. However, the articles
below are not exactly what I'm looking for. The problem is how to configure
that say 600 computers with least administrative effort, without having to go
to each computer and scheduling a task which will accomplish this. I was more
thinking of a VBscript ore batch file which will schedule this that say once
a month, thru GPO logon script ore something similar.

Since I'm a dummy in writing scripts I would appreciate a hint on this.

Thank you

Bujar Lushta
CCNA, MCP


Wesley Vogel said:
scandisk does not exist on XP or Win2k, chkdsk.exe is used instead.

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.

Also type: defrag /? in a command prompt for help.

Description of the New Command Line Defrag.exe Included with Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;283080

How To Schedule Tasks in Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;308569

How to Defragment Your Disk Drive Volumes in Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;314848

----------

As far as I know, you can only schedule a chkdsk on a reboot. Running
chkdsk without rebooting (chkdsk in read-only mode) is a waste of time.

To schedule chkdsk...

Scandisk has been retired. Use Error Checking (chkdsk.exe) in XP.

1. In My Computer or Windows Explorer, right-click the volume you want to
check, and then click Properties.
2. On the Tools tab, click Check Now.
3. Select both of these:

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

You have to reboot for Error-checking to run.

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.

Then reboot.

For a look at the chkdsk log.

Open the Event Viewer...
Start | Run | Type: eventvwr | Click OK |
Look in Application | Listed as Information |
Event ID: 1001
Source: Winlogon
[[Description: This includes file system type; drive letter or GUID, and
volume name or serial number to help determine what volume Chkdsk ran
against. Also included is whether Chkdsk ran because a user scheduled it or
because the dirty bit was set.]]

[[When Autochk runs against a volume at boot time it records its output to a
file called Bootex.log in the root of the volume being checked. The Winlogon
service then moves the contents of each Bootex.log file to the Application
Event log.]]

[[This file states whether Chkdsk encountered any errors and, if so,
whether they were fixed.]]

Also type: chkdsk /? in a command prompt for help.


--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
lushtanet said:
Dear All,

Dose anyone know how to control scandisk and defragmenter on WinXP and
Win2k OS systems centrally. What I'm trying to achieve is a schedule for
these tools to run on scheduled basis as a part of file system
maintenance.

Any ideas? I have see a few 3rd party software which deal with these
issues, but I wane know if there is a cheaper solution for this.

Thank you.
 
W

Wesley Vogel

Hi Bob,

I'm still using your old name, Bujar. ;-)

Here's a vbs script for defrag.

defrag_all2.vbs - Defrag All Hard Drives - Can be run as a scheduled task
© Doug Knox - rev 03/29/2002
http://www.dougknox.com/utility/scripts_desc/defrag_all.htm


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

The value autocheck autochk /r \??\C: is what's added to the registry to
schedule autochk.exe to run at boot on drive C:. Autochk.exe is a version
of Chkdsk that runs only before Windows XP starts.

The command

chkdsk c: /f /r

adds the following entry to the BootExecute value:

autocheck autochk /r \??\C:

That's the same value that's added by 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:)

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

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

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

hh ntcmds.chm::/defrag.htm

You can also type: chkdsk /? and defrag /? in a command prompt for
help.

Or maybe you could use reg.exe to add the registry value.

You could use REG ADD with the /v switch to add autocheck autochk /r \??\C:
to BootExecute

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager /v BootExecute /t
REG_MULTI_SZ /d autocheck autochk /r \??\C:

Type: REG ADD /? in a command prompt for help.

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

hh ntcmds.chm::/reg.htm

How to schedule a CHKDSK on every boot
http://www.jsifaq.com/SF/Tips/Tip.aspx?id=0058

AutoDefrag freeware allows scheduling the Windows 2000 defragger
http://www.jsifaq.com/SF/Tips/Tip.aspx?id=8414

Windows XP has a command line defragmenter that you can schedule
http://www.jsifaq.com/SF/Tips/Tip.aspx?id=4383

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
lushtanet said:
Dear Wesley,

Thanks for the info. You write scandisk is not used anymore in XP, I'm
still using the old name when I'm referring to check disk. However, the
articles below are not exactly what I'm looking for. The problem is how
to configure that say 600 computers with least administrative effort,
without having to go to each computer and scheduling a task which will
accomplish this. I was more thinking of a VBscript ore batch file which
will schedule this that say once a month, thru GPO logon script ore
something similar.

Since I'm a dummy in writing scripts I would appreciate a hint on this.

Thank you

Bujar Lushta
CCNA, MCP


Wesley Vogel said:
scandisk does not exist on XP or Win2k, chkdsk.exe is used instead.

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.

Also type: defrag /? in a command prompt for help.

Description of the New Command Line Defrag.exe Included with Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;283080

How To Schedule Tasks in Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;308569

How to Defragment Your Disk Drive Volumes in Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;314848

----------

As far as I know, you can only schedule a chkdsk on a reboot. Running
chkdsk without rebooting (chkdsk in read-only mode) is a waste of time.

To schedule chkdsk...

Scandisk has been retired. Use Error Checking (chkdsk.exe) in XP.

1. In My Computer or Windows Explorer, right-click the volume you want to
check, and then click Properties.
2. On the Tools tab, click Check Now.
3. Select both of these:

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

You have to reboot for Error-checking to run.

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.

Then reboot.

For a look at the chkdsk log.

Open the Event Viewer...
Start | Run | Type: eventvwr | Click OK |
Look in Application | Listed as Information |
Event ID: 1001
Source: Winlogon
[[Description: This includes file system type; drive letter or GUID, and
volume name or serial number to help determine what volume Chkdsk ran
against. Also included is whether Chkdsk ran because a user scheduled
it or because the dirty bit was set.]]

[[When Autochk runs against a volume at boot time it records its output
to a file called Bootex.log in the root of the volume being checked. The
Winlogon service then moves the contents of each Bootex.log file to the
Application Event log.]]

[[This file states whether Chkdsk encountered any errors and, if so,
whether they were fixed.]]

Also type: chkdsk /? in a command prompt for help.


--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
lushtanet said:
Dear All,

Dose anyone know how to control scandisk and defragmenter on WinXP and
Win2k OS systems centrally. What I'm trying to achieve is a schedule for
these tools to run on scheduled basis as a part of file system
maintenance.

Any ideas? I have see a few 3rd party software which deal with these
issues, but I wane know if there is a cheaper solution for this.

Thank you.
 

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