Setting Scheduled Tasks To Defrag Disk

Discussion in 'Computer Support' started by Phyllis, Jan 23, 2004.

  1. Phyllis

    Phyllis Guest

    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
    Phyllis, Jan 23, 2004
    #1
    1. Advertising

  2. Phyllis

    Harrison Guest

    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" <>
    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
    >
    Harrison, Jan 23, 2004
    #2
    1. Advertising

  3. Phyllis

    pcbutts1 Guest

    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" <> wrote in message
    news:9m%Pb.7710$...
    > 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
    >
    >
    pcbutts1, Jan 23, 2004
    #3
  4. Phyllis

    Senti Guest

    Phyllis did mumble 9m%Pb.7710$...

    > 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/expertzone/columns/crawford/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
    Senti, Jan 23, 2004
    #4
  5. Phyllis

    pcbutts1 Guest

    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" <> wrote in message
    news:burm9a$lhcl0$-berlin.de...
    > Phyllis did mumble 9m%Pb.7710$...
    >
    > > 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/expertzone/columns/crawford/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
    >
    >
    pcbutts1, Jan 23, 2004
    #5
  6. Phyllis

    Phyllis Guest

    Thanks! I'll give this a try.

    "pcbutts1" <> wrote in message
    news:5G%Pb.23863$...
    > 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" <> wrote in message
    > news:9m%Pb.7710$...
    > > 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
    > >
    > >

    >
    >
    Phyllis, Jan 24, 2004
    #6
  7. Phyllis

    Phyllis Guest

    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" <> wrote in message
    news:5G%Pb.23863$...
    > 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" <> wrote in message
    > news:9m%Pb.7710$...
    > > 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
    > >
    > >

    >
    >
    Phyllis, Jan 24, 2004
    #7
  8. Phyllis

    pcbutts1 Guest

    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" <> wrote in message
    news:RHkQb.7844$...
    > 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" <> wrote in message
    > news:5G%Pb.23863$...
    > > 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" <> wrote in message
    > > news:9m%Pb.7710$...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
    pcbutts1, Jan 24, 2004
    #8
  9. Phyllis

    pcbutts1 Guest

    You can download it directly from here
    http://www.dougknox.com/utility/scripts_desc/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" <> wrote in message
    news:RHkQb.7844$...
    > 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" <> wrote in message
    > news:5G%Pb.23863$...
    > > 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" <> wrote in message
    > > news:9m%Pb.7710$...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
    pcbutts1, Jan 24, 2004
    #9
  10. Phyllis

    omnitron

    Joined:
    Nov 14, 2008
    Messages:
    1
    hAVE YOU READ IT ALL?

    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 ?!?!
    omnitron, Nov 14, 2008
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U3Rld2FydCBGbHVuZXk=?=

    Tune-up Application Start in Scheduled Tasks

    =?Utf-8?B?U3Rld2FydCBGbHVuZXk=?=, Apr 12, 2006, in forum: Microsoft Certification
    Replies:
    1
    Views:
    1,580
    =?Utf-8?B?U3Rld2FydCBGbHVuZXk=?=
    Apr 13, 2006
  2. fm

    Scheduled tasks in XP

    fm, Jul 4, 2003, in forum: Computer Support
    Replies:
    2
    Views:
    1,699
  3. Brian H¹©

    Scheduled tasks

    Brian H¹©, Jul 5, 2003, in forum: Computer Support
    Replies:
    6
    Views:
    1,793
    Brian H¹©
    Jul 5, 2003
  4. hwr
    Replies:
    1
    Views:
    581
    °Mike°
    Sep 18, 2004
  5. Ian Welch

    Scheduled Tasks

    Ian Welch, Jun 29, 2005, in forum: Computer Support
    Replies:
    4
    Views:
    1,010
    Ian Welch
    Jun 29, 2005
Loading...

Share This Page