SWD task for defrag not running

This issue has been solved. See solution.
Greg Englund's picture

I have a SWD task for defragging desktops that I cannot get to run when the schedule is set to "Only run at scheduled time". I have it set to run at 10:45 pm only when no one is logged in. It seems to run fine when set to "Run 'as soon as possible'..."  All other settings are unchanged. I have tried different credentials (currently set to System), but that makes no difference. Command line:  "c:\windows\system32\defrag.exe" c:

Does anyone have an idea as to why "Only run at scheduled time" fails to do anything?

robertser's picture

Have you tried unchecking the

Have you tried unchecking the option to "only run when no one is logged in."  Perhaps ueser are not logging off at night?  Do you have any other jobs that might also be running at that time?  if another job is running at the same time as this one it would prevent it from running.

Greg Englund's picture

Changing the logged in option

Changing the logged in option does not affect the task. I have tried those scenarios.
The systems were logged off at night. Subsequent testing during the day with a revised schedule had the same effect.
No other jobs are running at the time.

Greg Englund
Clark County Information Services
Clark County, Washington

KSchroeder's picture

I did some testing with this

Solution

I did some testing with this and here's what I came up with:
%systemroot%\system32\cmd.exe /c "%systemroot%\system32\defrag.exe c: -f -v >>c:\Defrag.log"

Set to run Minimized as SYSTEM account, whether or not a user is logged on, user input required.  You may want to try with that "User input required" checkbox checked, even if you set to "Only when no user is logged on".  It has all sorts of interesting repercussions.  I did not test however what happened when there was no user logged on, nor did I test with a specified time for the scheduled task.

Thanks,
Kyle
Symantec Trusted Advisor
If your question has been resolved, please be sure to click "Mark as Solution"! Thank you.

KSchroeder's picture

Glad I could help Greg!  I'm

Glad I could help Greg!  I'm not sure why they don't just pre-select that box, as all sorts of things don't work quite right when it isn't checked.

Thanks,
Kyle
Symantec Trusted Advisor
If your question has been resolved, please be sure to click "Mark as Solution"! Thank you.

Greg Englund's picture

Thanks for you input, Kyle.

Thanks for you input, Kyle. You referenced checking "User Input Required" even  if set to "Only when no user is logged on". I have never tried that because it doesn't make a lot of sense. What kind of interesting repercussions can occur?

Greg Englund
Clark County Information Services
Clark County, Washington

KSchroeder's picture

Well...I guess by

Well...I guess by "interesting" I should have said "things don't work right", as you noted :).

Thanks,
Kyle
Symantec Trusted Advisor
If your question has been resolved, please be sure to click "Mark as Solution"! Thank you.