6

Is there a way to invoke and execute a .ps1 file using REST/JSOM?

I am hoping to deploy a SharePoint Hosted App that runs a powershell script on the server.

5
  • dont think so, but you can call a custom service which will execute the csom code to deploy sharepoint hosted app Commented Jul 4, 2017 at 8:52
  • @GautamSheth the sp hosted app should have the provision to invoke and run powershell scripts. So, the options with me are Rest and JSOM. Can you please elaborate? Commented Jul 4, 2017 at 8:53
  • i dont think its possible to execute ps1 script from REST/JSOM. You can create a custom webservice(web api) on azure. This service will deploy the sp hosted app using CSOM code. Commented Jul 4, 2017 at 9:19
  • did the above mentioned solution work with SharePoint App? Commented Aug 8, 2017 at 14:39
  • @Poornima with slight alteration, it should Commented Aug 10, 2017 at 4:47

1 Answer 1

4

Yes, You can call your executable powershell scripts *.ps1 using REST api as HTTP GET is supported by all programming language (javascript in your case).

This msdn blog will help you:

Simple HTTP api for Executing PowerShell Scripts

1
  • Thanks, DvG. Looks promising. I am trying this. Will choose this as answer if it works :) Commented Jul 4, 2017 at 9:59

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.