Linux-Noob Forums
Automating the defrag process - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Windows Noob (https://www.linux-noob.com/forums/forum-5.html)
+--- Forum: Tips and Tricks (https://www.linux-noob.com/forums/forum-73.html)
+--- Thread: Automating the defrag process (/thread-3904.html)



Automating the defrag process - Digerati - 2003-12-18


Today I decided to use that defrag.vbs in my last tip to defrag the computers on my lan at the stroke of midnight each month.

Here is how to do it using simple batch scripting. There could be a simpler way but I just put this together and copy and pasted a few lines and boom I was done and never had to leave my seat.

 

[ADDDEFRAG.BAT]

 

mkdir \\computer\c$\scripts

copy C:\apps\scripts\defrag.vbs \\computer\c$\scripts\

AT \\computer 00:00 /INTERACTIVE /EVERY:1 c:\scripts\defrag.vbs

 

The first line makes a directory on the users computer called scripts.

The next line copies the defrag.vbs from my computer to the users newly created script folder.

The last line makes use of the AT command to schedule the defrag to run at midnight monthly.

 

In the batch file I just copied the 3 lines over and over until I had added all the computers I needed and edited the lines. Then I sat and executed it with a smile, watching it do all the work.