Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minimize the unattend defrag on w2k

Status
Not open for further replies.

amarchi

IS-IT--Management
Jul 5, 2002
75
0
0
IT
Dear Friends,

I have done a script (found it on internet) That run the defrag program on win2k clients.
here it's the 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 5000

'Wait until the application has loaded - Check every second
While WshShell.AppActivate("Utilità di deframmentazione dischi") = FALSE
wscript.sleep 500
Wend

'Bring the application to the foreground
WshShell.AppActivate "Utilità di deframmentazione dischi"
WScript.Sleep 200

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

'Send a D to start the defrag
WshShell.SendKeys "D"
WScript.Sleep 500
WshShell.SendKeys "%{TAB}"

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

'Bring the msgbox to the foreground
WshShell.AppActivate "Deframmentazione Completa"
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 Deframmentazione Completa window
WshShell.Sendkeys "{ENTER}"
Wscript.Sleep 500

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

****************************************************
Anybody know how can i minimize the windows during the run of the defrag program?
which string i have to put on it.
Thanks very much
Max

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top