+ Post New Thread
Results 1 to 6 of 6
Scripts Thread, Defrag script for more than 1 pc on a network in Coding and Web Development; Hey, Is it possible to create a batch or vbs script to defrag xp machines from a server? Does anybody ...
  1. #1
    lafleur1977's Avatar
    Join Date
    May 2009
    Location
    Lancashire
    Posts
    160
    Thank Post
    119
    Thanked 4 Times in 4 Posts
    Rep Power
    11

    Defrag script for more than 1 pc on a network

    Hey,

    Is it possible to create a batch or vbs script to defrag xp machines from a server? Does anybody know how to do this?

    Thanks

  2. #2

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,205
    Thank Post
    876
    Thanked 2,729 Times in 2,308 Posts
    Blog Entries
    11
    Rep Power
    782
    How pretty a solution do you want to make it, you could use psexec in a batch file with the "defrag.exe c:" command which is in xp and will defrag in the background which is probably the simplest. You can also use WMI in vbs to remotely execute and moniter the same command if you have the domain firewall profile setup right on your clients.

  3. #3
    mmoseley's Avatar
    Join Date
    Apr 2007
    Location
    Birmingham
    Posts
    756
    Thank Post
    109
    Thanked 105 Times in 80 Posts
    Blog Entries
    2
    Rep Power
    44
    Hiya,

    This is my defrag group policy startup script, it adds a scheduled task...


    schtasks.exe /create /SC WEEKLY /D SAT /TN Defragmentation /TR "\"C:\windows\system32\defrag.exe\"c: -f" /ST 00:45:00 /SD 01/01/2009 /RU SYSTEM
    This creates a weekly task which starts at 00:45!

    Hope this helps!,

    Mart

  4. #4
    lafleur1977's Avatar
    Join Date
    May 2009
    Location
    Lancashire
    Posts
    160
    Thank Post
    119
    Thanked 4 Times in 4 Posts
    Rep Power
    11
    Hey Mart,

    That looks great, thanks! Will give it a try monday morning. Do you or anybody else have something simular to perform a disk cleanup or run ccleaner?

    Thanks.

  5. #5
    mmoseley's Avatar
    Join Date
    Apr 2007
    Location
    Birmingham
    Posts
    756
    Thank Post
    109
    Thanked 105 Times in 80 Posts
    Blog Entries
    2
    Rep Power
    44
    Quote Originally Posted by lafleur1977 View Post
    Hey Mart,

    That looks great, thanks! Will give it a try monday morning. Do you or anybody else have something simular to perform a disk cleanup or run ccleaner?

    Thanks.
    Hiya,

    No sadly not, although i might look into the disk cleanup as that might be useful!

    Cheers, Mart

  6. #6
    rosswilson's Avatar
    Join Date
    Feb 2008
    Location
    Cheshire
    Posts
    47
    Thank Post
    15
    Thanked 10 Times in 10 Posts
    Rep Power
    15

    cleanmgr.exe /sageset:50

    You might want to look into using:

    Code:
    cleanmgr.exe /sageset:50
    This will show a panel where you can tick what items you want cleaning up. These settings are stored in the registry.

    Code:
    cleanmgr.exe /sagerun:50
    Will run the cleanup commands you configured earlier.

    If you do the /sageset:50 part when building your base image then you could execute the cleanup on a shutdown, remotely, or via a scheduled task.

    This page explains the process a bit more with references to the location in the registry where the settings are stored: Automate Disk Cleanup using Task Scheduler in Windows XP

    Ross

SHARE:
+ Post New Thread

Similar Threads

  1. Beyondexec Network Defrag Batch Files
    By CommodoreS in forum Network and Classroom Management
    Replies: 2
    Last Post: 19th March 2009, 06:19 PM
  2. Auto Defrag
    By shane_saintsfc in forum Windows Server 2000/2003
    Replies: 13
    Last Post: 17th March 2009, 08:49 AM
  3. Defrag Problem
    By notalot in forum Windows
    Replies: 7
    Last Post: 12th January 2009, 08:24 AM
  4. Defrag or scandisk
    By techyphil in forum Windows
    Replies: 13
    Last Post: 27th May 2007, 12:29 AM
  5. Remote Defrag
    By Pear in forum Windows
    Replies: 5
    Last Post: 16th November 2005, 09:36 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •