Article
Author: Darrell Eddy
ENVIRONMENT: This works on Windows XP. I have not tested this on Windows 2000 though.
I needed a way to implement automatic hard drive defrag and check disk on multiple PCs.
SOLUTION: Searching the internet landed me a solution to automate the Check Disk and defrag process. I then created an Application Object to create a scheduled task on associated PCs.
Basically, the app object copies the two needed files to a directory on the root of the C drive of the associated PCs. I use a directory called utils. Then using the AT command, I insert a scheduled task into each system for the command to run once per week on the PC.
Example
Copy the following text to a new text document and name it "Dskchk.cmd":
REM chkdsk and defrag automation for /F "eol= tokens=1 delims=( " %%i in (DrvLtr.txt) do set DrvLtr=%%i& call :dsKchk :dsKchk If %DrvLtr% == end goto :eof chkdsk %DrvLtr% If not errorlevel 3 goto :defrag If not exist %DrvLtr%\winnt If not exist %DrvLtr%\windows If not exist %DrvLtr%\pagefile.sys goto :dskchkon :dskchkoff cd\ %DrvLtr% echo Y chkdsk /F /R goto :defrag :dskchkon chkdsk %DrvLtr% /F /R :defrag cd\ %DrvLtr% defrag %DrvLtr% -b defrag %DrvLtr% :EOF
Copy the following text to a new text document and name it "drvltr.txt":
c: end
You need to include any drive letter that you want checked in the process.
This is the axt file used to create the object (replace SERVER with the name of your server):
AXT_FILE 3.1 [Application Name] Value=Chkdsk-Defrag [Application Caption] Value=Chkdsk-Defrag [Application Path] Value=%systemroot%\system32\AT.EXE [Application Flags] [Application Parameters] Value=22:30 /EVERY:W "C:\UTILS\DSKCHK.CMD" [Application Platform] Flag=Windows 95 Flag=Windows NT [File Copy] Flag=Update Create Source=\\SERVER\PUBLIC\tools\ChkDsk-Defrag\Dskchk.cmd Target=c:\utils\dskchk.cmd [File Copy] Flag=Update Create Source=\\SERVER\PUBLIC\tools\ChkDsk-Defrag\Drvltr.txt Target=c:\utils\drvltr.txt [Filter OS Version] Type=Windows 95 Major Version=-1 Minor Version=-1 Revision Version=-1 Build Version=-1 Flag=Greater Than or Equal [Filter OS Version] Type=Windows NT Major Version=-1 Minor Version=-1 Revision Version=-1 Build Version=-1 Flag=Greater Than or Equal [Application Association Flags] Flag=Launcher [Application Distribution Rules] File=DIRU0029.XML Show Icon=0
If you have any questions you may contact Darrell at eddy@latech.edu
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.
Related Articles
User Comments
defrag
Submitted by Anonymous on 23 October 2008 - 3:51am.
Goodmorning,
I don't understund, can you write in french? please
my mail adress " zizou026@hotmail.com"
Thanks
zizou
- Be the first to comment! To leave a comment you need to Login or Register


1