Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions godbrain_core/reclaim11/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ stay locked until a WinPE receipt.

## What to do

1. Get `Reclaim11-kit-v9.zip` from
[GitHub Releases](https://github.com/usrname1git/GodBrain/releases/tag/reclaim11-v9)
1. Get `Reclaim11-kit-v10.zip` from
[GitHub Releases](https://github.com/usrname1git/GodBrain/releases/tag/reclaim11-v10)
and unzip it. Check the `.sha256` next to the zip.
2. Double-click `Reclaim11.cmd`. You do not type `pwsh`.
2. Double-click `Reclaim11.cmd`. You do not type `pwsh`. If you only have
Windows PowerShell 5.1, the GUI offers the official PowerShell 7 MSI
(adds PATH). WinPE stays 5.1.
3. Click **TEST FIRST** (noob door) or **TEST SELECTED** (expert).
Nothing is deleted. Read the log.
4. Then pick a door:
Expand Down Expand Up @@ -58,10 +60,10 @@ ADK + WinPE addon **10.1.26100.2454**, not ADK 28000.
pwsh -NoProfile -File .\scripts\New-Reclaim11WinPeIso.ps1
```

Output: `C:\Reclaim11\Reclaim11-WinPE-v9.iso`.
Output: `C:\Reclaim11\Reclaim11-WinPE-v10.iso`.
v1/v2 copied EXE over `.sys` and bootloop; do not attach those.

Snapshot, attach **v9**. PE **deletes** catalog
Snapshot, attach **v10**. PE **deletes** catalog
`drivers\WdBoot.sys` / `WdFilter.sys` / `WdNisDrv.sys` / `WdDevFlt.sys`
(exact names, never a `Wd*.sys` glob), stubs catalog usermode EXEs,
`reg delete` pack-A keys then Start=4 fallback, IFEO +
Expand Down
2 changes: 1 addition & 1 deletion godbrain_core/reclaim11/catalog.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "reclaim11-pack-a-v1",
"kit_version": "9",
"kit_version": "10",
"pack": "A",
"trust": "candidate",
"auto_verify": "never",
Expand Down
19 changes: 16 additions & 3 deletions godbrain_core/reclaim11/ps1/Reclaim11.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ $here = Get-Reclaim11Root
. (Join-Path $ps1Dir "telemetry_cleanse.ps1")
. (Join-Path $ps1Dir "nic_tune.ps1")
. (Join-Path $ps1Dir "latency_bake.ps1")
. (Join-Path $ps1Dir "install_pwsh.ps1")

function Write-Reclaim11InventoryFile {
param($Inventory, [string]$Path)
Expand Down Expand Up @@ -100,6 +101,18 @@ if ($sta -ne "STA" -or -not $admin) {
return
}

if ($PSVersionTable.PSVersion.Major -lt 7) {
$pwsh7 = Show-Reclaim11PwshOffer
if ($pwsh7) {
$arg = @(
"-STA", "-NoProfile", "-WindowStyle", "Hidden", "-ExecutionPolicy", "Bypass", "-File", $MyInvocation.MyCommand.Path
)
if ($WinPeLog) { $arg += @("-WinPeLog", $WinPeLog) }
Start-Process -FilePath $pwsh7 -ArgumentList $arg -WindowStyle Hidden
Comment on lines +107 to +111
return
}
}

try { $Host.UI.RawUI.WindowTitle = "Reclaim11" } catch { }

$logRoot = [Environment]::GetFolderPath("LocalApplicationData")
Expand Down Expand Up @@ -590,15 +603,15 @@ $btnPrep.Add_Click({
return
}
$isoDir = "C:\Reclaim11"
$want = Join-Path $isoDir "Reclaim11-WinPE-v9.iso"
$want = Join-Path $isoDir "Reclaim11-WinPE-v10.iso"
$iso = $want
foreach ($n in @("Reclaim11-WinPE-v9.iso", "Reclaim11-WinPE.iso", "Reclaim11-WinPE-v8.iso", "Reclaim11-WinPE-v7.iso")) {
foreach ($n in @("Reclaim11-WinPE-v10.iso", "Reclaim11-WinPE-v9.iso", "Reclaim11-WinPE.iso", "Reclaim11-WinPE-v8.iso", "Reclaim11-WinPE-v7.iso")) {
$p = Join-Path $isoDir $n
if (Test-Path -LiteralPath $p) { $iso = $p; break }
}
$have = Test-Path -LiteralPath $iso
$ask = if ($have) {
"ISO already at:`n$iso`n`nRebuild v9 to:`n$want`n`nNeeds ADK + WinPE addon 10.1.26100.2454 (not 28000). Several minutes. DISM only against the WinPE image, not this Windows."
"ISO already at:`n$iso`n`nRebuild v10 to:`n$want`n`nNeeds ADK + WinPE addon 10.1.26100.2454 (not 28000). Several minutes. DISM only against the WinPE image, not this Windows."
} else {
"Build WinPE ISO to:`n$want`n`nNeeds ADK + WinPE addon 10.1.26100.2454 (not 28000). Several minutes. DISM only against the WinPE image, not this Windows."
}
Expand Down
85 changes: 85 additions & 0 deletions godbrain_core/reclaim11/ps1/install_pwsh.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Offer official PowerShell 7 MSI when the GUI started on 5.1.
# GitHub MSI + msiexec ADD_PATH. Never irm|iex, never the Store stub.

function Get-Reclaim11PwshMsiAsset {
$arch = [string]$env:PROCESSOR_ARCHITECTURE
$tag = "win-x64.msi"
if ($arch -eq "ARM64") { $tag = "win-arm64.msi" }
try {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
} catch { }
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("User-Agent", "Reclaim11")
$wc.Headers.Add("Accept", "application/vnd.github+json")
$raw = $wc.DownloadString("https://api.github.com/repos/PowerShell/PowerShell/releases/latest")
$rel = $raw | ConvertFrom-Json
$rx = '^PowerShell-\d+\.\d+\.\d+-' + [regex]::Escape(($tag -replace '\.msi$', '')) + '\.msi$'
foreach ($a in @($rel.assets)) {
$n = [string]$a.name
if ($n -match $rx) {
return [pscustomobject]@{
name = $n
url = [string]$a.browser_download_url
}
}
}
throw ("Install-Reclaim11PwshMsi: no stable {0} on latest GitHub release" -f $tag)
}

function Install-Reclaim11PwshMsi {
if (Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Control\MiniNT") {
throw "Install-Reclaim11PwshMsi: WinPE stays 5.1. Not the GUI host."
}
$have = Get-Reclaim11Pwsh7
if ($have) { return $have }
$asset = Get-Reclaim11PwshMsiAsset
$dir = Join-Path ([Environment]::GetFolderPath("LocalApplicationData")) "Reclaim11\pwsh-msi"
if (-not $dir) { $dir = Join-Path $env:TEMP "Reclaim11\pwsh-msi" }
if (-not (Test-Path -LiteralPath $dir)) {
New-Item -ItemType Directory -Path $dir -Force | Out-Null
}
$msiPath = Join-Path $dir $asset.name
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("User-Agent", "Reclaim11")
$wc.DownloadFile([string]$asset.url, $msiPath)
if (-not (Test-Path -LiteralPath $msiPath)) {
throw "Install-Reclaim11PwshMsi: download missing $msiPath"
}
$msi = Join-Path $env:SystemRoot "System32\msiexec.exe"
Comment on lines +44 to +48
$arg = @(
"/i", $msiPath, "/qn",
"ADD_PATH=1", "REGISTER_MANIFEST=1", "ENABLE_MU=1", "USE_MU=1"
)
Comment on lines +49 to +52
$p = Start-Process -FilePath $msi -ArgumentList $arg -Wait -PassThru
$code = [int]$p.ExitCode
if ($code -ne 0 -and $code -ne 3010) {
throw ("Install-Reclaim11PwshMsi: msiexec exit {0}" -f $code)
}
$have = Get-Reclaim11Pwsh7
if (-not $have) {
throw "Install-Reclaim11PwshMsi: MSI ran but pwsh.exe not under Program Files\PowerShell"
}
$have
}

function Show-Reclaim11PwshOffer {
if (Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Control\MiniNT") { return $null }
if ($PSVersionTable.PSVersion.Major -ge 7) { return $null }
$have = Get-Reclaim11Pwsh7
if ($have) { return $have }
Add-Type -AssemblyName PresentationFramework
$q = [System.Windows.MessageBox]::Show(
"You are on Windows PowerShell 5.1. Reclaim11 wants PowerShell 7.`n`nInstall the latest official PowerShell MSI now? Adds PATH. One click after Yes.",
"Reclaim11 needs PowerShell 7",
"YesNo",
"Warning")
if ($q -ne "Yes") { return $null }
try {
return (Install-Reclaim11PwshMsi)
} catch {
[System.Windows.MessageBox]::Show(
("PowerShell 7 MSI failed:`n{0}`n`nInstall from https://aka.ms/powershell then double-click Reclaim11.cmd again." -f $_.Exception.Message),
"Reclaim11 PowerShell 7") | Out-Null
$null
}
}
18 changes: 16 additions & 2 deletions godbrain_core/reclaim11/ps1/inventory.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,27 @@ function Resolve-Reclaim11Worker {
throw "Resolve-Reclaim11Worker: missing $Name"
}

function Get-Reclaim11Pwsh {
function Get-Reclaim11Pwsh7 {
# Never Get-Command pwsh / where.exe: Win11 Store stub is WindowsApps.
$cands = @(
(Join-Path $PSHOME "pwsh.exe"),
"C:\pwsh\pwsh.exe",
(Join-Path ${env:ProgramFiles} "PowerShell\7\pwsh.exe"),
(Join-Path ${env:ProgramFiles} "PowerShell\pwsh.exe"),
(Join-Path ${env:ProgramFiles} "PowerShell\pwsh.exe")
)
foreach ($c in $cands) {
if ([string]::IsNullOrWhiteSpace($c)) { continue }
if ($c -match 'WindowsApps') { continue }
if ($c -match 'WindowsPowerShell') { continue }
if (Test-Path -LiteralPath $c) { return (Get-Item -LiteralPath $c).FullName }
}
$null
}

function Get-Reclaim11Pwsh {
$pwsh7 = Get-Reclaim11Pwsh7
if ($pwsh7) { return $pwsh7 }
$cands = @(
(Join-Path $PSHOME "powershell.exe"),
(Join-Path $env:SystemRoot "System32\WindowsPowerShell\v1.0\powershell.exe")
)
Expand Down
2 changes: 1 addition & 1 deletion godbrain_core/reclaim11/winpe/offline.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ function Invoke-Reclaim11OfflineApply {
if (-not (Test-Path -LiteralPath $kitDst)) {
New-Item -ItemType Directory -Path $kitDst | Out-Null
}
foreach ($n in @("catalog.json", "inventory.ps1", "killing_blows.ps1", "Apply-KillingBlows.ps1", "noob_cleanse.ps1", "Apply-NoobCleanse.ps1", "Restore-Reclaim11Noob.ps1", "grim_reaper.ps1", "NuclearDefenderWipe-V6_3.ps1", "xbox_cleanse.ps1", "telemetry_cleanse.ps1", "nic_tune.ps1", "latency_bake.ps1", "elevate.ps1", "offline.ps1")) {
foreach ($n in @("catalog.json", "inventory.ps1", "killing_blows.ps1", "Apply-KillingBlows.ps1", "noob_cleanse.ps1", "Apply-NoobCleanse.ps1", "Restore-Reclaim11Noob.ps1", "grim_reaper.ps1", "NuclearDefenderWipe-V6_3.ps1", "xbox_cleanse.ps1", "telemetry_cleanse.ps1", "nic_tune.ps1", "latency_bake.ps1", "install_pwsh.ps1", "elevate.ps1", "offline.ps1")) {
$s = $null
foreach ($cand in @(
(Join-Path $kitFrom $n),
Expand Down
6 changes: 3 additions & 3 deletions scripts/New-Reclaim11KitZip.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[CmdletBinding()]
param(
[string]$RepoRoot = $PSScriptRoot,
[string]$OutZip = "C:\nvme\reclaim11\Reclaim11-kit-v9.zip"
[string]$OutZip = "C:\nvme\reclaim11\Reclaim11-kit-v10.zip"
)

Set-StrictMode -Version Latest
Expand All @@ -14,11 +14,11 @@ $ErrorActionPreference = "Stop"

$kit = $Reclaim11Root
$cat = Get-Content -LiteralPath (Join-Path $kit "catalog.json") -Raw -Encoding UTF8 | ConvertFrom-Json
$ver = "9"
$ver = "10"
if ($cat.PSObject.Properties["kit_version"] -and -not [string]::IsNullOrWhiteSpace([string]$cat.kit_version)) {
$ver = [string]$cat.kit_version
}
if ($OutZip -match 'Reclaim11-kit-v9\.zip$' -and $ver -ne "9") {
if ($OutZip -match 'Reclaim11-kit-v\d+\.zip$' -and $OutZip -notmatch ("Reclaim11-kit-v{0}\.zip$" -f [regex]::Escape($ver))) {
$OutZip = Join-Path (Split-Path -Parent $OutZip) ("Reclaim11-kit-v{0}.zip" -f $ver)
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/New-Reclaim11WinPeIso.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[CmdletBinding()]
param(
[string]$RepoRoot = $PSScriptRoot,
[string]$OutIso = "C:\Reclaim11\Reclaim11-WinPE-v9.iso",
[string]$OutIso = "C:\Reclaim11\Reclaim11-WinPE-v10.iso",
[string]$WorkDir = "C:\Reclaim11\winpe-work",
[string]$StubPath = "C:\Reclaim11\reclaim11-stub.exe",
[switch]$Probe,
Expand Down Expand Up @@ -147,7 +147,7 @@ try {
Copy-Item -LiteralPath $cat -Destination (Join-Path $dest "catalog.json") -Force
Copy-Item -LiteralPath $stub -Destination (Join-Path $dest "DefenderStub.exe") -Force
$ps1Dir = Join-Path $reclaim "ps1"
foreach ($n in @("inventory.ps1", "killing_blows.ps1", "Apply-KillingBlows.ps1", "noob_cleanse.ps1", "Apply-NoobCleanse.ps1", "Restore-Reclaim11Noob.ps1", "grim_reaper.ps1", "NuclearDefenderWipe-V6_3.ps1", "xbox_cleanse.ps1", "telemetry_cleanse.ps1", "nic_tune.ps1", "latency_bake.ps1", "elevate.ps1")) {
foreach ($n in @("inventory.ps1", "killing_blows.ps1", "Apply-KillingBlows.ps1", "noob_cleanse.ps1", "Apply-NoobCleanse.ps1", "Restore-Reclaim11Noob.ps1", "grim_reaper.ps1", "NuclearDefenderWipe-V6_3.ps1", "xbox_cleanse.ps1", "telemetry_cleanse.ps1", "nic_tune.ps1", "latency_bake.ps1", "install_pwsh.ps1", "elevate.ps1")) {
$s = Join-Path $ps1Dir $n
if (-not (Test-Path -LiteralPath $s)) { throw "New-Reclaim11WinPeIso: missing $s" }
Copy-Item -LiteralPath $s -Destination (Join-Path $dest $n) -Force
Expand Down
2 changes: 1 addition & 1 deletion scripts/New-Reclaim11WinPeUsb.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $script:KitFiles = @(
"inventory.ps1", "killing_blows.ps1", "Apply-KillingBlows.ps1",
"noob_cleanse.ps1", "Apply-NoobCleanse.ps1", "Restore-Reclaim11Noob.ps1",
"grim_reaper.ps1", "NuclearDefenderWipe-V6_3.ps1", "xbox_cleanse.ps1", "telemetry_cleanse.ps1",
"nic_tune.ps1", "latency_bake.ps1", "elevate.ps1"
"nic_tune.ps1", "latency_bake.ps1", "install_pwsh.ps1", "elevate.ps1"
)

function Get-Reclaim11Adk {
Expand Down
Loading