Title: Message
No, you must be logged on for it to run.  But you can lock the workstation
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Morgan, Joshua
Sent: Friday, May 10, 2002 6:09 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [ActiveDir] Automating Defragmentation

If I schedule it using the Task Scheduler... Will it run correctly with the machine logged off?
 
 





Joshua Morgan
PH: (864) 250-1350 Ext 133
[EMAIL PROTECTED]
http://www.profit-lab.com
http://ncontrol.info

-----Original Message-----
From: Bryon Barkley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 09, 2002 10:25 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] Automating Defragmentation

Can't go wrong with this, I use it every day.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Ayers, Diane
Sent: Thursday, May 09, 2002 1:32 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [ActiveDir] Automating Defragmentation

Another Option for scheduling a defrag.
 
 
Diane
-----Original Message-----
From: David Lee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 2:15 PM
To: [EMAIL PROTECTED]
Subject: Re: [ActiveDir] Automating Defragmentation

This is what I use in VBScript.


'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

        WshShell.Sendkeys "{TAB}"
        Wscript.Sleep 500

        wshshell.Sendkeys "{down}"
        Wscript.Sleep 500

'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

        'WshShell.Sendkeys "{TAB}"
        'Wscript.Sleep 500

        wshshell.Sendkeys "{down}"
        Wscript.Sleep 500

'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}"


At 04:04 PM 5/7/2002 -0400, you wrote:
Does any have a script or a source they can point me to help me Automate
Windows 2000's Defrag utility






Joshua Morgan
PROFITLAB
Senior Network Engineer
PH: (864) 250-1350 Ext 133
Fax: (413) 581-4936
[EMAIL PROTECTED]
http://www.profit-lab.com
http://ncontrol.info

The greatest glory is not in never failing, but in rising up every time we
fall.
-- Confucius

List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

David D. Lee
Computer Resource Specialist II
Office of Undergraduate Admissions
[EMAIL PROTECTED]
2-6417

Reply via email to