1- # Requires -Version 5.1
1+ # Requires -Version 5.1
22<#
33 WinForge-OptionalSetup.ps1
44 Version: 4.1 – FINAL 100% BULLETPROOF EDITION
@@ -29,14 +29,12 @@ $Files = @{
2929 WinUtil = " $CacheDir \winutil.ps1"
3030 Winhance = " $CacheDir \Winhance.exe"
3131 WebView2 = " $CacheDir \WebView2.exe"
32- MAS = " $CacheDir \MAS_AIO.cmd"
3332}
3433
3534$Urls = @ {
3635 WinUtil = " https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1"
3736 Winhance = " https://github.com/memstechtips/Winhance/releases/latest/download/Winhance.Installer.exe"
3837 WebView2 = " https://go.microsoft.com/fwlink/p/?LinkId=2124703"
39- MAS = " https://dev.azure.com/massgrave/Microsoft-Activation-Scripts/_apis/git/repositories/Microsoft-Activation-Scripts/items?path=/MAS/All-In-One-Version-KL/MAS_AIO.cmd&download=true"
4038}
4139
4240# ==================================================================
@@ -136,11 +134,11 @@ Write-Host $banner -ForegroundColor Cyan
136134# CORE FUNCTIONS
137135# ==================================================================
138136$script :Success = [System.Collections.Generic.List [string ]]::new()
139- $script :Errors = [System.Collections.Generic.List [string ]]::new()
137+ $script :Errors = [System.Collections.Generic.List [string ]]::new()
140138
141139function Success { param ($m ) $script :Success.Add ($m ); Write-Host " SUCCESS: $m " - ForegroundColor Green }
142- function Error { param ($m ) $script :Errors.Add ($m ); Write-Host " ERROR: $m " - ForegroundColor Red }
143- function Info { param ($m ) Write-Host " INFO: $m " - ForegroundColor Cyan }
140+ function Error { param ($m ) $script :Errors.Add ($m ); Write-Host " ERROR: $m " - ForegroundColor Red }
141+ function Info { param ($m ) Write-Host " INFO: $m " - ForegroundColor Cyan }
144142
145143function Invoke-SmartDownload {
146144 param ([string ]$Url , [string ]$Path , [string ]$Name )
@@ -169,7 +167,8 @@ function Invoke-SmartDownload {
169167 Write-Host " ✅ $Name downloaded!" - ForegroundColor Green
170168 $wc.Dispose ()
171169 return $true
172- } catch {
170+ }
171+ catch {
173172 Write-Host " ❌ Failed: $ ( $_.Exception.Message ) " - ForegroundColor Red
174173 if ($wc ) { $wc.Dispose () }
175174 return $false
@@ -208,7 +207,8 @@ function Set-SecureDns {
208207 if (-not (Get-DnsClientDohServerAddress - ServerAddress $s - ErrorAction SilentlyContinue)) {
209208 Add-DnsClientDohServerAddress - ServerAddress $s - DohTemplate $DohTemplate - AllowFallbackToUdp $true - AutoUpgrade $true - ErrorAction SilentlyContinue
210209 }
211- } catch {
210+ }
211+ catch {
212212 Info " DoH configuration skipped for $s (may not be available on this Windows version)"
213213 }
214214 }
@@ -218,7 +218,7 @@ function Set-SecureDns {
218218 Success " Secure DNS + DoH applied perfectly! 🛡️"
219219}
220220
221- function Confirm-Yes { param ($p ) do { $a = Read-Host " $p [Y/n] (default: YES)" ; if ([string ]::IsNullOrWhiteSpace($a )) {return $true }; $a = $a.Trim ().ToLower() } while ($a -notin ' y' , ' yes' , ' n' , ' no' ); return ($a -in ' y' , ' yes' ) }
221+ function Confirm-Yes { param ($p ) do { $a = Read-Host " $p [Y/n] (default: YES)" ; if ([string ]::IsNullOrWhiteSpace($a )) { return $true }; $a = $a.Trim ().ToLower() } while ($a -notin ' y' , ' yes' , ' n' , ' no' ); return ($a -in ' y' , ' yes' ) }
222222
223223# ==================================================================
224224# MAIN SETUP
@@ -230,14 +230,10 @@ try {
230230 if (Confirm-Yes " `n 🪄 Activate Windows permanently (HWID/Ohook/KMS38)?" ) {
231231 Write-Host " `n Activating Windows using MASSGRAVE script (safe & trusted)..." - ForegroundColor Magenta
232232 try {
233- if (-not (Test-Path $Files.MAS )) { Invoke-SmartDownload $Urls.MAS $Files.MAS " Microsoft Activation Script" }
234- if (Test-Path $Files.MAS ) {
235- Write-Host " `n Launching Activation Script in NEW WINDOW..." - ForegroundColor Magenta
236- Start-Process cmd.exe - ArgumentList " /c `" $ ( $Files.MAS ) `" "
237- Success " Windows activation script launched in new window!"
238- }
239- Read-Host " `n Press ENTER when activation is complete (or skip if already activated)"
240- } catch {
233+ Start-Process powershell - ArgumentList ' -NoProfile -Command "irm https://get.activated.win | iex"'
234+ Success " Windows activation script executed!"
235+ }
236+ catch {
241237 Error " Activation failed — but your PC is still god-tier anyway"
242238 }
243239 }
@@ -263,11 +259,12 @@ try {
263259╚══════════════════════════════════════════════════════════╝
264260"@ - ForegroundColor Magenta
265261 }
266- Start-Process pwsh.exe - ArgumentList " -NoProfile -File `" $ ( $Files.WinUtil ) `" "
267- Read-Host " `n Press ENTER when you're done..."
268- Success " WinUtil completed"
262+ Start-Process pwsh.exe - ArgumentList " -NoProfile -File `" $ ( $Files.WinUtil ) `" "
263+ Read-Host " `n Press ENTER when you're done..."
264+ Success " WinUtil completed"
269265
270- } catch {
266+ }
267+ catch {
271268 Error " WinUtil failed: $ ( $_.Exception.Message ) "
272269 }
273270 }
@@ -276,7 +273,8 @@ try {
276273 try {
277274 if (-not (Test-Path $Files.Winhance )) { Invoke-SmartDownload $Urls.Winhance $Files.Winhance " Winhance" }
278275 if (Test-Path $Files.Winhance ) { Start-Process $Files.Winhance - Wait; Success " Winhance launched — Edge is gone" }
279- } catch {
276+ }
277+ catch {
280278 Error " Winhance failed: $ ( $_.Exception.Message ) "
281279 }
282280 }
@@ -285,11 +283,13 @@ try {
285283 try {
286284 $p = Read-Host " `n (A)dGuard or (C)loudflare? [A/c] (default: C)"
287285 if ([string ]::IsNullOrWhiteSpace($p ) -or $p.Trim ().ToLower().StartsWith(' c' )) {
288- Set-SecureDns - IPv4 @ (' 1.1.1.1' , ' 1.0.0.1' ) - IPv6 @ (' 2606:4700:4700::1111' , ' 2606:4700:4700::1001' ) - DohTemplate ' https://cloudflare-dns.com/dns-query'
289- } else {
290- Set-SecureDns - IPv4 @ (' 94.140.14.14' , ' 94.140.15.15' ) - IPv6 @ (' 2a10:50c0::ad1:ff' , ' 2a10:50c0::ad2:ff' ) - DohTemplate ' https://dns.adguard-dns.com/dns-query'
286+ Set-SecureDns - IPv4 @ (' 1.1.1.1' , ' 1.0.0.1' ) - IPv6 @ (' 2606:4700:4700::1111' , ' 2606:4700:4700::1001' ) - DohTemplate ' https://cloudflare-dns.com/dns-query'
287+ }
288+ else {
289+ Set-SecureDns - IPv4 @ (' 94.140.14.14' , ' 94.140.15.15' ) - IPv6 @ (' 2a10:50c0::ad1:ff' , ' 2a10:50c0::ad2:ff' ) - DohTemplate ' https://dns.adguard-dns.com/dns-query'
291290 }
292- } catch {
291+ }
292+ catch {
293293 Error " DNS configuration failed: $ ( $_.Exception.Message ) "
294294 }
295295 }
@@ -298,7 +298,8 @@ try {
298298 try {
299299 if (-not (Test-Path $Files.WebView2 )) { Invoke-SmartDownload $Urls.WebView2 $Files.WebView2 " WebView2 Runtime" }
300300 if (Test-Path $Files.WebView2 ) { Start-Process $Files.WebView2 - ArgumentList " /silent /install" - Wait; Success " WebView2 installed" }
301- } catch {
301+ }
302+ catch {
302303 Error " WebView2 installation failed: $ ( $_.Exception.Message ) "
303304 }
304305 }
@@ -316,21 +317,24 @@ try {
316317 if (-not (Test-Path $PROFILE )) { New-Item - ItemType File - Path $PROFILE - Force | Out-Null }
317318 if (-not (Select-String - Path $PROFILE - Pattern " oh-my-posh" - Quiet - ErrorAction SilentlyContinue 2> $null )) { Add-Content - Path $PROFILE - Value " `n $line " }
318319 Success " Oh My Posh installed! Restart terminal ✨"
319- } catch {
320+ }
321+ catch {
320322 Error " Oh My Posh installation failed: $ ( $_.Exception.Message ) "
321323 }
322324 }
323325
324- } catch {
326+ }
327+ catch {
325328 Error " Critical error in main setup: $ ( $_.Exception.Message ) "
326- } finally {
329+ }
330+ finally {
327331 # CLEANUP
328332 Remove-Item $CacheDir - Recurse - Force - ErrorAction SilentlyContinue
329333
330334 Write-Host " `n =====================================================================================" - ForegroundColor Magenta
331335 Write-Host " WINFORGE 2025 v4.1 COMPLETE! 👑✨" - ForegroundColor Green
332336 Write-Host " $ ( Get-Date - Format ' dd MMM yyyy – HH:mm' ) " - ForegroundColor Cyan
333- Write-Host " Success: $ ( $script :Success.Count ) Errors: $ ( $script :Errors.Count ) " - ForegroundColor $ (if ($script :Errors.Count -eq 0 ){ ' Green' }else { ' Red' })
337+ Write-Host " Success: $ ( $script :Success.Count ) Errors: $ ( $script :Errors.Count ) " - ForegroundColor $ (if ($script :Errors.Count -eq 0 ) { ' Green' }else { ' Red' })
334338 Write-Host " Cache deleted. No evidence. 🥷" - ForegroundColor Yellow
335339 Write-Host " Log → $LogPath " - ForegroundColor Cyan
336340 Write-Host " `n =====================================================================================" - ForegroundColor Magenta
@@ -349,7 +353,8 @@ try {
349353
350354 Start-Process $mailto - ErrorAction SilentlyContinue
351355 Invoke-Item $LogPath - ErrorAction SilentlyContinue
352- } else {
356+ }
357+ else {
353358 # SHOW SUCCESS PATH - Everything worked perfectly
354359 Write-Host @"
355360
0 commit comments