Recommended Posts

So I've got PHP running under IIS on a server 2012 R2 machine and I want to do some scheduled task configuration from within a PHP script. So by default IIS uses the IUSR account, so I've created a virtual application and set it to use a different app pool which I've set to use the administrator acount for testing (please do not reply with 'why would you do this' or 'thats insecure' - I really couldn't care less). So I'm trying to run schtasks.exe using PHP but it doesn't seem to work. I thought by using the the administrator account it'd have execute access to all the system files but I'm not sure? There should be some output from the schtasks command as to if it was successful or not but I am just given an empty array by execute(). I'm assuming this is a problem with the IIS configuration.

Any ideas?

If you want to run a php script from a scheduled task, why involve IIS at all? Just find the path to the php executable, and run that from the scheduled task, passing in the path of the php script you want it to run.

  On 19/08/2016 at 10:48, DaveLegg said:

If you want to run a php script from a scheduled task, why involve IIS at all? Just find the path to the php executable, and run that from the scheduled task, passing in the path of the php script you want it to run.

Expand  

I think he wants to do it the other way around, run schtasks from inside a PHP script.

  On 19/08/2016 at 10:49, Danielx64 said:

I think he wants to do it the other way around, run schtasks from inside a PHP script.

Expand  

Ahh, yes, now I read it again, I see that :)

 

Check that you're passing the full path to the executable you want to run, not just the name of the exe file

Hmm OK so it doesn't seem to like me passing parameters using exec(). I've got it outputting a command list (ran with no parameters) when I run it from the normal IIS directory but when I run it from the virtual directory that is my administrator user I still get no output

This topic is now closed to further replies.
  • Posts

    • #1 DP and #8 HDMI, you can connect both monitors to your motherboard. It's not just one or the other, you can use both at the same time.
    • So, I will see exactly ZERO ads, because I f**ked off the stupid Facebook/Meta ages ago. I don't miss any of it at all.
    • Thunderbird 139.0.1 by Razvan Serea Thunderbird is a free, open-source, cross-platform application for managing email and news feeds. It is a local (rather than a web-based) email application that is powerful yet easy-to-use. Thunderbird is clean and elegant by default, but easily customizable to match your workflow and visual preferences. It is loaded with unique and powerful features. Thunderbird is developed, tested, translated and supported by the folks at Mozilla Corporation and by a group of dedicated volunteers. Thunderbird gives you control and ownership over your email. There are lots of add-ons available for Thunderbird that enable you to extend and customize your email experience. Thunderbird gives you IMAP/POP support, a built-in RSS reader, support for HTML mail, powerful quick search, saved search folders, advanced message filtering, message grouping, labels, return receipts, smart address book LDAP address completion, import tools, and the ability to manage multiple e-mail and newsgroup accounts. Thunderbird 139.0.1 fixes: Thunderbird could crash when copying a local folder to IMAP Upgrade to 139.0 incorrectly switched Table View to Cards View Download: Thunderbird 139.0.1 for Windows (EN/US) | 32-bit | ~70.0 MB (Open Source) Download: Thunderbird 139.0.1 for Linux (EN/US) | 74.7 MB Download: Thunderbird 139.0.1 for Mac OS (EN/US) | 127.0 MB Download: Thunderbird 139.0.1 in other languages View: Thunderbird Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • It's both. Bazzite forked the game mode so it's not just simply running big picture mode like on full desktop.
  • Recent Achievements

    • First Post
      ClarkB earned a badge
      First Post
    • Week One Done
      Epaminombas earned a badge
      Week One Done
    • Week One Done
      Prestige Podiatry Care earned a badge
      Week One Done
    • Week One Done
      rollconults earned a badge
      Week One Done
    • Week One Done
      lilred1938 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      142
    2. 2
      Xenon
      130
    3. 3
      ATLien_0
      124
    4. 4
      +Edouard
      102
    5. 5
      snowy owl
      97
  • Tell a friend

    Love Neowin? Tell a friend!