From 2f9e40f063ec1ef4da82515d95b1b40f3599681c Mon Sep 17 00:00:00 2001
From: 9479383 <86916841+9479383@users.noreply.github.com>
Date: Fri, 9 Jul 2021 16:05:02 +0800
Subject: [PATCH] Add files via upload
---
LICENSE | 21 ++++++
OfflineInsiderEnroll.cmd | 137 +++++++++++++++++++++++++++++++++++++++
readme.md | 45 +++++++++++++
3 files changed, 203 insertions(+)
create mode 100644 LICENSE
create mode 100644 OfflineInsiderEnroll.cmd
create mode 100644 readme.md
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0557511
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 whatever127
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/OfflineInsiderEnroll.cmd b/OfflineInsiderEnroll.cmd
new file mode 100644
index 0000000..799160b
--- /dev/null
+++ b/OfflineInsiderEnroll.cmd
@@ -0,0 +1,137 @@
+@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.5.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"
+set "BRL=8"
+goto :ENROLL
+
+:ENROLL_BETA
+set "Channel=Beta"
+set "Fancy=Beta Channel"
+set "BRL=4"
+goto :ENROLL
+
+:ENROLL_DEV
+set "Channel=Dev"
+set "Fancy=Dev Channel"
+set "BRL=2"
+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
+reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v BranchReadinessLevel /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 2 /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
+rem 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
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /t REG_DWORD /v BranchReadinessLevel /d %BRL% /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Strings" /t REG_SZ /v StickyMessage /d "{"^""Message"^"":"^""Device Enrolled Using OfflineInsiderEnroll"^"","^""LinkTitle"^"":"^"""^"","^""LinkUrl"^"":"^"""^"","^""DynamicXaml"^"":"^""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."^"","^""Severity"^"":0}" /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIHiddenElements_Rejuv /d 65534 /f
+reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /t REG_DWORD /v UIDisabledElements_Rejuv /d 65535 /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
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..07cc515
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,45 @@
+OfflineInsiderEnroll
+--------------------
+
+### Description
+OfflineInsiderEnroll is a simple Windows Command Prompt script to enable access
+to the Windows Insider Program on machines not signed in with Microsoft Account.
+
+This script is compatible only with Windows 10 RS5 and later.
+
+### Usage
+This script requires administrative priviliges to run. You can simply execute it
+by right clicking it > `Run as Administrator`.
+
+#### Installation and configuration changes
+After starting the script offers selection of *Windows Insider Program* channels.
+To make a selection, press a letter coresponding to option you choose and press
+ENTER.
+
+If the machine was not enrolled to the Insider Program, you will get prompted to
+restart your machine to enable *Microsoft Flight Signing* which is required by
+*Windows Insider Program*.
+
+**Notice:** Windows Insider Program requires telemetry to be set to *Full*.
+After enrolling your machine to the *Windows Insider Program* please make sure
+that your diagnostic data collection settings are set to *Full*. Some *Insider
+Preview* builds may not get offered in *Windows Update* if you do not have
+correct telemetry settings. You can verify or modify your telemetry settings in
+*Settings* > *Privacy* > *Diagnostics & feedback*.
+
+#### Restoring Windows Insider Program to default options
+To restore *Windows Insider Program* to default settings simply choose `Stop
+receiving Insider Preview builds` in OfflineInsiderEnroll. You will get prompted
+to reboot, because this option will disable *Microsoft Flight Signing*.
+
+### How does this work?
+This script takes advantage of undocumented `TestFlags` registry value.
+If this value is set to `0x20`, all access to online *Windows Insider* services
+gets disabled. Because of this, we can set our own *Windows Insider Preview*
+configuration without being overriden by the contact to the service. Since
+Windows Update does not check if machine is actually enrolled to the program,
+you will get offered *Insider Preview* builds by just setting correct values in
+the registry.
+
+### License
+This project is licensed under the MIT License. See `LICENSE` for details.