Hi all,
Is there any tools that i can use to do the disc clean up and Defrag on remote computers?
Im on windows 7 Pro and the most of the computers are on XP Pro
Hi all,
Is there any tools that i can use to do the disc clean up and Defrag on remote computers?
Im on windows 7 Pro and the most of the computers are on XP Pro
Last edited by newpersn; 8th March 2012 at 09:30 AM.
Free -> Psexec
Paid -> Diskeeper Enterprise
We use:
Psexec + JkDefrag for defragging
Psexec + ccleaner portable for cleaning up junk
Psexec + a VBS script for deleting profiles
I can post examples if you want after I've had my lunch.
What about a scheduled task?

Well doing it remotely wont help there then...we tired with scheduled task but the computers turn off if there not being used. Be

You may find re-imaging is going to be quicker and with better results too.
All these scripts are run from one of our Servers and its up to you to edit all file paths to get things working appropriately. Also the scripts are probably a bit messy and could be improved but they work for us. All batch files are run via a scheduled task and each task runs in a cycle of once every 3 weeks.
Defrag
- Save the code below as defrag.bat
- We use a program called JkDefrag
- Hopefully the below makes some sense if not you need to look into psexec basics.
- @adefrag.txt is a file which includes all computer names which you want to be defragged.
JunkCode:D: cd Maintenance\Tools\PsTools\ psexec -c -f -w c:\windows\system32 -d @adefrag.txt \\sever\Maintenance\Tools\JkDefrag\jkdefragcmd.exe -d 2 -l "jkdefrag.log" c: d: e: f: g: h:
- Save the bat file code below as junk.bat
- Save the vbs scripts as junk.vbs
- Execute the vbs script via the batch file, or via GPO etc if you want to.
batch file
vbs scriptCode:D: cd RMNetwork\RMManage\Maintenance\Tools\PsTools\ psexec -c -f -w C:\Windows\System32 @ajunk.txt -u domain\user -p user_password cscript.exe //B \\server\Maintenance\Tools\Junk\Junk.vbs
Profile RemoverCode:Option Explicit On Error Resume Next Dim FSO set FSO=CreateObject("Scripting.FileSystemObject") FSO.DeleteFolder("C:\Windows\$NtUninstall*") FSO.DeleteFolder("C:\Windows\$NtServicePackUninstall*") FSO.DeleteFolder("C:\Windows\$MSI31Uninstall*") FSO.DeleteFolder("C:\Windows\Temp\**") FSO.DeleteFolder("C:\Windows\$hf*") FSO.DeleteFile ("C:\Windows\Temp\*") FSO.DeleteFile ("C:\Windows\*.log") Set FSO = Nothing
- Probably better ways to do this but it works for us
batch file
vbs scriptCode:D: cd RMNetwork\RMManage\Maintenance\Tools\PsTools\ psexec -c -f -w c:\windows\system32 @aProfileCleaner.txt -u domain\user -p user_password cscript.exe //B \\server\Maintenance\Tools\ProfileCleaner\profilecleaner.vbs
Code:Const LocalDocumentsFolder = "C:\Documents and Settings\" set objFSO = createobject("Scripting.FileSystemObject") set objFolder = objFSO.GetFolder(localdocumentsfolder) on error resume next for each fldr in objFolder.SubFolders if not isexception(fldr.name) then objFSO.DeleteFolder fldr.path, True end if next Function isException(byval foldername) select case foldername case "All Users", "Default User", "LocalService", "NetworkService", "Administrator", "RM Default User" isException = True case Else isException = False End Select End Function
Restart
- Will remotely restart all computers in @arestart.txt
If you need help I'll try my best to explain when time allows.Code:psshutdown.exe @arestart.txt -r -m "This PC will restart in 20 seconds. Please save your work."
Matt
Last edited by mwbutler; 9th March 2012 at 10:23 AM. Reason: added profile remover
tigerstar (14th March 2012)
CCleaner network edition for cleanup, shame defraggler isn't networked![]()

Windows Vista and 7 both defrag themselves automatically.
For our XP computers we use the screensaver included with MyDefrag and set it to run when the computer has been idle at the logon screen for 10 mins or so.
bondbill2k2 (13th March 2012)
Tell a lie looking at the Ccleaner network trial defraggle is built into the PRO edition for network use! Not cheap tho, over $2000 for 100+ computers
Last edited by bondbill2k2; 19th March 2012 at 03:00 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)