@ -1607,7 +1607,7 @@ call :dk_color2 %Red% "Checking Boot Mode                      [%safeboot_option
				@@ -1607,7 +1607,7 @@ call :dk_color2 %Red% "Checking Boot Mode                      [%safeboot_option
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/en-us/ windows-hardware/manufacture/desktop/windows-setup-states  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					for  /f  " skip=2 tokens=2* "  %% A in  ( 'reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState' )  do  ( set  imagestate = %% B)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1878,7 +1878,7 @@ set "permerror=Error Found In SPP Registries"
				@@ -1878,7 +1878,7 @@ set "permerror=Error Found In SPP Registries"
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					REM  https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					REM  https://learn.microsoft.com/en-us/ office/troubleshoot/activation/license-issue-when-start-office-application  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  not  defined  permerror  (  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					reg query " HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion "  %nul%  &&  (  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -3156,7 +3156,7 @@ exit /b
				@@ -3156,7 +3156,7 @@ exit /b
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: oh_clearblock  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  Find remnants of Office vNext/shared/device license block and remove it because it stops other licenses from appearing  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/office/troubleshoot/activation/reset-office-365-proplus-activation-state  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/en-us/ office/troubleshoot/activation/reset-office-365-proplus-activation-state  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					set  _sidlist =  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					for  /f  " tokens=* delims= "  %% a in  ( ' %psc%  "$p = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'; Get-ChildItem $p | ForEach-Object { $pi = (Get-ItemProperty """"$p\$($_.PSChildName)"""").ProfileImagePath; if ($pi -like '*\Users\*' -and (Test-Path """"$pi\NTUSER.DAT"""") -and -not ($_.PSChildName -match '\.bak$' ) )  { Split-Path $_.PSPath -Leaf } }"   %nul6% ') do (if defined _sidlist (set _sidlist=!_sidlist!  %% a) else (set _sidlist= %% a))  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -3252,12 +3252,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share
				@@ -3252,12 +3252,12 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  Clear device-based-licensing  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/deployoffice/device-based-licensing  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/en-us/ deployoffice/device-based-licensing  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					for  /f  %% # in  ( 'reg query " %o16c2r_reg% \Configuration" /f *.DeviceBasedLicensing  %nul6%  ^| findstr REG_' )  do  reg delete " %o16c2r_reg% \Configuration "  /v %% # /f %nul%  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  Remove OEM registry key  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://support.microsoft.com/en-us/ office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					for  %% # in  ( 15 16)  do  (  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					reg delete " HKLM\SOFTWARE\Microsoft\Office\ %% #.0\Common\OEM "  /f %nul%  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -4002,8 +4002,8 @@ reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" /v Install %nul
				@@ -4002,8 +4002,8 @@ reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" /v Install %nul
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					echo  .NET 3.5 Framework is not installed in your system. 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					echo  Install it using the following URL. 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					echo : 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					echo  https://www.microsoft.com/download/details.aspx?id=25150 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  %_unattended% == 0 start  https://www.microsoft.com/download/details.aspx?id=25150 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					echo  https://www.microsoft.com/en-us/ download/details.aspx?id=25150 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  %_unattended% == 0 start  https://www.microsoft.com/en-us/ download/details.aspx?id=25150 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					goto  dk_done  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -12219,7 +12219,7 @@ call :oh_licrefresh
				@@ -12219,7 +12219,7 @@ call :oh_licrefresh
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: ks_activate  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  Opt out of sending KMSclient activation data to Microsoft  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/en-us/ windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#19-software-protection-platform  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  %winbuild%  GEQ  9600 (  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					reg add " HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform "  /v NoGenTicket /t REG_DWORD /d 1 /f %nul%  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -12287,7 +12287,7 @@ echo Cleared %KS% Server from the registry.
				@@ -12287,7 +12287,7 @@ echo Cleared %KS% Server from the registry.
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/azure/virtual-desktop/windows-10-multisession-faq  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					: :  https://learn.microsoft.com/en-us/ azure/virtual-desktop/windows-10-multisession-faq  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  %_actwin% == 1 for  %% # in  ( 407)  do  if  %osSKU% == %% # (  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					call  : dk_color  %Red%  " %winos%  does not support activation on non-azure platforms. "  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -15870,7 +15870,7 @@ for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsof
				@@ -15870,7 +15870,7 @@ for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsof
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  %winbuild%  LSS  9200 if  not  defined  _vis  (  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					REM Fix issues caused by Update KB971033 in Windows 7  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					REM https://support.microsoft.com/help/4487266  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					REM https://support.microsoft.com/en-us/ help/4487266  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					echo : 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					echo  Checking Update KB971033... 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					%psc%  " if (Get-Hotfix -Id KB971033 -ErrorAction SilentlyContinue) {Exit 3} "  %nul%  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -16367,7 +16367,7 @@ set "permerror=Error Found In SPP Registries"
				@@ -16367,7 +16367,7 @@ set "permerror=Error Found In SPP Registries"
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					) 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					REM  https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					REM  https://learn.microsoft.com/en-us/ office/troubleshoot/activation/license-issue-when-start-office-application  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  not  defined  permerror  (  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					reg query " HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion "  %nul%  &&  (  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -16413,7 +16413,7 @@ if ($env:permerror -eq 'Error Found In SPP Registries') {
				@@ -16413,7 +16413,7 @@ if ($env:permerror -eq 'Error Found In SPP Registries') {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					} 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					# Fix perms for SPP in HKU\S-1-5-20 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					# https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					# https://learn.microsoft.com/en-us/ office/troubleshoot/activation/license-issue-when-start-office-application 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if   ($env:permerror  - n e   ' E r r o r   F o u n d   I n   S - 1 - 5 - 2 0   S P P ' )   {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    exit 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -18175,7 +18175,7 @@ call :dk_color %_Green% "Enter an option number using your keyboard and press En
				@@ -18175,7 +18175,7 @@ call :dk_color %_Green% "Enter an option number using your keyboard and press En
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					set  /p  inpt =  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  " %inpt% " == " "  goto  : oe_changeupdchnl  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  " %inpt% " == " 0 "  goto  : oemenu  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  /i  " %inpt% " == " R "  start  https://learn.microsoft.com/microsoft-365-apps/updates/overview-update-channels &  goto  : oe_changeupdchnl  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					if  /i  " %inpt% " == " R "  start  https://learn.microsoft.com/en-us/ microsoft-365-apps/updates/overview-update-channels &  goto  : oe_changeupdchnl  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					for  /l  %% i in  ( 1 ,1 ,%counter% )  do  ( if  " %inpt% " == " %% i "  set  verified = 1)  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					set  targetFFN = !targetFFN%inpt%!  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					set  targetchannel = !targetchannel%inpt%!