Monday, July 03, 2006

How can I run a scheduled task without a password?

This is v2 of this post. I wrote this a couple of nights ago and waited to post it until I had tested it. See, I can't be wrong all the time.

What I was trying to do was to setup a scheduled task on my SageTV box to defrag. I set it up and kept getting "Could not start" errors. I googled it and ... Well, here's the v1 of this post.

I just love Google. Maybe that is just the Internet and the wealth of information on it.

I'm still working on getting my SageTV box up to "unlimited" storage. Until then, I'm stuck with only 80GB and with the World Cup games on, that's kinda tight.

While I know that defragmentation doesn't give me any more space, being tight on space creates more fragmentation.

I Googled "how can i run a scheduled task without a password"and found this link as the second entry:

Scheduled Tasks - Running Tasks Without A Password
For XP Pro: Go to Start/Administrative Tools/Local Security Policy/Security Settings/Local Policies/Security OptionsAccounts: Limit local account use of blank passwords to console logon only. This is enabled by default, disable it.
For XP Home: (Keith Miller) Go to Start/Run/Regedit and navigate to this key:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
Value name: limitblankpassworduse, Type: REG_DWORD, Data: 0 (disabled) 1 (enabled)
So chalk up another problem solved to Google.

Oh, I didn't see the "Adminstrative Tools" on my Start menu so I just right-clicked on Start and chose "Explore all users". The link I needed was "Local Security Policy" in "C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools". The target is "%SystemRoot%\system32\secpol.msc /s".

As Paul Harvey says, "Now for the rest of the story."

That didn't fix it.

What I didn't mention in v1 was how I setup the scheduled task. I went to Start/Run and entered "cmd" to get a command prompt. Then I entered the following:
at 02:00 /every:M,T,W,Th,F,S,Su "defrag c:"
Seemed like a good idea at the time.

When the above machinations didn't fix this, I started to dig deeper. What I found is a file in c:\Windows named SchedLgU.Txt. This is the log of all the executions (or attempts in my case) of scheduled tasks.

Here's what mine said:
"Defrag.job" () 7/3/2006 5:24:01 PM ** ERROR ** Unable to start
task. The specific error is: 0x80070002: The system cannot find the
file specified. Try using the Task page Browse button to locate the
Duh. I had the command in quotes and it didn't need to be. This is what it should have been:
at 02:00 /every:M,T,W,Th,F,S,Su defrag c:
Then I remembered WHY I had been doing this at the command prompt. If you use the "at" command at a command prompt to establish a scheduled task, it runs with Administrator authority and not your user account!

The fiddling with the security policy was completely unnecessary.

No comments: