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}";
if (ctx.ServiceAccount == "CurrentUser")
{
var username = Environment.UserName;
createArgs += $" obj= \".\\{username}\"";
}
return StepResult.Fail(
"Service cannot run as Current User without a password. " +
"Select 'Local System' or extend ServicePage to capture a password.");
progress.Report("Creating service...");
var (exitCode, output) = await RunSc(createArgs, ctx, progress, ct);