diff --git a/scripts/Windows/OS/Setup.ps1 b/scripts/Windows/OS/Setup.ps1 index 970fcf05..422e6dcd 100644 --- a/scripts/Windows/OS/Setup.ps1 +++ b/scripts/Windows/OS/Setup.ps1 @@ -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 = `