Defrag as a service using instsrv srvany

Has anyone out there set this up before?  I could use detailed instructions.  So far, I only have these links to go by:

I'd like to be able to let end users in the local power users group on Windows XP Pro machines be able to run disk defrag whenever they want on their own.  However when I try set this up and try to run the service (even while logged in as local admin), I get the following error:

"The autodefrag service on Local Computer started and then stopped.  Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service."

Thanks in advance!

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Luc FrankenEMEA Server EngineerCommented:
have you tried the -f switch on the defrag program, this forces defrag to run even if it thinks there isn't any work to do?

mb2010Author Commented:
The auto defrag program works on it's own, and yes it will work with the -f switch.  When I set the autodefrag program to run as a service is where I run into the problem.
Luc FrankenEMEA Server EngineerCommented:
Can you find anything in the event-logs? If so please post all details.

The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

mb2010Author Commented:
Nothing in the event logs that looks unusual.
Luc FrankenEMEA Server EngineerCommented:
I'm at the moment trying to copy the thing you're trying todo, having the same problem, I'll let you know as soon as I find something.

mb2010Author Commented:
Okay.  Thanks.
This is a problem for many reasons:
1-As a service it is going to run all the time.  It will stay resident in memory and may even lock access to the disk at some point.  
2-You are going to run inot interrupt contention, usually logical disk manager will lock to provide partition or volume level access and it has priority (ie it can stop defrag or any other app that hooks int13) because basically it is those services that handles negotiation with the HAL from the system to hardware
3-Defrag doesn't register as system activity, power management COULD powerdown the system
4-IT RUNS ALL THE TIME, what good does a manual service setting do in this situation?

Use the command line option and make a scheduled task.  It will wake the computer and keep it from sleeping untill finished.  It can logon using a service account you create for it, domain or local.  Just give it appropriate rights.  

Since MS defrag doesn't defrag the MFT or the page file, once a system is defraged it will largely remain that way.  Only through installs and uninstalls does the system get fragmented.  No need to have a huge temp.inetfiles, most cached objects are small gifs 1-2k.  If its not huge it won't fragment the drive.

If you are looking for a decent defrag solution Diskeeper is the way to go.

Security and Virus forum moderator
<edited by YensidMod>
Per MS:;EN-US;314848
It can defragment only local volumes.
It can defragment only one volume at a time.
It cannot defragment one volume while it is scanning another.
It cannot be scheduled. If you need to schedule disk defragmentation, use the Defrag.exe command line tool. For additional information about using the command line Defrag.exe tool, click the following article number to view the article in the Microsoft Knowledge Base:
283080 Description of the New Command Line Defrag.exe Included with Windows XP

Security and Virus forum moderator
<edited by YensidMod>
Better yet make a batchfile, set a sceduled task to run the batch file and redirect output to a text file for review. Just make a directory for the output files.
%sysvol%:\%windir%\defrag.exe c: -fv > x:\directory\defragc.log
%sysvol%:\%windir%\defrag.exe d: -fv > x:\directory\defragd.log
%sysvol%:\%windir%\defrag.exe e: -fv > x:\directory\defrage.log

Security and Virus forum moderator
<edited by YensidMod>
Hello......close this topic please or reply!

mb2010Author Commented:
Sure.  I understand what Microsoft says about this.  However, I was looking for an automated, hacked, way of doing it based on the links I provided.
mb2010Author Commented:
I never got a complete answer on this.  I have settled for creating a shortcut with the following entry in the Target:
%windir%\System32\runas.exe / "mmc dfrg.msc"

This way, I do not have to log off the end user to run defrag.  I just enter the admin password and have the app minimized until the user has time to run it.



Moderator, you a free to close this if you would like.
PAQed, with points refunded (500)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
OS Security

From novice to tech pro — start learning today.