diff --git a/README.md b/README.md index 0c0e284..3a802a8 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,28 @@ svc.sudo.password = 'password'; ... ``` +**app.js** + +To use Group Managed Service Accounts, append `$` to the end of account name and specify `svc.logOnAs.gmsa = true` + + +```js +var Service = require('node-windows').Service; + +// Create a new service object +var svc = new Service({ + name:'Hello World', + script: require('path').join(__dirname,'helloworld.js'), + allowServiceLogon: true +}); + +svc.logOnAs.domain = 'mydomain.local'; +svc.logOnAs.account = 'username_$'; +svc.logOnAs.gmsa = true; +... +``` + + ### Depending on other services The service can also be made dependant on other Windows services. diff --git a/lib/daemon.js b/lib/daemon.js index e4f90b8..2d62b3d 100644 --- a/lib/daemon.js +++ b/lib/daemon.js @@ -410,6 +410,7 @@ var daemon = function (config) { enumerable: false, writable: true, configurable: false, + gmsa: false, value: { account: null, password: null, diff --git a/lib/winsw.js b/lib/winsw.js index 03b5a85..f9a1bde 100644 --- a/lib/winsw.js +++ b/lib/winsw.js @@ -125,9 +125,12 @@ console.log({loc: 'winsw.js ~line 77', xml, config}) var serviceaccount = [ { domain: config.logOnAs.domain || 'NT AUTHORITY' }, { user: config.logOnAs.account || 'LocalSystem' }, - { password: config.logOnAs.password || '' } ] + if(!config.logOnAs.gmsa){ + serviceaccount.push({ password: config.logOnAs.password || '' }) + } + if (config.allowServiceLogon) { serviceaccount.push({ allowservicelogon: 'true' }) }