Prover floor route 1 step 1: the elevated WSL2-enable job for PC 1 (two features, no restart inside the job)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
338e32e1fd
commit
512b081f05
1 changed files with 28 additions and 0 deletions
28
tools/prover-floor/pc1-wsl2-enable.ps1
Normal file
28
tools/prover-floor/pc1-wsl2-enable.ps1
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Prover floor, route 1, step 1 (6 October 2026, the project lead at 11:25Z: YES to WSL2 on PC 1, one administrator prompt plus
|
||||
# a reboot). Published --elevated: the UAC prompt is the job's first step. Enables the two Windows features WSL2
|
||||
# needs, no distribution, no restart inside the job (the project lead reboots on the coordinator's word). The RESULT line says
|
||||
# "reboot needed" when Windows asks for one. Touches nothing else: the installed app, the miners and the node run on.
|
||||
$ErrorActionPreference = 'Continue'
|
||||
function Stamp { (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') }
|
||||
"RESULT start $(Stamp) machine=$env:COMPUTERNAME elevated=$(([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))"
|
||||
"RESULT windows $((Get-CimInstance Win32_OperatingSystem).Caption) build $((Get-CimInstance Win32_OperatingSystem).BuildNumber)"
|
||||
"RESULT gpus $((& nvidia-smi --query-gpu=index,name,memory.total,memory.used --format=csv,noheader,nounits 2>$null) -join ' | ')"
|
||||
$features = @('Microsoft-Windows-Subsystem-Linux', 'VirtualMachinePlatform')
|
||||
$restart = $false
|
||||
foreach ($f in $features) {
|
||||
$before = (Get-WindowsOptionalFeature -Online -FeatureName $f -ErrorAction SilentlyContinue).State
|
||||
"RESULT feature $f before=$before"
|
||||
if ("$before" -eq 'Enabled') { continue }
|
||||
try {
|
||||
$r = Enable-WindowsOptionalFeature -Online -FeatureName $f -NoRestart -ErrorAction Stop
|
||||
$after = (Get-WindowsOptionalFeature -Online -FeatureName $f -ErrorAction SilentlyContinue).State
|
||||
"RESULT feature $f enable=ok after=$after restart_needed=$($r.RestartNeeded)"
|
||||
if ($r.RestartNeeded) { $restart = $true }
|
||||
} catch {
|
||||
"RESULT feature $f enable=FAILED $($_.Exception.Message)"
|
||||
}
|
||||
}
|
||||
$wslState = try { (& wsl.exe --status 2>&1 | Out-String) -replace "`0", '' } catch { "wsl.exe not callable: $_" }
|
||||
"RESULT wsl_status $(($wslState -split "`r?`n" | Where-Object { $_.Trim() } | Select-Object -First 3) -join ' | ')"
|
||||
if ($restart) { "RESULT reboot needed: the features are enabled and Windows asks for a restart before WSL2 can start" } else { "RESULT no reboot needed (the features were already enabled or Windows asked for none)" }
|
||||
"RESULT end $(Stamp)"
|
||||
Loading…
Reference in a new issue