# Execute PowerShell scripts from Watcher action?

**URL:** <https://discuss.elastic.co/t/execute-powershell-scripts-from-watcher-action/208902>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [November 21, 2019, 2:13pm UTC](https://discuss.elastic.co/t/execute-powershell-scripts-from-watcher-action/208902 "2019-11-21T14:13:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![digitalohm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/digitalohm/32/58099_2.png) [@digitalohm](https://discuss.elastic.co/u/digitalohm)\
**Post date:** [November 21, 2019, 2:13pm UTC](https://discuss.elastic.co/t/execute-powershell-scripts-from-watcher-action/208902/1 "2019-11-21T14:13:43Z")

</div>

I’m investigating ways to automate IT operations and we already use powershell heavily. Is there a way we can create alerts that fire off actions that would execute powershell scripts or commands (ideally commands the size of scripts 😃 )

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [November 21, 2019, 2:21pm UTC](https://discuss.elastic.co/t/execute-powershell-scripts-from-watcher-action/208902/2 "2019-11-21T14:21:53Z")

</div>

Hey @digitalohm,

Welcome to the discussion boards!  
I'm not aware of a way to do this automatically. The closest think I can think of is to build a service which can leverage one of the existing Watcher actions. For example, you could build a web service which can execute Powershell scripts, and then use Watcher's [Webhook action](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/actions-webhook.html) to call this web service.

You could do something similar with the Slack action if you'd prefer too 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 19, 2019, 2:22pm UTC](https://discuss.elastic.co/t/execute-powershell-scripts-from-watcher-action/208902/3 "2019-12-19T14:22:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
