Skip to content

Commit 7c4cfe0

Browse files
authored
Add force refresh script
1 parent 6098d7c commit 7c4cfe0

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Assets/WhyNotWin11.cmd

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@echo off
2+
setlocal EnableDelayedExpansion
3+
4+
fltmc >nul 2>&1
5+
if errorlevel 1 (
6+
echo This script needs admin rights.
7+
powershell -Command "Start-Process cmd -ArgumentList '/c \"%~f0\"' -Verb RunAs"
8+
exit /b
9+
)
10+
11+
set "0=%~f0" &powershell -nop -c $f=[IO.File]::ReadAllText($env:0) -split ':shellpower\:.*';iex($f[1])
12+
exit /b
13+
14+
:shellpower:
15+
Write-Host "=============================================" -ForegroundColor Cyan
16+
Write-Host " WhyNotWin11 - Upgrade to Windows 11" -ForegroundColor Cyan
17+
Write-Host "=============================================" -ForegroundColor Cyan
18+
19+
function Start-Appraiser {
20+
$TaskName = "Microsoft Compatibility Appraiser"
21+
$TaskPath = "\Microsoft\Windows\Application Experience\"
22+
23+
Write-Host "`nRunning Compatibility Appraiser..."
24+
$null = Enable-ScheduledTask $TaskName $TaskPath
25+
Start-ScheduledTask $TaskName $TaskPath
26+
while ((Get-ScheduledTask $TaskName $TaskPath).State.value__ -eq 4) {Start-Sleep -Seconds 1}
27+
Write-Host "Task finished." -ForegroundColor Green
28+
29+
Write-Host "`nOpening Windows Update..."
30+
Start-Process "ms-settings:windowsupdate"
31+
32+
Write-Host "Attempting automatic 'Check for updates'..."
33+
try {
34+
cmd /c UsoClient.exe StartBypassScan
35+
} catch {}
36+
}
37+
38+
Start-Appraiser
39+
40+
Write-Host "`nPress any key to exit..." -ForegroundColor Yellow
41+
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
42+
:shellpower:

0 commit comments

Comments
 (0)