I have a flow I made that can both create, list, and uninstall services on Windows.
Perhaps it could be of use:
[{"id":"3ac164651f62cdbe","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"6eebe74c856731e4","type":"function","z":"3ac164651f62cdbe","name":"create new service","func":"var Service = nodeWindows.Service\n\n// Create a new service object\nvar svc = new Service({\n name: 'Put a name here',\n description: 'Put a description here.',\n script: 'C:\\\\Full\\\\Path\\\\app.js',\n //nodeOptions: [\n // '--harmony',\n // '--max_old_space_size=4096'\n //]\n workingDirectory: 'C:\\\\Working\\\\Directory\\\\'\n //, allowServiceLogon: true\n});\n\n// Listen for the \"install\" event, which indicates the\n// process is available as a service.\nsvc.on('install', function () {\n svc.start();\n node.send({ \"payload\":`Service has started from install`});\n});\n\nsvc.install();","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"nodeWindows","module":"node-windows"}],"x":270,"y":100,"wires":[["2470a9503c1eb4f4"]]},{"id":"311658685aef434c","type":"inject","z":"3ac164651f62cdbe","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":90,"y":100,"wires":[["6eebe74c856731e4"]]},{"id":"2470a9503c1eb4f4","type":"debug","z":"3ac164651f62cdbe","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":100,"wires":[]},{"id":"0910a6d35a0820de","type":"function","z":"3ac164651f62cdbe","name":"list services verbose","func":"var wincmd = nodeWindows;\n\nwincmd.list(function (svc) {\n node.send({\"payload\":svc});\n node.done();\n}, true);","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"nodeWindows","module":"node-windows"}],"x":280,"y":260,"wires":[["4904a3fe2c5f9f16"]]},{"id":"ed4c90a8b83430b0","type":"inject","z":"3ac164651f62cdbe","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":90,"y":260,"wires":[["0910a6d35a0820de"]]},{"id":"4904a3fe2c5f9f16","type":"debug","z":"3ac164651f62cdbe","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":260,"wires":[]},{"id":"01ed7832a814ff87","type":"function","z":"3ac164651f62cdbe","name":"kill process by PID","func":"var wincmd = nodeWindows;\n\nwincmd.kill(msg.pid, function () {\n node.send({ \"payload\":`Process ${msg.pid} has been Killed`});\n node.done();\n});","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"nodeWindows","module":"node-windows"}],"x":270,"y":320,"wires":[["f4ed3ef1a87c4117"]]},{"id":"fbb851a46cce76e7","type":"inject","z":"3ac164651f62cdbe","name":"","props":[{"p":"pid","v":"","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":90,"y":320,"wires":[["01ed7832a814ff87"]]},{"id":"f4ed3ef1a87c4117","type":"debug","z":"3ac164651f62cdbe","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":320,"wires":[]},{"id":"0350d10dd71106ad","type":"function","z":"3ac164651f62cdbe","name":"list services","func":"var wincmd = nodeWindows;\n\nwincmd.list(function (svc) {\n node.send({\"payload\":svc});\n node.done();\n}, false);","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"nodeWindows","module":"node-windows"}],"x":250,"y":220,"wires":[["db5f09e69d76fc08"]]},{"id":"8f0a9279c87c9b33","type":"inject","z":"3ac164651f62cdbe","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":90,"y":220,"wires":[["0350d10dd71106ad"]]},{"id":"db5f09e69d76fc08","type":"debug","z":"3ac164651f62cdbe","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":220,"wires":[]},{"id":"1338123e6a74df57","type":"function","z":"3ac164651f62cdbe","name":"uninstall service","func":"var Service = nodeWindows.Service\n\n// Create a new service object\nvar svc = new Service({\n name: 'Put a name here',\n script: 'C:\\\\Full\\\\Path\\\\app.js'\n});\n\n// Listen for the \"uninstall\" event so we know when it's done.\nsvc.on('uninstall', function () {\n node.send({ \"payload\": `Uninstall complete.`});\n node.send({ \"payload\": `The service exists, ${svc.exists}`});\n});\n\n// Uninstall the service.\nsvc.uninstall();","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"nodeWindows","module":"node-windows"}],"x":260,"y":160,"wires":[["b93a4bd95dff2ca8"]]},{"id":"452b9cb84794a9fd","type":"inject","z":"3ac164651f62cdbe","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":90,"y":160,"wires":[["1338123e6a74df57"]]},{"id":"b93a4bd95dff2ca8","type":"debug","z":"3ac164651f62cdbe","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":160,"wires":[]},{"id":"9209aa14249a8ac3","type":"comment","z":"3ac164651f62cdbe","name":"Run app.js as a service in Windows","info":"","x":280,"y":40,"wires":[]}]
However, it does require the external module node-windows
to be installed.
You just need to specify an absolute file path, name, and description in the functions.