-1

On a Windows 2012 server, there is a script called xyz.bat

When it is run locally as any user who can run it, it works fine.

When it is run locally as SYSTEM in the following way:

psexec /s /i cmd.exe

It also works fine.

When converted to a scheduled task, running as SYSTEM, everything about the script works, except for composer install --no-dev which still creates composer.lock should it not exist, but does NOT pull the files down from the specified repo. This is an internal repo, with all GIT access working appropriately.

Running as a scheduled task where my user is the run as account, it works fine too.

Any thoughts as to what could be causing this? I'm getting ready to have the admin make more user accounts to run these things, but that just seems wrong to have to do, and creates maintenance issues.

yivi
  • 42,438
  • 18
  • 116
  • 138
Mike_K
  • 9,010
  • 5
  • 20
  • 27
  • GIT auth is good. The identical script runs well in every other context other than task scheduler + SYSTEM user. Any permutation other than that is fine. – Mike_K Sep 04 '20 at 15:55
  • ok, but obviously git auth within the task scheduler **is not good**. That's the only thing you need to resolve. Create a simple task that execute a git command and resolve auhtentication issues about that. This is not composer-php related. – yivi Sep 04 '20 at 15:57
  • taking the working task (where it runs as me) and then swapping that to use SYSTEM worked for the first time just now.... Dont know what this was, but at least there is a workaround now... make the task run as me first before letting it run as system... never saw anything like that before. – Mike_K Sep 04 '20 at 16:09
  • Also there were GIT problems earlier but we got past those, that's how it has been ruled out. – Mike_K Sep 04 '20 at 16:10

1 Answers1

0

Ultimately re-making the scheduled task in the following way worked:

  1. Create the scheduled task to be run as my own user
  2. Run it, and verify it was working
  3. Clean up runtime artifacts (delete what composer did as myself)
  4. Update the scheduled task to run as SYSTEM
  5. Run the task by clicking (this hadn't worked before, but did now)
Mike_K
  • 9,010
  • 5
  • 20
  • 27