Install-NodeService.ps1

I've built a PowerShell script that will install any NodeJS application as a Windows Service. I've used it on several projects and is working pretty nice. I'm going to try and make a version that is PSCore & .NET Core compatible, so I can get it to work on *Nix as well.

Edit: I think it might be helpful to add a working example. :wink:

Install-NodeService -ServiceName "NodeRED-DEV" -InstallPath 'C:\Users\mbramer\Documents\Node-RED-DEV\node_modules\node-red' -ScriptPath "C:\Users\mbramer\Documents\Node-RED-DEV\node_modules\node-red\red.js" -RuntimeArgs "--harmony" -ScriptArgs @("--port", "1881", "--userDir", "C:\Users\mbramer\Documents\Node-RED-DEV\config")

You'll want to make sure the config folder exists first, since it's being passed in as the --userDir.

2 Likes