Set the name of the setup user properly

This commit is contained in:
Manuel Thalmann 2024-08-06 10:22:50 +02:00
parent 5ad6fa685b
commit 5d16278931

View file

@ -205,8 +205,15 @@ function Start-Setup {
$computerName.InnerText = "$env:WIN_COMPUTER_NAME";
# Execute corresponding installer script after startup
$oobeSystemSettings = Get-PassSettings "oobeSystem";
$installationCommand = $oobeSystemSettings.SelectSingleNode("./ua:component/ua:FirstLogonCommands/ua:SynchronousCommand[last()]", $namespace);
$oobeSettings = (Get-Component (Get-PassSettings "oobeSystem") "Microsoft-Windows-Shell-Setup");
foreach ($xpath in @("./ua:AutoLogon/ua:Username",
"./ua:UserAccounts/ua:LocalAccounts/ua:LocalAccount/Name",
"./ua:UserAccounts/ua:LocalAccounts/ua:LocalAccount/DisplayName")) {
$oobeSettings.SelectSingleNode($xpath, $namespace).InnerText = $valhallaConfig.setupUser;
}
$installationCommand = $oobeSettings.SelectSingleNode("./ua:FirstLogonCommands/ua:SynchronousCommand[last()]", $namespace);
$newCommand = $installationCommand.ParentNode.AppendChild($installationCommand.CloneNode($true));
$newCommand.SelectSingleNode("./ua:CommandLine", $namespace).InnerText = `