Asked by:
Powershell Script to run on button click on an asp.net page with SharePoint 2010?

Question
-
my current client has an issue which requires a powershell Script to run to unlock locked workflows.
for some reason, when trying to do it thru a scheduled task on the server, the script throws an error.
Is there a way to get the PowerShell script to run thru C# code? or even thru JS Code with in a webpart?
As the SPAdmin has to manually run the script every three hours . to prevent this, it would be easier to automate the triggering of the script.
Any ideas on how to automate the Powershell Script?
All replies
-
FYI
https://stackoverflow.com/questions/916925/how-to-launch-an-exe-from-web-page-asp-net
Justin Liu Office Apps & Services MVP, MCSE
Senior Software Engineer
Please Vote and Mark as Answer if it helps you. -
Hi cowboy,
You can trigger the PowerShell script using Windows Task Scheduler:
Here is a similar thread in StackOverflow for your reference:
Schedule Powershell script to run every hour
Thanks
Best Regards
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.
SharePoint Server 2019 has been released, you can click here to download it.
Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019. -
-
Hi,
Not know your script logic, but if the button click only trigger the function in PowerShell, it can be also trigger by Task Scheduler.
Thanks
Best Regards
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.
SharePoint Server 2019 has been released, you can click here to download it.
Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.- Edited by Jerry ZyMicrosoft contingent staff Friday, July 19, 2019 12:40 AM
- Proposed as answer by Wendy DZMicrosoft contingent staff, Moderator Monday, July 22, 2019 1:48 AM