# Running as a service on a windows OS

**URL:** <https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639>\
**Category:** General\
**Created:** [17 December 2020 03:35 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639 "2020-12-17T03:35:55Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 December 2020 11:28 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/21 "2020-12-18T11:28:21Z")

</div>

No, just show me the shortcut and its path and its content of the one you use to run "alternate-node-red-installer"

---

<div class="post-metadata">

**Author:** ![Henjoe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henjoe/32/52335_2.png) [@Henjoe](https://discourse.nodered.org/u/Henjoe)\
**Post date:** [18 December 2020 11:32 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/22 "2020-12-18T11:32:59Z")

</div>

Okay Steve,

For this parameter: (Application under "path")

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/b/3bdd27cbd88880a7d8d666192ab778064ede4a7b.png)

This is the "path" I am trying to use:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/a/8a6750bed16765a8bf15e1faa769f09d0d8ddd75.png)

This is actually the master folder path for my alternate-node-red-installer.

Again, if I used a CMD and go to this path and run the "npm start" command, my node-red instance can succesfully run.

What I wanna do is to automate that "auto-run of my node-red instance" using the nssm. However, I am having an issue with the parameters needs to fill out on the nssm side.

I hope this answer your question.

Thank you Steve.

With kind regards,  
Henjoe

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 December 2020 11:38 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/23 "2020-12-18T11:38:42Z")

</div>

ok, step back one minute - forget NSSM for now - I need to be 100% clear on what you (physically you Mr Henjoe) do to start up the "alternative node-red"

What do you click, what do you type.

i need to see the path of that item, the details of that action, the contents of a shortcut or batch file.

---

<div class="post-metadata">

**Author:** ![Henjoe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henjoe/32/52335_2.png) [@Henjoe](https://discourse.nodered.org/u/Henjoe)\
**Post date:** [18 December 2020 11:40 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/24 "2020-12-18T11:40:54Z")

</div>

Hi Steve,

This is what I did to run the alternate-node-red-installer without nssm.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/2550025b6a60f9df949c1ed2b6f01c7e7799a125.png)

Thank you.

With kind regards,  
Henjoe

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 December 2020 11:45 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/25 "2020-12-18T11:45:26Z")

</div>

OK, now we are getting somewhere.

1. **As user `40800736` you oopen a CMD window**
2. CD to folder "nodered-offline"
3. enter `npm start`

^ this is what you need to automate. the important parts are "As user 40800736", "the folder / path" the command "npm" and the command line variable "start"

Remember this...

> [@Steve-Mcl](#):
>
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/5/d514bf42be00ed61843731e6e3bcdbd689b0751a.png)

did you try that?

BUT

ALSO

REMEMBER

You (account name 40800736) is running this project. that brings us back to this...

> [@Henjoe](#):
>
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c6982926f786e6f7cb4238507fb2e170a5dab219.png)

^ see how it is NOT running as user 40800736?

* * *

---

<div class="post-metadata">

**Author:** ![Henjoe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henjoe/32/52335_2.png) [@Henjoe](https://discourse.nodered.org/u/Henjoe)\
**Post date:** [18 December 2020 11:47 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/26 "2020-12-18T11:47:25Z")

</div>

Yes Steve, I tried this but there were errors when I run the service.

Did you mean, I need to set the Logon configuration into 40800736 user?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 December 2020 11:50 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/27 "2020-12-18T11:50:08Z")

</div>

> [@Henjoe](#):
>
> Did you mean, I need to set the Logon configuration into 40800736 user?

Do you understand how one user on windows has no access to another users "stuff"?

If you dont set the user in NSSM - it will try to run as `system` account.

`system` account IS NOT user `40800736`

So in short - yes, you would need to set NSSM "log on" to the account that you normally use to run alternative node-red.

* * *

_All said - this is a pretty terrible setup overall (running from a user accounts desktop!_

---

<div class="post-metadata">

**Author:** ![Henjoe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henjoe/32/52335_2.png) [@Henjoe](https://discourse.nodered.org/u/Henjoe)\
**Post date:** [18 December 2020 11:52 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/28 "2020-12-18T11:52:51Z")

</div>

Thanks Steve!

Never knew about this!

I'll try to copy my master folder to C:\ Drive and I let you know the result.

With kind regards,  
Henjoe

---

<div class="post-metadata">

**Author:** ![Henjoe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henjoe/32/52335_2.png) [@Henjoe](https://discourse.nodered.org/u/Henjoe)\
**Post date:** [18 December 2020 11:54 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/29 "2020-12-18T11:54:20Z")

</div>

Hi Steve,

So I have this config:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e4febe6469b9b511a2125e321ef8a168e2d24248.png)

Still I have problem. ☹

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 December 2020 11:54 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/30 "2020-12-18T11:54:22Z")

</div>

> [@Henjoe](#):
>
> I'll try to copy my master folder to C:\ Drive and I let you know the result.

That would be a step in the right direction of improving this.  
also, be sure whatever account NSSM has set in the "log on" tab has permissions to the alternative folder

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 December 2020 11:54 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/31 "2020-12-18T11:54:38Z")

</div>

and what is set in "log on"

---

<div class="post-metadata">

**Author:** ![Henjoe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henjoe/32/52335_2.png) [@Henjoe](https://discourse.nodered.org/u/Henjoe)\
**Post date:** [18 December 2020 11:55 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/32 "2020-12-18T11:55:46Z")

</div>

Same Config as before:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/c/8cfdd4dd476490bf32baf4942494503ea85c5cb2.png)

With kind regards,  
Henjoe

---

<div class="post-metadata">

**Author:** ![Henjoe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henjoe/32/52335_2.png) [@Henjoe](https://discourse.nodered.org/u/Henjoe)\
**Post date:** [18 December 2020 12:12 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/33 "2020-12-18T12:12:00Z")

</div>

Hi Everyone and Steve,

Thank you for all your support.  
I finally get it running.

What I did is to create a .bat file that run the "npm start" to my master folder.  
and then use this ".bat" file to the nssm.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/d/5d18b91a62679c6533d9025e91e34775bf82dc87.png)

Again, thanks for all your support.

Thank you.

With kind regards,  
Henjoe

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 December 2020 20:20 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/34 "2020-12-18T20:20:07Z")

</div>

> [@Henjoe](#):
>
> How do you do the automatic run of the node-red?  
> Just like what Steve says, using the nssm, I just don't what parameters need to fill out.

I've already said that I typically don't do that on Windows, I run it manually via PM2 as it better suits how I use it on the PC. My Node-RED server runs on Linux and runs as a systemd service similar to the configuration that is detailed in the installer.

As also mentioned, the parameters are present in the package.json or you can look at the systemd script.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 February 2021 20:20 UTC](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639/35 "2021-02-16T20:20:07Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/running-as-a-service-on-a-windows-os/37639.md?page=1)
