# Insert new users with script

**URL:** <https://forum.inductiveautomation.com/t/insert-new-users-with-script/12494>\
**Category:** Ignition\
**Created:** [December 22, 2016, 8:04pm UTC](https://forum.inductiveautomation.com/t/insert-new-users-with-script/12494 "2016-12-22T20:04:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MoisesZV](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@MoisesZV](https://forum.inductiveautomation.com/u/MoisesZV)\
**Post date:** [December 22, 2016, 8:04pm UTC](https://forum.inductiveautomation.com/t/insert-new-users-with-script/12494/1 "2016-12-22T20:04:49Z")

</div>

Hi, I want to insert new users and Roles when a client push a Button. I know I have to insert the username to “scada\_users” and the role to scada\_user\_rl but when I tried to log in I received a login Failed error. The diference I can see is the password column have encrypted data and when I insert the password it’s not.

---

<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:** [December 22, 2016, 8:40pm UTC](https://forum.inductiveautomation.com/t/insert-new-users-with-script/12494/2 "2016-12-22T20:40:54Z")

</div>

This thread should help you out. 🙂

EDIT: Look further down in this thread.,..

---

<div class="post-metadata">

**Author:** ![MoisesZV](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@MoisesZV](https://forum.inductiveautomation.com/u/MoisesZV)\
**Post date:** [December 23, 2016, 1:27pm UTC](https://forum.inductiveautomation.com/t/insert-new-users-with-script/12494/3 "2016-12-23T13:27:44Z")

</div>

Thanks Jordan, it works great!

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 29, 2019, 4:18am UTC](https://forum.inductiveautomation.com/t/insert-new-users-with-script/12494/4 "2019-03-29T04:18:32Z")

</div>

Hi Jordan, any chance you can relink this as it didn’t make it across from the forum upgrade 🙂

---

<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 29, 2019, 10:16am UTC](https://forum.inductiveautomation.com/t/insert-new-users-with-script/12494/5 "2019-03-29T10:16:30Z")

</div>

I think it was this one...

> [@Add Users and Roles in Event Script](http://forum.inductiveautomation.com/t/add-users-and-roles-in-event-script/10381/2):
>
> Hi Adnan, You can do this if you set up your User Source with a type of Database, meaning that the user and role details are stored in a SQL database. You can then create a script to write directly to the correct tables: user details go in the auth\_users table, roles in the auth\_roles table and users are mapped to roles in the auth\_user\_rl table. The easiest thing to do is create a User Source with a type of Database and add a dummy user before looking at the tables to see how those details a…
