# Send messages to windows event log?

**URL:** <https://forum.inductiveautomation.com/t/send-messages-to-windows-event-log/33367>\
**Category:** Ignition\
**Created:** [March 24, 2020, 5:00pm UTC](https://forum.inductiveautomation.com/t/send-messages-to-windows-event-log/33367 "2020-03-24T17:00:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sonny\_Vallgren](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sonny\_Vallgren](https://forum.inductiveautomation.com/u/Sonny_Vallgren)\
**Post date:** [March 24, 2020, 5:00pm UTC](https://forum.inductiveautomation.com/t/send-messages-to-windows-event-log/33367/1 "2020-03-24T17:00:37Z")

</div>

Has anyone managed to send messages to windows event log from script?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 24, 2020, 5:23pm UTC](https://forum.inductiveautomation.com/t/send-messages-to-windows-event-log/33367/2 "2020-03-24T17:23:08Z")

</div>

You could probably pair [`system.util.execute`](https://docs.inductiveautomation.com/display/DOC80/system.util.execute) with the `eventcreate` builtin function: [https://www.windows-commandline.com/create-event/](https://www.windows-commandline.com/create-event/)

Keep in mind script execution scopes - if you call your script from a Vision button, it’ll go into the local machine’s logs, not the gateway’s; you’ll have to use something like `system.util.sendMessage` if you want to send an event to the gateway to go into a central event viewer.

---

<div class="post-metadata">

**Author:** ![Sonny\_Vallgren](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sonny\_Vallgren](https://forum.inductiveautomation.com/u/Sonny_Vallgren)\
**Post date:** [March 25, 2020, 8:17am UTC](https://forum.inductiveautomation.com/t/send-messages-to-windows-event-log/33367/3 "2020-03-25T08:17:15Z")

</div>

I've tried that and the problem is that i need to run eventCreate via cmd which need to be run as administrator. That where it fails!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 25, 2020, 2:26pm UTC](https://forum.inductiveautomation.com/t/send-messages-to-windows-event-log/33367/4 "2020-03-25T14:26:42Z")

</div>

Hm, even from the gateway scope? I would expect the gateway service to be able to interact with it even when running as ‘LOCAL\_SYSTEM’.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 25, 2020, 4:03pm UTC](https://forum.inductiveautomation.com/t/send-messages-to-windows-event-log/33367/5 "2020-03-25T16:03:59Z")

</div>

A bit of a hacky workaround:

- create a .BAT file with elevated privileges to run cmd
- use system.util.execute to run the .BAT file

---

<div class="post-metadata">

**Author:** ![Sonny\_Vallgren](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sonny\_Vallgren](https://forum.inductiveautomation.com/u/Sonny_Vallgren)\
**Post date:** [March 26, 2020, 9:12am UTC](https://forum.inductiveautomation.com/t/send-messages-to-windows-event-log/33367/6 "2020-03-26T09:12:05Z")

</div>

I think I have to give up on this one, I’ve tried with elevated privileges and I get prompted “Do you allow this app to make changes”. Since I’m not allowed to turn off the notification in windows I assume it wont work.

Thanks for your efforts!
