Re: How to compare Environment settings for when I log in vs Task scheduler logs me in.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Leonid L" <parubok@xxxxxxxxx> wrote in message
news:1192724975.924516.36720@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Oct 16, 6:10 pm, "Pegasus \(MVP\)" <I....@xxxxxxx> wrote:
"Leonid L" <paru...@xxxxxxxxx> wrote in message

news:1192571522.994970.79670@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


[This may sound like a programming question, but it is actually
simpler than that.]

I have a Windows Server 2003 SP1 configured to run nightly tests of
software. That involves: A) Downloading them using tf.exe, B)
compiling them using devenv.exe, C) running an executable created
during compilation.

I've written a small C# App that performs steps 1) 2), and 3) in
order. I also created a local non-admin user, and configured the task
scheduler to run this App as that user (I supplied a password).

The App started in this way fails at step 2) The exact message is:
"Error spawning 'C:\Windows\System32\cmd.exe'"

Without getting into details of the build process, I need to tell you
that I do not have this same problem when I start the app myself (when
logged in to the computer over remote desktop). I think the
environment variables differ depending on how I log in to computer.

When I am actually logged in, I can capture the values of the
environment variables by running a .bat script, containing the
following line:
set > C:\<mypath>\set_out.txt

However, I could not get the same script to run successfully when I
schedule it to run and I myself am not logged in. I am specifying the
full output path, it exists, and permissions look OK. It must be
getting confused about the first part - the set command. I do not
think it is able to find it.
=========================================================================

Any suggestions on how I can capture the environment reliably when I
am not logged in ?

The "set" command works regardless of the context it is
invoked in. Your problem is most likely caused by permissions:
The account you use for the scheduled command does not
have sufficient access rights to C:\<mypath>\set_out.txt. Make
it C:\set_out.txt and watch how it works immediately!

Thanks for the suggestion.

It did not work for me, however. I tried various directories including
C:\, but the task scheduler would say "unable to start" when I would
check for the status some time later.
The task runs under the same user name, whether I am logged in or not.
I tried both ways: executing a .bat script containing the "set >
<path>/<out_file>" and executing the "set > <path>/<out_file>" command
without creating a .bat script.

Any ideas?

Thanks.


Aha! Your problem is therefore not the "set" command but the
scheduled task. That's something completely different! Have a
look at the Event Logger and remember that scheduled tasks
must be run with an account that has a non-blank password.
And please don't do all your tests with one and the same account.
Be flexible and create another account for your tests!


.



Relevant Pages

  • Re: Starting a Systemwide App on boot?
    ... Why not use the registry? ... select the SYSTEM account when you define events in Task Scheduler. ... You'll have to use the 'at' command in a command shell. ...
    (microsoft.public.windowsxp.general)
  • Re: Task Scheduler permissions problem
    ... It is the AT command that I'm using ... ... this batch file when this batch file is run as a scheduled task in AT. ... assigning the Scheduler service an administrator account to "log on as". ...
    (microsoft.public.windows.server.security)
  • Re: Scheduler without passwords?
    ... credentials for the account under which an event will run. ... I believe if you schedule jobs in Task Scheduler to run under the SYSTEM ... to define jobs that run under the SYSTEM account. ... command prompt to run the 'at' command. ...
    (microsoft.public.windowsxp.newusers)
  • Re: Scheduled Tasks and passwords
    ... Windows are *not* single-user operating systems. ... under that account specified within the job. ... Task Scheduler wizard for that). ... If the SYSTEM account then the installer ...
    (microsoft.public.windowsxp.help_and_support)
  • RE: Scheduled Reboot
    ... Hi Mike, ... suggest you extract a new shutdown.exe file from the Windows XP Setup ... I then use Task Scheduler to schedule the batch job ... The AT command doesn't have this problem and runs ...
    (microsoft.public.windowsxp.security_admin)