Wednesday, May 9, 2007

Defrag a computer

Just like doing a disk clean up, you may not have a policy that runs disk defragment at a given time. Maybe you have DiskKeeper. This will allow you to force your computers to run a defrag through SMS. We have a defrag set to run once a month. This can keep the computers running a bit faster and keeps the help desk calls down. Granted if you have a policy or software inplace you can just ignore this one :) I recommend you run the file with "cscript defrag.vbs" so if an error occurs it will not try to force a popup.

Set objShell = CreateObject("WScript.Shell")
'Run the Defrag Utility
intRetVal = objShell.Run("%comspec% /c %WinDir%\system32\defrag.exe c: -f -v ", 0, True)
If intRetVal <> 0 Then WScript.Quit intRetVal