« Previous Next »

Thread: powershell script does not complete when launched from IIS

Last post 09-23-2009 3:23 AM by sergeia. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 08-27-2009, 3:40 PM

    • jchertudi
    • Top 500 Contributor
    • Joined on 11-02-2006, 1:48 AM
    • Portland, OR
    • Posts 18

    powershell script does not complete when launched from IIS

    I believe this is the best forum for this, we have a php-cgi script that launches a power shell command, which in turn submits a job to a queuing system.

    We are running php on IIS7 x64. I believe that somewhere this is a permissions issue, but have not been able to crack the code yet. Only when I run our application pool with the account of a system administrator will the job submit to the queue. I have tried to run the application pool  with either NetworkService and a domain guest account. Normal php pages execute, but page that launches powershell will time out and a hanging powershell.exe is left running on the web server doing nothing.

    if i run a powershell command window on the web server directly as the same domain guest account, then the job will complete. We just can not seem to get php to submit a powershell command that completes.

    Any advice or ideas? I have been chasing this as a security issue, I don't want to run this site as a system admin!

    TIA

     

  • 09-01-2009, 2:35 AM In reply to

    Re: powershell script does not complete when launched from IIS

    Hi,

    Please check the Event Viewer to see if any errors are occurring that cause powershell.exe hanging.

    Leo Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • 09-02-2009, 1:41 AM In reply to

    • sergeia
    • Top 100 Contributor
    • Joined on 04-14-2008, 4:47 PM
    • Posts 68

    Re: powershell script does not complete when launched from IIS

    Worker process doesn't have an access to the whole configuration system. It is by design. PowerShell snapin will report access problem, that may or may not be reported in the log. As far as I know, we didn't test the snapin when hosted in the worker process.

     

    --Sergei

  • 09-23-2009, 3:23 AM In reply to

    • sergeia
    • Top 100 Contributor
    • Joined on 04-14-2008, 4:47 PM
    • Posts 68

    Re: powershell script does not complete when launched from IIS

    See my reply on another thread, it is applicable here too. Main difference for you will be hosting PowerShell from inside of PHP. I am not familiar how PHO could execute managed code, but you probably could only start it as separate process, in this case you have to write your script that will take credentials as parameters and execute start-job and then pass this script in command line when you start PowerShell.

     

    --Sergei

Page 1 of 1 (4 items)
Microsoft Communities