# Elaticsearch service doesn't start automatically (Windows)

**URL:** <https://discuss.elastic.co/t/elaticsearch-service-doesnt-start-automatically-windows/112433>\
**Category:** Elasticsearch\
**Created:** [December 19, 2017, 12:35pm UTC](https://discuss.elastic.co/t/elaticsearch-service-doesnt-start-automatically-windows/112433 "2017-12-19T12:35:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![teejayuu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/teejayuu/32/18356_2.png) [@teejayuu](https://discuss.elastic.co/u/teejayuu)\
**Post date:** [December 19, 2017, 12:35pm UTC](https://discuss.elastic.co/t/elaticsearch-service-doesnt-start-automatically-windows/112433/1 "2017-12-19T12:35:10Z")

</div>

Trying to install ES to a Windows 2012 R2 server from a zip file following [https://www.elastic.co/guide/en/elasticsearch/reference/current/zip-windows.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/zip-windows.html).

Have set the logs and data folder to a separate location and added an environment variable for SERVICE\_LOG\_DIR and set ES\_START\_TYPE to auto (confirmed using .\bin\elasticsearch-service.bat manager).

If I restart the server the service fails to start, BUT I can start it manually, however it immediately stops again.

The Windows event logs show an error on starting but the only information is:

```
The Elasticsearch 6.1.0 (elasticsearch-service-x64) service terminated with the following service-specific error:

Incorrect function.

```

I have had a similar error if I install ES using the msi as well. Is there a problem with the Service starting automatically in ES 6.1.0?

---

<div class="post-metadata">

**Author:** ![teejayuu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/teejayuu/32/18356_2.png) [@teejayuu](https://discuss.elastic.co/u/teejayuu)\
**Post date:** [December 19, 2017, 12:59pm UTC](https://discuss.elastic.co/t/elaticsearch-service-doesnt-start-automatically-windows/112433/2 "2017-12-19T12:59:42Z")

</div>

Used ${HOSTNAME} as node name...obviously didn't like it

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [December 19, 2017, 11:06pm UTC](https://discuss.elastic.co/t/elaticsearch-service-doesnt-start-automatically-windows/112433/3 "2017-12-19T23:06:18Z")

</div>

On Windows, use `${COMPUTERNAME}` _instead of_ `${HOSTNAME}`

---

<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 16, 2018, 11:06pm UTC](https://discuss.elastic.co/t/elaticsearch-service-doesnt-start-automatically-windows/112433/4 "2018-01-16T23:06:22Z")

</div>

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