Jump to content
Sign in to follow this  
Digerati

Automating the defrag process

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...