none
Tareas Programadas - Desfragmentar disco RRS feed

  • Pregunta

  • ¿Cual es el comando que puedo sustituir por defrag.exe en W2003 server para programar una tarea de desfragmentación en un W2000 server.?

     

    Gracias

    jueves, 5 de octubre de 2006 8:59

Respuestas

  • El defrag de windows 2000, es una consola mmc y por lo tanto no es facil ejecutarla de forma programada.

    Tienes dos maneras

    Un script:

    ___________________________________________________________________________

    'This script launches defrag and sends keys to the UI in order to automate the defrag
    'process.

    set WshShell = CreateObject("WScript.Shell")

    'Launch Defrag from the command line and wait for a second
    WshShell.Run "dfrg.msc"
    WScript.Sleep 1000

    'Wait until the application has loaded - Check every second
    While WshShell.AppActivate("Disk Defragmenter") = FALSE
         wscript.sleep 1000
    Wend

    'Bring the application to the foreground
    WshShell.AppActivate "Disk Defragmenter"
    WScript.Sleep 200

    'Send an ALT-A key to bring down the degrag menu
    WshShell.SendKeys "%A"
    WScript.Sleep 200

    'Send a D to start the defrag
    WshShell.SendKeys "D"

    'Wait until the defrag is completed - Check for window every 5 seconds
    While WshShell.AppActivate("Defragmentation Complete") = FALSE
         wscript.sleep 5000
    Wend

    'Bring the msgbox to the foreground
    WshShell.AppActivate "Defragmentation Complete"
    WScript.Sleep 200

    'Send a tab key to move the focus from View Report button to the Close Button
    WshShell.Sendkeys "{TAB}"
    Wscript.Sleep 500

    'Send key to Close the Defragmentation Complete window
    WshShell.Sendkeys "{ENTER}"
    Wscript.Sleep 500

    'Send and ALT-F4 to Close the Defrag program
    WshShell.Sendkeys "%{F4}"

    ________________________________________________________________-

    Un programa:

    http://www.winternals.com/Products/DefragManager/Default.aspx

    Un saludo.

    Buenas practicas para el uso de los foros
    Si la respuesta te es de utilidad marca la pregunta como respondida.
    No pongas las preguntas en mas de un foro.

    Daniel Matey.
    MCSE, MCSA, MCSD, MCDBA.
    Blog: http://dmatey.spaces.live.com

    viernes, 6 de octubre de 2006 4:38