Use well-known account aliases.
authorIain Patterson <me@iain.cx>
Thu, 30 Jan 2014 20:49:43 +0000 (20:49 +0000)
committerIain Patterson <me@iain.cx>
Thu, 30 Jan 2014 21:01:18 +0000 (21:01 +0000)
Jump through a few hoops to make the Windows service control panel to
localise service ObjectNames if they are set to LocalSystem,
LocalService or NetworkService.

Those aren't the canonical names of the accounts as returned by
LsaLookupSids() so attempting to call ChangeServiceConfig() with a
username of, eg, NetworkService will fail, even though writing
NetworkService directly to the registry would work.  Calling
ChangeServiceConfig() with a username of "NT Authority\Network Service"
will work, since that's the canonical name returned by LsaLookupSids()
but it won't be localised in the control panel.

The solution is to write "NT Authority\NetworkService" to the registry
and it will appear correctly.

At this point I'm not sure whether to label it a bug or a feature that
"nssm get <service> ObjectName" will return the actual value in the
registry and not the localised name.

Thanks Marco Certelli.


No differences found