PDA

View Full Version : Spybot as Scheduled Task in Vista



dan_muller
2009-02-19, 03:39
I had some difficulties getting Spybot to run as a scheduled task on my recently-installed Vista Home Premium 64-bit OS. It took me a while to find or discover solutions to the several issues that I encountered, so I thought I'd summarize it here in case anyone else is beating their head against this wall. Don't worry, it's only drywall, not brick.

Don't use the built-in stuff in Spybot to set it up. This unfortunately gives the task the name "Spybot - Search & Destroy - Scheduled Task". The ampersand in the name apparently causes problems for Vista, because you'll get an error whenever you try to look at the task's history. This was a minor problem, but hindered diagnosis of other problems.

Make sure to check "Run with highest privileges". This is no surprise, I just mention it for those that might stumble over this one. This gives the scheduled task the necessary privileges for Spybot to actually scan your entire system.

The only really big problem that I had is related to computer power management. If you aren't using the more conservative power-saving settings, you might not encounter this at all. If you do, a good solution is not very obvious. Note that, with typical security settings, whenever you make changes to the task you'll have to supply your password. (If you change your password, the task will probably stop working until you update the task.)

I had my task configured (under "Conditions") to "Wake the computer to run this task". The computer would dutifully awake in the wee hours of the morning, and start the scan. But then it would go back to sleep after only a couple of minutes, so that the next time I sat down and woke it, Spybot would continue, having barely gotten started.

Here's how you fix it. Export the task by right-clicking on it and saving it as an XML file. Then edit the XML file (using e.g. Notepad). Find the line that sets the priority -- it'll look something like "<Priority>5</Priority>". Change the five (5) to a four (4). Now delete the original task from your Task Scheduler, and import the XML file.

Apparently, priority 4 is considered "interactive" and will keep the computer awake. A priority number higher than 4 (which actually means "lower priority") is considered unworthy of keeping the computer awake. Also apparently, Microsoft developers didn't think users ought not to have ready access to a task's priority. (At least home users; I haven't used a Business version of Vista much yet.)

To save yourself time, you might actually be able to import my XML file, shown below, as a new task. Copy it from this message (after examining it to make sure you trust it) and paste it into Notepad. Make any obvious adjustments to it, such as the path to the executable file (if it differs on your system) or the time that you want it to run -- although you can adjust most things after importing the file, using the Task Scheduler's GUI. You MUST modify the places that say "YOUR_COMPUTER" and "your_name" to reflect YOUR computer's name and YOUR login name. (Look for UserId line.) Then save it as a file with extension .xml. In the Task Scheduler, right-click on the task list and choose import, and select the file. After importing, check all the settings to make sure they look right to you.

Hope someone finds this helpful!



<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.1" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Author>your_name</Author>
<Description>Spybot fully automated nightly run.</Description>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2009-02-10T03:23:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>YOUR_COMPUTER\your_name</UserId>
<LogonType>InteractiveTokenOrPassword</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<IdleSettings>
<Duration>PT10M</Duration>
<WaitTimeout>PT1H</WaitTimeout>
<StopOnIdleEnd>false</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>true</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Priority>4</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>"C:\Program Files (x86)\Spybot - Search &amp; Destroy\SpybotSD.exe"</Command>
<Arguments>/AUTOCHECK /AUTOIMMUNIZE /AUTOCLOSE</Arguments>
<WorkingDirectory>C:\Program Files (x86)\Spybot - Search &amp; Destroy</WorkingDirectory>
</Exec>
</Actions>
</Task>

ramontana
2009-04-06, 09:24
I encountered the problem slightly differently but the results the same no scheduled runs.

I tried importing your code but gave invalid format error. I created a event from scratch and exported it and the priority level was set to 7. Did not test to see if the same sleep occured just edited it to 4.

thanks