The PC join line says to run it as administrator before anything else runs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 13:58:24 -04:00
co-authored by Claude Opus 5.5
parent cc9d752287
commit a54b6b6276
2 changed files with 14 additions and 0 deletions
+5
View File
@@ -583,6 +583,11 @@ def join_windows(cfg, base):
if "$known = @{" not in text:
raise RuntimeError("the Windows template changed: cannot put the program finder in")
text = text.replace("# Status panel remote access", "# Run in PowerShell as administrator: irm %s/join.ps1 | iex\n# Status panel remote access" % base, 1)
# Not elevated: say how, before anything runs (SC's Lighting PC got a DISM error instead, 2026-10-21).
text = text.replace("# Status panel remote access", """# Status panel remote access
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
throw 'Run this as administrator: close this window, right-click Windows PowerShell > Run as administrator, then paste the line again. Nothing was changed.'
}""", 1)
text += """
# 5. Tell %(ingest)s this PC is here: it sets it up within a minute.
$hello = @{ user = $env:USERNAME; name = $env:COMPUTERNAME; os = 'windows'