Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > Computer Support > Setting Scheduled Tasks To Defrag Disk

Reply
Thread Tools

Setting Scheduled Tasks To Defrag Disk

 
 
Phyllis
Guest
Posts: n/a
 
      01-23-2004
I use Windows XP. When I use the schedule task wizard, disk degragmenting
is not a choice in my list. I've already got disk cleanup scheduled but
there isn't a choice to defrag. However, I can still go under accessories
and it is under my system tools right under disk clean up.

Is this something I will have to remember to do manually in XP (defrag) or
is there a way I can get disk defrag to appear in my list of choices when
I'm using the wizard? I hope this makes sense!

Thanks,
DD


 
Reply With Quote
 
 
 
 
Harrison
Guest
Posts: n/a
 
      01-23-2004
Executive Software's Diskeeper will do what you want.
http://www.executive.com/downloads/menu.asp

On Fri, 23 Jan 2004 02:08:05 GMT, "Phyllis" <(E-Mail Removed)>
wrote:

>I use Windows XP. When I use the schedule task wizard, disk degragmenting
>is not a choice in my list. I've already got disk cleanup scheduled but
>there isn't a choice to defrag. However, I can still go under accessories
>and it is under my system tools right under disk clean up.
>
>Is this something I will have to remember to do manually in XP (defrag) or
>is there a way I can get disk defrag to appear in my list of choices when
>I'm using the wizard? I hope this makes sense!
>
>Thanks,
>DD
>


 
Reply With Quote
 
 
 
 
pcbutts1
Guest
Posts: n/a
 
      01-23-2004
Cut and paste everything between the lines below into notepad and save it as
a .vbs file. Save on your hard drive somewhere. Using task scheduler browse
to the saved file and schedule it to run. This vbs file will defrag all your
hard drives and create a log. This file was created by Doug Knox Microsoft
MVP.

CUT BELOW HERE

************************************************** **************************
*********************

'defrag_all2.vbs
'Defrags all hard disks - Can be run as a Scheduled Task



Option Explicit

Dim WshShell, fso, d, dc, ErrStr(), Return, X, A(), MyFile, I, MyBox, Drive

Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
X = 0

Set dc = fso.Drives
For Each d in DC
If d.DriveType = 2 Then
X = X + 1

'Determine drive letter of first fixed disk
'This is the drive that the error report will be placed on
If X = 1 Then
Drive = d
End If
End If
Next

ReDim A(X)
ReDim ErrStr(X)

X = 0
For Each d in dc
If d.DriveType = 2 Then
X = X + 1
Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)

'Determine the Error code returned by Defrag for the current drive and save
it
If return = 0 then
ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag completed successfully" &
vbCRLF
elseif return = 1 then
ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level
" & return & " (defrag was cancelled manually) " & vbCRLF
elseif return = 2 then
ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level
" & return & " (there was a command line error. Check your command line for
valid

switches and drives)" & vbCRLF
elseif return = 3 then
ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level
" & return & " (there was an unknown error)" & vbCRLF
elseif return = 4 then
ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level
" & return & " (defrag could not run due to insufficient memory resources)"
&

vbCRLF
'errorlevel 5 is not currently used
elseif return = 5 then
ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level
" & return & " (general error)" & vbCRLF
elseif return = 6 then
ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level
" & return & "(System error: either the account used to run defrag is not an

administrator, there is a problem loading the resource DLL, or a defrag
engine could not be accessed. Check for proper user permissions and run
Sfc.exe to

validate system files)" & vbCRLF
elseif return = 7 then
ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level
" & return & " (There is not enough free space on the drive. Defrag needs
15%

free space to run on a volume)" & vbCRLF
else
ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with an unknown
error level: " & return & vbCRLF
end if

End If
Next

'Create the Error Report in the root of the first fixed disk.
Set MyFile = fso.OpenTextFile(Drive & "\defragreport.txt", 2, True)
MyFile.WriteLine(Date) & vbCRLF
MyFile.WriteLine(Time) & vbCRLF
For I = 1 to X
MyFile.WriteLine(ErrStr(I))
Next
MyFile.Close

Return = WshShell.Run(Drive & "\defragreport.txt",3,True)

Set WshShell = Nothing
Set fso = Nothing

************************************************** **************************
************************
CUT ABOVE THIS LINE.


--


The best live web video on the internet http://www.seedsv.com/webdemo.htm
Sharpvision simply the best http://www.seedsv.com



"Phyllis" <(E-Mail Removed)> wrote in message
news:9m%Pb.7710$(E-Mail Removed) ...
> I use Windows XP. When I use the schedule task wizard, disk degragmenting
> is not a choice in my list. I've already got disk cleanup scheduled but
> there isn't a choice to defrag. However, I can still go under accessories
> and it is under my system tools right under disk clean up.
>
> Is this something I will have to remember to do manually in XP (defrag) or
> is there a way I can get disk defrag to appear in my list of choices when
> I'm using the wizard? I hope this makes sense!
>
> Thanks,
> DD
>
>



 
Reply With Quote
 
Senti
Guest
Posts: n/a
 
      01-23-2004
Phyllis did mumble 9m%Pb.7710$(E-Mail Removed)...

> I use Windows XP. When I use the schedule task wizard, disk
> degragmenting is not a choice in my list. I've already got disk
> cleanup scheduled but there isn't a choice to defrag. However, I can
> still go under accessories and it is under my system tools right
> under disk clean up.
>
> Is this something I will have to remember to do manually in XP
> (defrag) or is there a way I can get disk defrag to appear in my list
> of choices when I'm using the wizard? I hope this makes sense!
>
> Thanks,
> DD



Read here:
http://www.microsoft.com/windowsxp/e.../october08.asp
or the TinyURL:
http://tinyurl.com/enqp

It's about half way down the page.

Note: "Only one instance of Disk Defragmenter can be running at any given
time, so if you have multiple partitions, you'll need to add a separate
scheduled task for each one."
--
~SF~
Murder is always a mistake. One should never do anything that one
cannot talk about after dinner. -Oscar Wilde


 
Reply With Quote
 
pcbutts1
Guest
Posts: n/a
 
      01-23-2004
This does not work.

--


The best live web video on the internet http://www.seedsv.com/webdemo.htm
Sharpvision simply the best http://www.seedsv.com



"Senti" <(E-Mail Removed)> wrote in message
news:burm9a$lhcl0$(E-Mail Removed)-berlin.de...
> Phyllis did mumble 9m%Pb.7710$(E-Mail Removed)...
>
> > I use Windows XP. When I use the schedule task wizard, disk
> > degragmenting is not a choice in my list. I've already got disk
> > cleanup scheduled but there isn't a choice to defrag. However, I can
> > still go under accessories and it is under my system tools right
> > under disk clean up.
> >
> > Is this something I will have to remember to do manually in XP
> > (defrag) or is there a way I can get disk defrag to appear in my list
> > of choices when I'm using the wizard? I hope this makes sense!
> >
> > Thanks,
> > DD

>
>
> Read here:
>

http://www.microsoft.com/windowsxp/e.../october08.asp
> or the TinyURL:
> http://tinyurl.com/enqp
>
> It's about half way down the page.
>
> Note: "Only one instance of Disk Defragmenter can be running at any given
> time, so if you have multiple partitions, you'll need to add a separate
> scheduled task for each one."
> --
> ~SF~
> Murder is always a mistake. One should never do anything that one
> cannot talk about after dinner. -Oscar Wilde
>
>



 
Reply With Quote
 
Phyllis
Guest
Posts: n/a
 
      01-24-2004
Thanks! I'll give this a try.

"pcbutts1" <(E-Mail Removed)> wrote in message
news:5G%Pb.23863$(E-Mail Removed) hlink.net...
> Cut and paste everything between the lines below into notepad and save it

as
> a .vbs file. Save on your hard drive somewhere. Using task scheduler

browse
> to the saved file and schedule it to run. This vbs file will defrag all

your
> hard drives and create a log. This file was created by Doug Knox Microsoft
> MVP.
>
> CUT BELOW HERE
>
>

************************************************** **************************
> *********************
>
> 'defrag_all2.vbs
> 'Defrags all hard disks - Can be run as a Scheduled Task
>
>
>
> Option Explicit
>
> Dim WshShell, fso, d, dc, ErrStr(), Return, X, A(), MyFile, I, MyBox,

Drive
>
> Set WshShell = WScript.CreateObject("WScript.Shell")
> Set fso = CreateObject("Scripting.FileSystemObject")
> X = 0
>
> Set dc = fso.Drives
> For Each d in DC
> If d.DriveType = 2 Then
> X = X + 1
>
> 'Determine drive letter of first fixed disk
> 'This is the drive that the error report will be placed on
> If X = 1 Then
> Drive = d
> End If
> End If
> Next
>
> ReDim A(X)
> ReDim ErrStr(X)
>
> X = 0
> For Each d in dc
> If d.DriveType = 2 Then
> X = X + 1
> Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)
>
> 'Determine the Error code returned by Defrag for the current drive and

save
> it
> If return = 0 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag completed successfully"

&
> vbCRLF
> elseif return = 1 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (defrag was cancelled manually) " & vbCRLF
> elseif return = 2 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (there was a command line error. Check your command line

for
> valid
>
> switches and drives)" & vbCRLF
> elseif return = 3 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (there was an unknown error)" & vbCRLF
> elseif return = 4 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (defrag could not run due to insufficient memory

resources)"
> &
>
> vbCRLF
> 'errorlevel 5 is not currently used
> elseif return = 5 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (general error)" & vbCRLF
> elseif return = 6 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & "(System error: either the account used to run defrag is not

an
>
> administrator, there is a problem loading the resource DLL, or a defrag
> engine could not be accessed. Check for proper user permissions and run
> Sfc.exe to
>
> validate system files)" & vbCRLF
> elseif return = 7 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (There is not enough free space on the drive. Defrag needs
> 15%
>
> free space to run on a volume)" & vbCRLF
> else
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with an unknown
> error level: " & return & vbCRLF
> end if
>
> End If
> Next
>
> 'Create the Error Report in the root of the first fixed disk.
> Set MyFile = fso.OpenTextFile(Drive & "\defragreport.txt", 2, True)
> MyFile.WriteLine(Date) & vbCRLF
> MyFile.WriteLine(Time) & vbCRLF
> For I = 1 to X
> MyFile.WriteLine(ErrStr(I))
> Next
> MyFile.Close
>
> Return = WshShell.Run(Drive & "\defragreport.txt",3,True)
>
> Set WshShell = Nothing
> Set fso = Nothing
>
>

************************************************** **************************
> ************************
> CUT ABOVE THIS LINE.
>
>
> --
>
>
> The best live web video on the internet http://www.seedsv.com/webdemo.htm
> Sharpvision simply the best http://www.seedsv.com
>
>
>
> "Phyllis" <(E-Mail Removed)> wrote in message
> news:9m%Pb.7710$(E-Mail Removed) ...
> > I use Windows XP. When I use the schedule task wizard, disk

degragmenting
> > is not a choice in my list. I've already got disk cleanup scheduled but
> > there isn't a choice to defrag. However, I can still go under

accessories
> > and it is under my system tools right under disk clean up.
> >
> > Is this something I will have to remember to do manually in XP (defrag)

or
> > is there a way I can get disk defrag to appear in my list of choices

when
> > I'm using the wizard? I hope this makes sense!
> >
> > Thanks,
> > DD
> >
> >

>
>



 
Reply With Quote
 
Phyllis
Guest
Posts: n/a
 
      01-24-2004
I did as you said and crossed my fingers when it was set to run. It did
start but I received an error message. I'm not a computer guru but is this
something I can fix easily. Error message as follows:

Line: 39
Char: 77
Error: Syntax error
Code: 800A03EA
Source: Microsoft VBScript compilation error

Thanks



"pcbutts1" <(E-Mail Removed)> wrote in message
news:5G%Pb.23863$(E-Mail Removed) hlink.net...
> Cut and paste everything between the lines below into notepad and save it

as
> a .vbs file. Save on your hard drive somewhere. Using task scheduler

browse
> to the saved file and schedule it to run. This vbs file will defrag all

your
> hard drives and create a log. This file was created by Doug Knox Microsoft
> MVP.
>
> CUT BELOW HERE
>
>

************************************************** **************************
> *********************
>
> 'defrag_all2.vbs
> 'Defrags all hard disks - Can be run as a Scheduled Task
>
>
>
> Option Explicit
>
> Dim WshShell, fso, d, dc, ErrStr(), Return, X, A(), MyFile, I, MyBox,

Drive
>
> Set WshShell = WScript.CreateObject("WScript.Shell")
> Set fso = CreateObject("Scripting.FileSystemObject")
> X = 0
>
> Set dc = fso.Drives
> For Each d in DC
> If d.DriveType = 2 Then
> X = X + 1
>
> 'Determine drive letter of first fixed disk
> 'This is the drive that the error report will be placed on
> If X = 1 Then
> Drive = d
> End If
> End If
> Next
>
> ReDim A(X)
> ReDim ErrStr(X)
>
> X = 0
> For Each d in dc
> If d.DriveType = 2 Then
> X = X + 1
> Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)
>
> 'Determine the Error code returned by Defrag for the current drive and

save
> it
> If return = 0 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag completed successfully"

&
> vbCRLF
> elseif return = 1 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (defrag was cancelled manually) " & vbCRLF
> elseif return = 2 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (there was a command line error. Check your command line

for
> valid
>
> switches and drives)" & vbCRLF
> elseif return = 3 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (there was an unknown error)" & vbCRLF
> elseif return = 4 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (defrag could not run due to insufficient memory

resources)"
> &
>
> vbCRLF
> 'errorlevel 5 is not currently used
> elseif return = 5 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (general error)" & vbCRLF
> elseif return = 6 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & "(System error: either the account used to run defrag is not

an
>
> administrator, there is a problem loading the resource DLL, or a defrag
> engine could not be accessed. Check for proper user permissions and run
> Sfc.exe to
>
> validate system files)" & vbCRLF
> elseif return = 7 then
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

level
> " & return & " (There is not enough free space on the drive. Defrag needs
> 15%
>
> free space to run on a volume)" & vbCRLF
> else
> ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with an unknown
> error level: " & return & vbCRLF
> end if
>
> End If
> Next
>
> 'Create the Error Report in the root of the first fixed disk.
> Set MyFile = fso.OpenTextFile(Drive & "\defragreport.txt", 2, True)
> MyFile.WriteLine(Date) & vbCRLF
> MyFile.WriteLine(Time) & vbCRLF
> For I = 1 to X
> MyFile.WriteLine(ErrStr(I))
> Next
> MyFile.Close
>
> Return = WshShell.Run(Drive & "\defragreport.txt",3,True)
>
> Set WshShell = Nothing
> Set fso = Nothing
>
>

************************************************** **************************
> ************************
> CUT ABOVE THIS LINE.
>
>
> --
>
>
> The best live web video on the internet http://www.seedsv.com/webdemo.htm
> Sharpvision simply the best http://www.seedsv.com
>
>
>
> "Phyllis" <(E-Mail Removed)> wrote in message
> news:9m%Pb.7710$(E-Mail Removed) ...
> > I use Windows XP. When I use the schedule task wizard, disk

degragmenting
> > is not a choice in my list. I've already got disk cleanup scheduled but
> > there isn't a choice to defrag. However, I can still go under

accessories
> > and it is under my system tools right under disk clean up.
> >
> > Is this something I will have to remember to do manually in XP (defrag)

or
> > is there a way I can get disk defrag to appear in my list of choices

when
> > I'm using the wizard? I hope this makes sense!
> >
> > Thanks,
> > DD
> >
> >

>
>



 
Reply With Quote
 
pcbutts1
Guest
Posts: n/a
 
      01-24-2004
Open notepad to a maximized window, click format and make sure word wrap is
NOT checked. Cut and paste into the maximized window.

--


The best live web video on the internet http://www.seedsv.com/webdemo.htm
Sharpvision simply the best http://www.seedsv.com



"Phyllis" <(E-Mail Removed)> wrote in message
news:RHkQb.7844$(E-Mail Removed) m...
> I did as you said and crossed my fingers when it was set to run. It did
> start but I received an error message. I'm not a computer guru but is

this
> something I can fix easily. Error message as follows:
>
> Line: 39
> Char: 77
> Error: Syntax error
> Code: 800A03EA
> Source: Microsoft VBScript compilation error
>
> Thanks
>
>
>
> "pcbutts1" <(E-Mail Removed)> wrote in message
> news:5G%Pb.23863$(E-Mail Removed) hlink.net...
> > Cut and paste everything between the lines below into notepad and save

it
> as
> > a .vbs file. Save on your hard drive somewhere. Using task scheduler

> browse
> > to the saved file and schedule it to run. This vbs file will defrag all

> your
> > hard drives and create a log. This file was created by Doug Knox

Microsoft
> > MVP.
> >
> > CUT BELOW HERE
> >
> >

>

************************************************** **************************
> > *********************
> >
> > 'defrag_all2.vbs
> > 'Defrags all hard disks - Can be run as a Scheduled Task
> >
> >
> >
> > Option Explicit
> >
> > Dim WshShell, fso, d, dc, ErrStr(), Return, X, A(), MyFile, I, MyBox,

> Drive
> >
> > Set WshShell = WScript.CreateObject("WScript.Shell")
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > X = 0
> >
> > Set dc = fso.Drives
> > For Each d in DC
> > If d.DriveType = 2 Then
> > X = X + 1
> >
> > 'Determine drive letter of first fixed disk
> > 'This is the drive that the error report will be placed on
> > If X = 1 Then
> > Drive = d
> > End If
> > End If
> > Next
> >
> > ReDim A(X)
> > ReDim ErrStr(X)
> >
> > X = 0
> > For Each d in dc
> > If d.DriveType = 2 Then
> > X = X + 1
> > Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)
> >
> > 'Determine the Error code returned by Defrag for the current drive and

> save
> > it
> > If return = 0 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag completed

successfully"
> &
> > vbCRLF
> > elseif return = 1 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (defrag was cancelled manually) " & vbCRLF
> > elseif return = 2 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (there was a command line error. Check your command line

> for
> > valid
> >
> > switches and drives)" & vbCRLF
> > elseif return = 3 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (there was an unknown error)" & vbCRLF
> > elseif return = 4 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (defrag could not run due to insufficient memory

> resources)"
> > &
> >
> > vbCRLF
> > 'errorlevel 5 is not currently used
> > elseif return = 5 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (general error)" & vbCRLF
> > elseif return = 6 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & "(System error: either the account used to run defrag is

not
> an
> >
> > administrator, there is a problem loading the resource DLL, or a defrag
> > engine could not be accessed. Check for proper user permissions and run
> > Sfc.exe to
> >
> > validate system files)" & vbCRLF
> > elseif return = 7 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (There is not enough free space on the drive. Defrag

needs
> > 15%
> >
> > free space to run on a volume)" & vbCRLF
> > else
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with an

unknown
> > error level: " & return & vbCRLF
> > end if
> >
> > End If
> > Next
> >
> > 'Create the Error Report in the root of the first fixed disk.
> > Set MyFile = fso.OpenTextFile(Drive & "\defragreport.txt", 2, True)
> > MyFile.WriteLine(Date) & vbCRLF
> > MyFile.WriteLine(Time) & vbCRLF
> > For I = 1 to X
> > MyFile.WriteLine(ErrStr(I))
> > Next
> > MyFile.Close
> >
> > Return = WshShell.Run(Drive & "\defragreport.txt",3,True)
> >
> > Set WshShell = Nothing
> > Set fso = Nothing
> >
> >

>

************************************************** **************************
> > ************************
> > CUT ABOVE THIS LINE.
> >
> >
> > --
> >
> >
> > The best live web video on the internet

http://www.seedsv.com/webdemo.htm
> > Sharpvision simply the best http://www.seedsv.com
> >
> >
> >
> > "Phyllis" <(E-Mail Removed)> wrote in message
> > news:9m%Pb.7710$(E-Mail Removed) ...
> > > I use Windows XP. When I use the schedule task wizard, disk

> degragmenting
> > > is not a choice in my list. I've already got disk cleanup scheduled

but
> > > there isn't a choice to defrag. However, I can still go under

> accessories
> > > and it is under my system tools right under disk clean up.
> > >
> > > Is this something I will have to remember to do manually in XP

(defrag)
> or
> > > is there a way I can get disk defrag to appear in my list of choices

> when
> > > I'm using the wizard? I hope this makes sense!
> > >
> > > Thanks,
> > > DD
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
pcbutts1
Guest
Posts: n/a
 
      01-24-2004
You can download it directly from here
http://www.dougknox.com/utility/scri...defrag_all.htm

--


The best live web video on the internet http://www.seedsv.com/webdemo.htm
Sharpvision simply the best http://www.seedsv.com



"Phyllis" <(E-Mail Removed)> wrote in message
news:RHkQb.7844$(E-Mail Removed) m...
> I did as you said and crossed my fingers when it was set to run. It did
> start but I received an error message. I'm not a computer guru but is

this
> something I can fix easily. Error message as follows:
>
> Line: 39
> Char: 77
> Error: Syntax error
> Code: 800A03EA
> Source: Microsoft VBScript compilation error
>
> Thanks
>
>
>
> "pcbutts1" <(E-Mail Removed)> wrote in message
> news:5G%Pb.23863$(E-Mail Removed) hlink.net...
> > Cut and paste everything between the lines below into notepad and save

it
> as
> > a .vbs file. Save on your hard drive somewhere. Using task scheduler

> browse
> > to the saved file and schedule it to run. This vbs file will defrag all

> your
> > hard drives and create a log. This file was created by Doug Knox

Microsoft
> > MVP.
> >
> > CUT BELOW HERE
> >
> >

>

************************************************** **************************
> > *********************
> >
> > 'defrag_all2.vbs
> > 'Defrags all hard disks - Can be run as a Scheduled Task
> >
> >
> >
> > Option Explicit
> >
> > Dim WshShell, fso, d, dc, ErrStr(), Return, X, A(), MyFile, I, MyBox,

> Drive
> >
> > Set WshShell = WScript.CreateObject("WScript.Shell")
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > X = 0
> >
> > Set dc = fso.Drives
> > For Each d in DC
> > If d.DriveType = 2 Then
> > X = X + 1
> >
> > 'Determine drive letter of first fixed disk
> > 'This is the drive that the error report will be placed on
> > If X = 1 Then
> > Drive = d
> > End If
> > End If
> > Next
> >
> > ReDim A(X)
> > ReDim ErrStr(X)
> >
> > X = 0
> > For Each d in dc
> > If d.DriveType = 2 Then
> > X = X + 1
> > Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)
> >
> > 'Determine the Error code returned by Defrag for the current drive and

> save
> > it
> > If return = 0 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag completed

successfully"
> &
> > vbCRLF
> > elseif return = 1 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (defrag was cancelled manually) " & vbCRLF
> > elseif return = 2 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (there was a command line error. Check your command line

> for
> > valid
> >
> > switches and drives)" & vbCRLF
> > elseif return = 3 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (there was an unknown error)" & vbCRLF
> > elseif return = 4 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (defrag could not run due to insufficient memory

> resources)"
> > &
> >
> > vbCRLF
> > 'errorlevel 5 is not currently used
> > elseif return = 5 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (general error)" & vbCRLF
> > elseif return = 6 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & "(System error: either the account used to run defrag is

not
> an
> >
> > administrator, there is a problem loading the resource DLL, or a defrag
> > engine could not be accessed. Check for proper user permissions and run
> > Sfc.exe to
> >
> > validate system files)" & vbCRLF
> > elseif return = 7 then
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error

> level
> > " & return & " (There is not enough free space on the drive. Defrag

needs
> > 15%
> >
> > free space to run on a volume)" & vbCRLF
> > else
> > ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with an

unknown
> > error level: " & return & vbCRLF
> > end if
> >
> > End If
> > Next
> >
> > 'Create the Error Report in the root of the first fixed disk.
> > Set MyFile = fso.OpenTextFile(Drive & "\defragreport.txt", 2, True)
> > MyFile.WriteLine(Date) & vbCRLF
> > MyFile.WriteLine(Time) & vbCRLF
> > For I = 1 to X
> > MyFile.WriteLine(ErrStr(I))
> > Next
> > MyFile.Close
> >
> > Return = WshShell.Run(Drive & "\defragreport.txt",3,True)
> >
> > Set WshShell = Nothing
> > Set fso = Nothing
> >
> >

>

************************************************** **************************
> > ************************
> > CUT ABOVE THIS LINE.
> >
> >
> > --
> >
> >
> > The best live web video on the internet

http://www.seedsv.com/webdemo.htm
> > Sharpvision simply the best http://www.seedsv.com
> >
> >
> >
> > "Phyllis" <(E-Mail Removed)> wrote in message
> > news:9m%Pb.7710$(E-Mail Removed) ...
> > > I use Windows XP. When I use the schedule task wizard, disk

> degragmenting
> > > is not a choice in my list. I've already got disk cleanup scheduled

but
> > > there isn't a choice to defrag. However, I can still go under

> accessories
> > > and it is under my system tools right under disk clean up.
> > >
> > > Is this something I will have to remember to do manually in XP

(defrag)
> or
> > > is there a way I can get disk defrag to appear in my list of choices

> when
> > > I'm using the wizard? I hope this makes sense!
> > >
> > > Thanks,
> > > DD
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
omnitron omnitron is offline
Junior Member
Join Date: Nov 2008
Posts: 1
 
      11-14-2008
It is almost 2009
You are running Windows XP
and you are expected to copy and paste and run THIS?!?!

Doesn't it make you want a Mac?

2009 ?!?!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tune-up Application Start in Scheduled Tasks =?Utf-8?B?U3Rld2FydCBGbHVuZXk=?= Microsoft Certification 1 04-12-2006 11:09 PM
Scheduled Tasks Ian Welch Computer Support 4 06-29-2005 04:48 PM
Problem: Unable to use SCHEDULED TASKS folder hwr Computer Support 1 09-18-2004 09:07 PM
Scheduled tasks Brian H Computer Support 6 07-05-2003 06:37 PM
Scheduled tasks in XP fm Computer Support 2 07-04-2003 12:45 PM



Advertisments