fix(installer): reject CurrentUser service account without password

This commit is contained in:
mika kuns
2026-04-17 14:20:09 +02:00
parent dc4571a338
commit f10ad69863

View File

@@ -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);