0

I have java application which needs run dynamically through the power shell with my WCF c# application. I have tried the following command

System.Diagnostics.Process.Start("powershell.exe", strCmd + " ; timeout 50");

But still I am unable to succeed could tell me how can I do it

3
  • I haven't got any error but the powershell is not running,which I cannot see in the server. Commented Dec 29, 2014 at 15:12
  • The Start method returns the Process so you can check the errors from it. Commented Dec 29, 2014 at 15:13
  • 1
    Capture the output of the command as I explained here Commented Dec 29, 2014 at 15:19

1 Answer 1

1

There are several Things that could be wrong here:

  • Does the WCF service have the required rights to run the PowerShell command?
  • Will the PowerShell command be executed in the correct Directory?
  • Should the conncatination be done before the start command?

Having said that, this is not a good idea, you are opening Your machine to attackers to run any PowerShell script they want.

Sign up to request clarification or add additional context in comments.

1 Comment

i have my dadicate azure VM and i set all required rights to application. and i am running that form Automation dll but i think that is not working, any idea why powershell commands noto fireing, i am createing new azure website site form my ps1 script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.