From 02b98166d27ef620f2967f0d2d1afc9c74b7ea42 Mon Sep 17 00:00:00 2001
From: abbodi1406 <33669284+abbodi1406@users.noreply.github.com>
Date: Fri, 24 Jul 2020 23:51:23 +0300
Subject: [PATCH] Update structure to work with new Insider Channels
---
OfflineInsiderEnroll.cmd | 252 ++++++++++++++++++++-------------------
1 file changed, 129 insertions(+), 123 deletions(-)
diff --git a/OfflineInsiderEnroll.cmd b/OfflineInsiderEnroll.cmd
index 6f977f6..5e18a44 100644
--- a/OfflineInsiderEnroll.cmd
+++ b/OfflineInsiderEnroll.cmd
@@ -1,123 +1,129 @@
-@echo off
-
-::Borrowed from @abbodi1406's scripts
-for /f "tokens=6 delims=[]. " %%i in ('ver') do set build=%%i
-
-if %build% LSS 17763 (
- echo =============================================================
- echo This script is compatible only with Windows 10 RS5 and later.
- echo =============================================================
- echo.
- pause
- goto :EOF
-)
-
-REG QUERY HKU\S-1-5-19\Environment >NUL 2>&1
-IF %ERRORLEVEL% EQU 0 goto :START_SCRIPT
-
-echo =====================================================
-echo This script needs to be executed as an administrator.
-echo =====================================================
-echo.
-pause
-goto :EOF
-
-:START_SCRIPT
-set "scriptver=1.1.0"
-set "FlightSigningEnabled=0"
-bcdedit /enum {current} | findstr /I /R /C:"^flightsigning *Yes$" >NUL 2>&1
-IF %ERRORLEVEL% EQU 0 set "FlightSigningEnabled=1"
-
-:CHOICE_MENU
-cls
-set "choice="
-echo OfflineInsiderEnroll v%scriptver%
-echo.
-echo R - Enroll to Release Preview ring
-echo S - Enroll to Insider Slow ring
-echo F - Enroll to Insider Fast ring
-echo.
-echo X - Stop receiving Insider Preview builds
-echo Q - Quit without making any changes
-echo.
-set /p choice="Choice: "
-echo.
-if /I "[%choice%]"=="[r]" goto :ENROLL_RP
-if /I "[%choice%]"=="[s]" goto :ENROLL_SLOW
-if /I "[%choice%]"=="[f]" goto :ENROLL_FAST
-if /I "[%choice%]"=="[x]" goto :STOP_INSIDER
-if /I "[%choice%]"=="[q]" goto :EOF
-goto :CHOICE_MENU
-
-:ENROLL_RP
-set "SLS=RingPreview"
-set "Ring=RP"
-set "Content=Current"
-set "FancyRing=Release Preview"
-goto :ENROLL
-
-:ENROLL_SLOW
-set "SLS=RingInsiderSlow"
-set "Ring=WIS"
-set "Content=Active"
-set "FancyRing=Windows Insider Slow"
-goto :ENROLL
-
-:ENROLL_FAST
-set "SLS=RingInsiderFast"
-set "Ring=WIF"
-set "Content=Active"
-set "FancyRing=Windows Insider Fast"
-goto :ENROLL
-
-:RESET_INSIDER_CONFIG
-reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost" /f >NUL 2>&1
-reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\WUMUDCat" /f >NUL 2>&1
-reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\RingPreview" /f >NUL 2>&1
-reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\RingInsiderSlow" /f >NUL 2>&1
-reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\RingInsiderFast" /f >NUL 2>&1
-goto :EOF
-
-:ENROLL
-echo Applying changes...
-call :RESET_INSIDER_CONFIG
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator" /t REG_DWORD /v EnableUUPScan /d 1 /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\%SLS%" /t REG_DWORD /v Enabled /d 1 /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\WUMUDCat" /t REG_DWORD /v WUMUDCATEnabled /d 1 /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_DWORD /v EnablePreviewBuilds /d 1 /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_DWORD /v IsBuildFlightingEnabled /d 1 /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_DWORD /v TestFlags /d 32 /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_SZ /v ContentType /d "%Content%" /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_SZ /v BranchName /d "external" /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_SZ /v Ring /d "%Ring%" /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Strings" /t REG_SZ /v StickyXaml /d "This device has been enrolled to the Windows Insider program using OfflineInsiderEnroll v%scriptver%. If you want to change settings of the enrollment or stop receiving Insider Preview builds, please use the script. Learn more %FancyRing%Windows Insider Program requires your diagnostic data collection settings to be set to Full. You can verify or modify your current settings in Diagnostics & feedback." /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIHiddenElements /d 65535 /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIDisabledElements /d 65535 /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIServiceDrivenElementVisibility /d 0 /f >NUL 2>&1
-reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIErrorMessageVisibility /d 192 /f >NUL 2>&1
-
-bcdedit /set {current} flightsigning yes >NUL 2>&1
-echo Done.
-
-echo.
-IF %FlightSigningEnabled% NEQ 1 goto :ASK_FOR_REBOOT
-pause
-goto :EOF
-
-:STOP_INSIDER
-echo Applying changes...
-call :RESET_INSIDER_CONFIG
-bcdedit /deletevalue {current} flightsigning >NUL 2>&1
-echo Done.
-
-echo.
-IF %FlightSigningEnabled% NEQ 0 goto :ASK_FOR_REBOOT
-pause
-goto :EOF
-
-:ASK_FOR_REBOOT
-set "choice="
-echo A reboot is required to finish applying changes.
-set /p choice="Would you like to reboot your PC? (y/N) "
-if /I "[%choice%]"=="[y]" shutdown -r -t 0
-goto :EOF
+@echo off
+
+::Borrowed from @abbodi1406's scripts
+for /f "tokens=6 delims=[]. " %%i in ('ver') do set build=%%i
+
+if %build% LSS 17763 (
+ echo =============================================================
+ echo This script is compatible only with Windows 10 RS5 and later.
+ echo =============================================================
+ echo.
+ pause
+ goto :EOF
+)
+
+REG QUERY HKU\S-1-5-19\Environment >NUL 2>&1
+IF %ERRORLEVEL% EQU 0 goto :START_SCRIPT
+
+echo =====================================================
+echo This script needs to be executed as an administrator.
+echo =====================================================
+echo.
+pause
+goto :EOF
+
+:START_SCRIPT
+set "scriptver=2.0.0"
+set "FlightSigningEnabled=0"
+bcdedit /enum {current} | findstr /I /R /C:"^flightsigning *Yes$" >NUL 2>&1
+IF %ERRORLEVEL% EQU 0 set "FlightSigningEnabled=1"
+
+:CHOICE_MENU
+cls
+set "choice="
+echo OfflineInsiderEnroll v%scriptver%
+echo.
+echo 1 - Enroll to Dev Channel
+echo 2 - Enroll to Beta Channel
+echo 3 - Enroll to Release Preview Channel
+echo.
+echo 4 - Stop receiving Insider Preview builds
+echo 5 - Quit without making any changes
+echo.
+set /p choice="Choice: "
+echo.
+if /I "%choice%"=="1" goto :ENROLL_DEV
+if /I "%choice%"=="2" goto :ENROLL_BETA
+if /I "%choice%"=="3" goto :ENROLL_RP
+if /I "%choice%"=="4" goto :STOP_INSIDER
+if /I "%choice%"=="5" goto :EOF
+goto :CHOICE_MENU
+
+:ENROLL_RP
+set "Channel=ReleasePreview"
+set "Fancy=Release Preview Channel"
+goto :ENROLL
+
+:ENROLL_BETA
+set "Channel=Beta"
+set "Fancy=Beta Channel"
+goto :ENROLL
+
+:ENROLL_DEV
+set "Channel=Dev"
+set "Fancy=Dev Channel"
+goto :ENROLL
+
+:RESET_INSIDER_CONFIG
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Account" /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Cache" /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI" /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\WUMUDCat" /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\RingExternal" /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\RingPreview" /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\RingInsiderSlow" /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\RingInsiderFast" /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v AllowTelemetry /f
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /f
+goto :EOF
+
+:ADD_INSIDER_CONFIG
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator" /t REG_DWORD /v EnableUUPScan /d 1 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\RingExternal" /t REG_DWORD /v Enabled /d 1 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\SLS\Programs\WUMUDCat" /t REG_DWORD /v WUMUDCATEnabled /d 1 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_DWORD /v EnablePreviewBuilds /d 1 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_DWORD /v IsBuildFlightingEnabled /d 1 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_DWORD /v IsConfigSettingsFlightingEnabled /d 1 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_DWORD /v TestFlags /d 32 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_DWORD /v RingId /d 11 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_SZ /v Ring /d "External" /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_SZ /v ContentType /d "Mainline" /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\Applicability" /t REG_SZ /v BranchName /d "%Channel%" /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Strings" /t REG_SZ /v StickyXaml /d "This device has been enrolled to the Windows Insider program using OfflineInsiderEnroll v%scriptver%. If you want to change settings of the enrollment or stop receiving Insider Preview builds, please use the script. Learn more %Fancy%Windows Insider Program requires your diagnostic data collection settings to be set to Full. You can verify or modify your current settings in Diagnostics & feedback." /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIHiddenElements /d 65535 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIDisabledElements /d 65535 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIServiceDrivenElementVisibility /d 0 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIErrorMessageVisibility /d 192 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /t REG_DWORD /v AllowTelemetry /d 3 /f
+goto :EOF
+
+:ENROLL
+echo Applying changes...
+call :RESET_INSIDER_CONFIG 1>NUL 2>NUL
+call :ADD_INSIDER_CONFIG 1>NUL 2>NUL
+bcdedit /set {current} flightsigning yes >NUL 2>&1
+echo Done.
+
+echo.
+IF %FlightSigningEnabled% NEQ 1 goto :ASK_FOR_REBOOT
+pause
+goto :EOF
+
+:STOP_INSIDER
+echo Applying changes...
+call :RESET_INSIDER_CONFIG 1>NUL 2>NUL
+bcdedit /deletevalue {current} flightsigning >NUL 2>&1
+echo Done.
+
+echo.
+IF %FlightSigningEnabled% NEQ 0 goto :ASK_FOR_REBOOT
+pause
+goto :EOF
+
+:ASK_FOR_REBOOT
+set "choice="
+echo A reboot is required to finish applying changes.
+set /p choice="Would you like to reboot your PC? (y/N) "
+if /I "%choice%"=="y" shutdown -r -t 0
+goto :EOF