# Executing Windows Script within Watch

**URL:** https://discuss.elastic.co/t/executing-windows-script-within-watch/161149
**Category:** Elasticsearch
**Created:** [December 17, 2018, 12:58pm UTC](https://discuss.elastic.co/t/executing-windows-script-within-watch/161149 "2018-12-17T12:58:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![johncam](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@johncam](https://discuss.elastic.co/u/johncam)
#### Post date: [December 17, 2018, 12:58pm UTC](https://discuss.elastic.co/t/executing-windows-script-within-watch/161149/1 "2018-12-17T12:58:13Z")

</div>

I have a .vbs script that I should like to incorporate as part of a watch, with the alert triggered when the errorlevel exceeds a defined threshold.

Is it possible to execute script files in this fashion, or should I be looking to re-engineer any pre-existing checks scripted like this?

---

<div class="post-metadata">

### Author: ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)
#### Post date: [December 20, 2018, 8:09pm UTC](https://discuss.elastic.co/t/executing-windows-script-within-watch/161149/2 "2018-12-20T20:09:23Z")

</div>

Watcher can't execute system scripts. All scripts in Elasticsearch run in a sandboxed environment. There are two provided languages, only one of which (`painless`) will work within a watcher script. You'll need to rewrite your vbs script in painless if you want to execute it from a watch.

---

<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: [January 17, 2019, 8:16pm UTC](https://discuss.elastic.co/t/executing-windows-script-within-watch/161149/3 "2019-01-17T20:16:44Z")

</div>

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