cschneegans / unattend-generator

.NET Core library to create highly customized autounattend.xml files
https://schneegans.de/windows/unattend-generator/
MIT License
491 stars 42 forks source link

[REQUEST] How to have only 2 requests during the installation phase #62

Open Victory61 opened 1 week ago

Victory61 commented 1 week ago

Good morning I generated the response file and it is all OK, without any request during the installation. I wanted to ask how to modify the obtained xml file in such a way that during the installation I get only 2 requests: Username and Password. Thank you very much

`<?xml version="1.0" encoding="utf-8"?>

it-IT 0410:00000410 it-IT it-IT it-IT VK7JG-NPHTM-C97JM-9MPGT-3V66T true 1 reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassTPMCheck /t REG_DWORD /d 1 /f 2 reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassSecureBootCheck /t REG_DWORD /d 1 /f 3 reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassRAMCheck /t REG_DWORD /d 1 /f 1 reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v BypassNRO /t REG_DWORD /d 1 /f 2 net.exe accounts /maxpwage:UNLIMITED 3 reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT" 4 reg.exe add "HKU\DefaultUser\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f 5 reg.exe unload "HKU\DefaultUser" 6 reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT" 7 reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "SearchboxTaskbarMode" /t REG_SZ /d "reg.exe add HKCU\Software\Microsoft\Windows\CurrentVersion\Search /v SearchboxTaskbarMode /t REG_DWORD /d 2 /f" /f 8 reg.exe unload "HKU\DefaultUser" 0410:00000410 it-IT it-IT it-IT Admin Administrators password true</PlainText> </Password> </LocalAccount> <LocalAccount wcm:action="add"> <Name>User</Name> <Group>Users</Group> <Password> <Value>password</Value> <PlainText>true</PlainText> </Password> </LocalAccount> </LocalAccounts> </UserAccounts> <AutoLogon> <Username>Admin</Username> <Enabled>true</Enabled> <LogonCount>1</LogonCount> <Password> <Value>password</Value> <PlainText>true</PlainText> </Password> </AutoLogon> <OOBE> <ProtectYourPC>3</ProtectYourPC> <HideEULAPage>true</HideEULAPage> <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> </OOBE> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <CommandLine>reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoLogonCount /t REG_DWORD /d 0 /f</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component> </settings> </unattend>` </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/cschneegans"><img src="https://avatars.githubusercontent.com/u/30263434?v=4" />cschneegans</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>There is no built-in support for setting username and password dynamically.</p> <p>I would try the following: Let Windows Setup enable the “Administrator” account and don't create any other accounts:</p> <p><img src="https://github.com/user-attachments/assets/9acb5645-345e-4da7-9ca3-6213c7ebfd23" alt="image" /></p> <p>Then add a custom .ps1 script to run “when the first user logs on after Windows has been installed”, like so:</p> <pre><code>$username = Read-Host -Prompt 'Enter username'; $password = Read-Host -Prompt 'Enter password'; New-LocalUser -Name $username -Password( ConvertTo-SecureString -String $password -AsPlainText -Force ) -AccountNeverExpires -PasswordNeverExpires; Get-LocalUser -Name Administrator | Disable-LocalUser</code></pre> <p>I have not tested this.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Victory61"><img src="https://avatars.githubusercontent.com/u/97799367?v=4" />Victory61</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>Thank you for the suggestion. In the 23H2 version I always used the script that I attach. In version 24H2 it doesn't work and I don't know how to modify it to make it compatible , this only allows the two requests for Username and Password. Thank you <a href="https://justpaste.it/du8ml">https://justpaste.it/du8ml</a></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/kzshantonu"><img src="https://avatars.githubusercontent.com/u/7745374?v=4" />kzshantonu</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>@Victory61 if you use ventoy, you can use <code>$$VARNAME$$</code>. Ventoy will then ask you to type whatever you want into those variables. </p> <p><a href="https://www.ventoy.net/en/plugin_autoinstall.html">https://www.ventoy.net/en/plugin_autoinstall.html</a></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/cschneegans"><img src="https://avatars.githubusercontent.com/u/30263434?v=4" />cschneegans</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <blockquote> <p><a href="https://justpaste.it/du8ml">https://justpaste.it/du8ml</a></p> </blockquote> <p>That file has no <code>&lt;UserAccounts&gt;</code> elements, hence Windows Setup will ask for the username. You can easily achieve this result when you select this setting:</p> <p><img src="https://github.com/user-attachments/assets/257d4901-c527-4840-86d8-aae5bdc36587" alt="image" /></p> <p>However, while 23H2 let you create a local account, 24H2 practically forces you to create a Microsoft account.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Victory61"><img src="https://avatars.githubusercontent.com/u/97799367?v=4" />Victory61</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>@cschneegans Unfortunately, that selection offers me 3 requests and access to the Microsoft account</p> <p><img src="https://github.com/user-attachments/assets/492b4073-307a-42fd-97cc-681c4b19aaf3" alt="rid1" /> <img src="https://github.com/user-attachments/assets/843ea0b3-34ef-4fe7-9081-b5dd89d8bc76" alt="rid2" /> <img src="https://github.com/user-attachments/assets/82868ad1-5d27-44b8-b4e3-497e033ed0fc" alt="rid3" /></p> <p>With the <strong>23H2</strong> script I only have 2 requests that I am interested in. In addition, the username option allows me to start the machine in <strong>audit mode</strong> (CTRL+SHIFT+F3)</p> <p><img src="https://github.com/user-attachments/assets/5e293856-bd73-4a78-8ee4-ba607c5092a7" alt="rid 4" /> <img src="https://github.com/user-attachments/assets/4d9b89f2-6aaf-4c3f-b19d-79441400fec7" alt="rid 5" /></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Victory61"><img src="https://avatars.githubusercontent.com/u/97799367?v=4" />Victory61</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <blockquote> <p>@Victory61 se usi ventoy, puoi usare <code>$$VARNAME$$</code>. Ventoy ti chiederà quindi di digitare quello che vuoi in quelle variabili.</p> <p><a href="https://www.ventoy.net/en/plugin_autoinstall.html">https://www.ventoy.net/en/plugin_autoinstall.html </a></p> </blockquote> <p>Gazie for the suggestion. I am not familiar with this procedure, I will try to figure out how to get the two requests.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Victory61"><img src="https://avatars.githubusercontent.com/u/97799367?v=4" />Victory61</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>@cschneegans <img src="https://github.com/user-attachments/assets/af7e88b2-3215-423a-8ac0-9be708eda266" alt="Immagine 2024-10-03 180031" /></p> <p>I entered the script but I get no request the installation proceeds as per the settings automatically until the end creating the user automatically.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/cschneegans"><img src="https://avatars.githubusercontent.com/u/30263434?v=4" />cschneegans</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>I just re-examined the <code>autounattend.xml</code> you posted earlier, which sets both the <em><strong>Let Windows Setup create the following local (“offline”) accounts</strong></em> and the <em><strong>Let Windows generate a random computer name like DESKTOP-ZFAH8Z2</strong></em> options. Therefore, you should not see any of the dialogs from the screenshots you posted.</p> <p>This is very similar to #63 – which .iso image did you use?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Victory61"><img src="https://avatars.githubusercontent.com/u/97799367?v=4" />Victory61</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>I downloaded the ISO from Media Creation Tool 24H2b26100.1742</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Victory61"><img src="https://avatars.githubusercontent.com/u/97799367?v=4" />Victory61</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>I finally succeeded. I made a change to the generated script, inserting blocks from the old script, and I get the two requests and can also enter audit mode. <a href="https://justpaste.it/gucsx">https://justpaste.it/gucsx</a></p> <p>With this procedure on a virtual machine I was able to enable Audit mode to update the wim file with the sysprep procedure. But I detected other problem, the captured vim file, even without any processing inside it and reinserted in the ISO, trying to install generates the same kind of error at the 75% rate. At this point I can't capier if it is the sys prep procedure that generates the vim file that causes problems. I didn't think I would find these difficulties with the 24H2 version downloaded from Media Creation Tool.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Victory61"><img src="https://avatars.githubusercontent.com/u/97799367?v=4" />Victory61</a> commented <strong> 1 week ago</strong> </div> <div class="markdown-body"> <p>Good morning. Even inserting the file created by the generator I get the same error, I tried not inserting any autounattend file and the installation was successful, obviously with all the requirements. So I assume the incompatibility is created by the autounattend file after the procedure with sys prep.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>