Windows OEM setup resumes on the next boot when interrupted (RunOnce re-arm until finished.txt)
Browse files at this commit27ceb05f23eb41b7a7e0c91211a7859b4ce132c7Parent: d0f7025- fix
- Windows OEM setup resumes on the next boot when interrupted (RunOnce re-arm until finished.txt)
- a Build cancelled during first logon left the VM without sshd forever
1 changed file +3 -0
crates/client/src/release/install.batmodified+3 -0
| @@ -1,7 +1,10 @@ | |||
| 1 | @echo off | 1 | @echo off |
| 2 | +if exist C:\OEM\finished.txt exit /b | ||
| 3 | +reg add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v yumush /d C:\OEM\install.bat /f | ||
| 2 | powershell -NoProfile -ExecutionPolicy Bypass -Command "Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0; Set-Service sshd -StartupType Automatic; Start-Service sshd; New-NetFirewallRule -Name sshd -DisplayName sshd -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -ErrorAction SilentlyContinue; Set-Content -Path C:\ProgramData\ssh\administrators_authorized_keys -Value '{key}'; icacls C:\ProgramData\ssh\administrators_authorized_keys /inheritance:r /grant 'Administrators:F' /grant 'SYSTEM:F'; New-ItemProperty -Path 'HKLM:\SOFTWARE\OpenSSH' -Name DefaultShell -Value 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -PropertyType String -Force" | 4 | powershell -NoProfile -ExecutionPolicy Bypass -Command "Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0; Set-Service sshd -StartupType Automatic; Start-Service sshd; New-NetFirewallRule -Name sshd -DisplayName sshd -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -ErrorAction SilentlyContinue; Set-Content -Path C:\ProgramData\ssh\administrators_authorized_keys -Value '{key}'; icacls C:\ProgramData\ssh\administrators_authorized_keys /inheritance:r /grant 'Administrators:F' /grant 'SYSTEM:F'; New-ItemProperty -Path 'HKLM:\SOFTWARE\OpenSSH' -Name DefaultShell -Value 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -PropertyType String -Force" |
| 3 | curl.exe -L -o C:\vs_BuildTools.exe https://aka.ms/vs/17/release/vs_BuildTools.exe | 5 | curl.exe -L -o C:\vs_BuildTools.exe https://aka.ms/vs/17/release/vs_BuildTools.exe |
| 4 | C:\vs_BuildTools.exe --quiet --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended | 6 | C:\vs_BuildTools.exe --quiet --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended |
| 5 | curl.exe -L -o C:\rustup-init.exe https://win.rustup.rs/x86_64 | 7 | curl.exe -L -o C:\rustup-init.exe https://win.rustup.rs/x86_64 |
| 6 | C:\rustup-init.exe -y --default-toolchain none --profile minimal | 8 | C:\rustup-init.exe -y --default-toolchain none --profile minimal |
| 9 | +reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v yumush /f | ||
| 7 | echo done > C:\OEM\finished.txt | 10 | echo done > C:\OEM\finished.txt |