fix(installer): reject CurrentUser service account without password
This commit is contained in:
@@ -46,10 +46,9 @@ public sealed class RegisterServiceStep : IInstallStep
|
|||||||
var createArgs = $"create {ServiceName} binPath= \"{workerExe}\" start= {startType}";
|
var createArgs = $"create {ServiceName} binPath= \"{workerExe}\" start= {startType}";
|
||||||
|
|
||||||
if (ctx.ServiceAccount == "CurrentUser")
|
if (ctx.ServiceAccount == "CurrentUser")
|
||||||
{
|
return StepResult.Fail(
|
||||||
var username = Environment.UserName;
|
"Service cannot run as Current User without a password. " +
|
||||||
createArgs += $" obj= \".\\{username}\"";
|
"Select 'Local System' or extend ServicePage to capture a password.");
|
||||||
}
|
|
||||||
|
|
||||||
progress.Report("Creating service...");
|
progress.Report("Creating service...");
|
||||||
var (exitCode, output) = await RunSc(createArgs, ctx, progress, ct);
|
var (exitCode, output) = await RunSc(createArgs, ctx, progress, ct);
|
||||||
|
|||||||
Reference in New Issue
Block a user