@ -1,12 +1,11 @@
@ set masver = 3.7
@ set masver = 3.12
@ echo off
@ echo off
: :============================================================================
: :============================================================================
: :
: :
: : Homepage: mass()grave(dot)dev
: : Homepage: m{}assgrave{dot}dev
: : Email: mas.help@outlook.com
: :
: :
: :============================================================================
: :============================================================================
@ -78,6 +77,18 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
set " ComSpec= %SysPath% \cmd.exe "
set " ComSpec= %SysPath% \cmd.exe "
set " PSModulePath= %ProgramFiles% \WindowsPowerShell\Modules; %SysPath% \WindowsPowerShell\v1.0\Modules "
set " PSModulePath= %ProgramFiles% \WindowsPowerShell\Modules; %SysPath% \WindowsPowerShell\v1.0\Modules "
cd /d " %SysPath% "
: : Workaround for https://github.com/microsoft/terminal/issues/15212, when %0 starts with a quote %0 parameter expansion is not specialcased.
: : Changing %0 to something that is not quoted bypasses the issue.
goto arg_workaround_end
: arg_workaround
set " _cmdf= %~f0 "
exit /b
: arg_workaround_end
call : arg_workaround
set re1 =
set re1 =
set re2 =
set re2 =
set " _cmdf= %~f0 "
set " _cmdf= %~f0 "
@ -134,9 +145,9 @@ set "nul="
: :========================================================================================================================================
: :========================================================================================================================================
set " blank= "
set " blank= "
set " mas=ht %blank% tps %blank% ://mass %blank% grave.dev/ "
set " mas=ht %blank% tps %blank% ://m %blank% ass%blank% grave.dev/ "
set " github=ht %blank% tps %blank% ://github.com/massgra %blank% vel/Micro %blank% soft-Acti %blank% vation-Scripts "
set " github=ht %blank% tps %blank% ://github.com/m %blank% assgra%blank% vel/Micro %blank% soft-Acti %blank% vation-Scripts "
set " selfgit=ht %blank% tps %blank% ://git.acti %blank% vated.win/massg %blank% rave/ Micr %blank% osoft-Act %blank% ivation-Scripts "
set " selfgit=ht %blank% tps %blank% ://git.acti %blank% vated.win/Micr %blank% osoft-Act %blank% ivation-Scripts "
: : Check if Null service is working, it's important for the batch script
: : Check if Null service is working, it's important for the batch script
@ -155,8 +166,7 @@ cls
: : Check LF line ending
: : Check LF line ending
pushd " %~dp0 "
> nul findstr /v " $ " " %_cmdf% " && (
> nul findstr /v " $ " " %~nx0 " && (
echo :
echo :
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
echo :
echo :
@ -165,10 +175,8 @@ echo Check this webpage for help - %mas%troubleshoot
echo :
echo :
echo :
echo :
ping 127.0.0.1 -n 20 > nul
ping 127.0.0.1 -n 20 > nul
popd
exit /b
exit /b
)
)
popd
: :========================================================================================================================================
: :========================================================================================================================================
@ -213,7 +221,6 @@ call :dk_setvar
if %winbuild% EQU 1 (
if %winbuild% EQU 1 (
%eline%
%eline%
echo Failed to detect Windows build number.
echo Failed to detect Windows build number.
echo :
setlocal EnableDelayedExpansion
setlocal EnableDelayedExpansion
set fixes = %fixes% %mas% troubleshoot
set fixes = %fixes% %mas% troubleshoot
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
@ -273,10 +280,9 @@ goto dk_done
set " _work= %~dp0 "
set " _work= %~dp0 "
if " %_work:~-1% " == " \ " set " _work= %_work:~0,-1% "
if " %_work:~-1% " == " \ " set " _work= %_work:~0,-1% "
set " _batf= %~f0 "
set " _batp= %_cmdf:'=''% "
set " _batp= %_batf:'=''% "
set _PSarg = " " " %~f0 " " " -el %_args%
set _PSarg = " " " %_cmdf% " " " -el %_args%
set _PSarg = %_PSarg:'=''%
set _PSarg = %_PSarg:'=''%
set " _ttemp= %userprofile% \AppData\Local\Temp "
set " _ttemp= %userprofile% \AppData\Local\Temp "
@ -285,7 +291,7 @@ setlocal EnableDelayedExpansion
: :========================================================================================================================================
: :========================================================================================================================================
echo " !_bat f! " | find /i " !_ttemp! " %nul1% && (
echo " !_cmd f! " | find /i " !_ttemp! " %nul1% && (
if /i not " !_work! " == " !_ttemp! " (
if /i not " !_work! " == " !_ttemp! " (
%eline%
%eline%
echo The script was launched from the temp folder.
echo The script was launched from the temp folder.
@ -314,7 +320,7 @@ goto dk_done
: :pstst $ExecutionContext.SessionState.LanguageMode :pstst
: :pstst $ExecutionContext.SessionState.LanguageMode :pstst
for /f " delims= " %% a in ( ' %psc% "if ($PSVersionTable.PSEdition -ne 'Core' ) {$f=[System. IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6% ' ) do ( set tstresult = %% a)
for /f " delims= " %% a in ( ' %psc% "if ($PSVersionTable.PSEdition -ne 'Core' ) {$f=[IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6% ' ) do ( set tstresult = %% a)
if /i not " %tstresult% " == " FullLanguage " (
if /i not " %tstresult% " == " FullLanguage " (
%eline%
%eline%
@ -328,7 +334,6 @@ REM check LanguageMode
echo : !tstresult2! | findstr /i " ConstrainedLanguage RestrictedLanguage NoLanguage " %nul1% && (
echo : !tstresult2! | findstr /i " ConstrainedLanguage RestrictedLanguage NoLanguage " %nul1% && (
echo FullLanguage mode not found in PowerShell. Aborting...
echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo If you have applied restrictions on Powershell then undo those changes.
echo :
set fixes = %fixes% %mas% fix_powershell
set fixes = %fixes% %mas% fix_powershell
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% fix_powershell "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% fix_powershell "
goto dk_done
goto dk_done
@ -338,7 +343,6 @@ REM check Powershell core version
cmd /c " %psc% " $PSVersionTable.PSEdition" " | find /i " Core " %nul1% && (
cmd /c " %psc% " $PSVersionTable.PSEdition" " | find /i " Core " %nul1% && (
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
echo :
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% in-place_repair_upgrade
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
goto dk_done
goto dk_done
@ -349,7 +353,6 @@ REM check for Mal-ware that may cause issues with Powershell
for /r " %ProgramFiles% \ " %% f in ( secureboot.exe) do if exist " %% f " (
for /r " %ProgramFiles% \ " %% f in ( secureboot.exe) do if exist " %% f " (
echo " %% f "
echo " %% f "
echo Mal%blank% ware found, PowerShell is not working properly.
echo Mal%blank% ware found, PowerShell is not working properly.
echo :
set fixes = %fixes% %mas% remove_mal%w% ware
set fixes = %fixes% %mas% remove_mal%w% ware
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% remove_mal %w% ware "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% remove_mal %w% ware "
goto dk_done
goto dk_done
@ -361,7 +364,6 @@ if /i "!tstresult2!"=="FullLanguage" (
cmd /c " %psc% " " try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3} " " " %nul%
cmd /c " %psc% " " try {[System.AppDomain]::CurrentDomain.GetAssemblies(); [System.Math]::Sqrt(144)} catch {Exit 3} " " " %nul%
if !errorlevel! == 3 (
if !errorlevel! == 3 (
echo Windows Powershell failed to load .NET command. Aborting...
echo Windows Powershell failed to load .NET command. Aborting...
echo :
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% in-place_repair_upgrade
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
goto dk_done
goto dk_done
@ -382,7 +384,6 @@ echo Installed Antivirus - Microsoft Defender for Endpoint
cmd /c " %psc% " " $av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))} " " "
cmd /c " %psc% " " $av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { $n += $i.displayName }; if ($n) { Write-Host ('Installed Antivirus - ' + ($n -join ', '))} " " "
)
)
echo :
set fixes = %fixes% %mas% troubleshoot
set fixes = %fixes% %mas% troubleshoot
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
goto dk_done
goto dk_done
@ -420,11 +421,11 @@ reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
if defined terminal (
if defined terminal (
start conhost.exe " !_bat f! " %_args% -qedit
start conhost.exe " !_cmd f! " %_args% -qedit
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b
exit /b
) else if %resetQE% EQU 1 (
) else if %resetQE% EQU 1 (
start cmd.exe /c " " !_bat f! " %_args% -qedit "
start cmd.exe /c " " !_cmd f! " %_args% -qedit "
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
exit /b
exit /b
)
)
@ -545,7 +546,9 @@ echo:
echo ______________________________________________________________
echo ______________________________________________________________
echo :
echo :
call : dk_color2 %_White% " [1] " %_Green% " Auto "
call : dk_color2 %_White% " [1] " %_Green% " Auto "
echo Builds ^> = 26100 - StaticCID (KMS4k if offline)
echo Builds ^> = 26100 - Windows only - KMS4k
echo Other options - StaticCID
echo :
echo Builds ^< 26100 - ZeroCID
echo Builds ^< 26100 - ZeroCID
echo __________________________________________________
echo __________________________________________________
echo :
echo :
@ -596,7 +599,7 @@ title TSforge Activation %masver%
echo :
echo :
echo Initializing...
echo Initializing...
call : dk_chkmal
echo :
if not exist %SysPath% \%_slexe% (
if not exist %SysPath% \%_slexe% (
%eline%
%eline%
@ -605,9 +608,8 @@ echo:
if not defined results (
if not defined results (
call : dk_color %Blue% " Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options. "
call : dk_color %Blue% " Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options. "
call : dk_color %Blue% " After that, restart system and try activation again. "
call : dk_color %Blue% " After that, restart system and try activation again. "
echo :
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% troubleshoot
call : dk_color2 %Blue% " If it still shows the same error, do this - " %_Yellow% " %mas% in-place_repair_upgrade "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
)
)
goto dk_done
goto dk_done
)
)
@ -619,7 +621,6 @@ echo .NET 3.5 Framework is corrupt or missing. Aborting...
if exist " %SysPath% \spp\tokens\skus\Security-SPP-Component-SKU-Embedded " (
if exist " %SysPath% \spp\tokens\skus\Security-SPP-Component-SKU-Embedded " (
echo Install .NET Framework 4.8 and Windows Management Framework 5.1
echo Install .NET Framework 4.8 and Windows Management Framework 5.1
)
)
echo :
set fixes = %fixes% %mas% troubleshoot
set fixes = %fixes% %mas% troubleshoot
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
goto dk_done
goto dk_done
@ -633,7 +634,6 @@ if !errorlevel! EQU 1051 (
%eline%
%eline%
echo Evaluation WLMS service is running, %_slser% service can not be stopped. Aborting...
echo Evaluation WLMS service is running, %_slser% service can not be stopped. Aborting...
echo Install Non-Eval version for Windows build %winbuild% .
echo Install Non-Eval version for Windows build %winbuild% .
echo :
set fixes = %fixes% %mas% troubleshoot
set fixes = %fixes% %mas% troubleshoot
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
goto dk_done
goto dk_done
@ -669,6 +669,9 @@ if /i %_actmethod%==KMS4k set tsmethod=KMS4k
if /i %_actmethod% == Auto (
if /i %_actmethod% == Auto (
if %winbuild% GEQ 26100 (
if %winbuild% GEQ 26100 (
set tsmethod = StaticCID
set tsmethod = StaticCID
if !_actwin! == 1 if not !_actwinesuoff! == 1 (
set tsmethod = KMS4k
)
) else (
) else (
set tsmethod = ZeroCID
set tsmethod = ZeroCID
)
)
@ -773,7 +776,7 @@ if defined _vis goto :ts_winvista
set tempid =
set tempid =
if /i %tsmethod% == KMS4k ( set keytype = ks) else ( set keytype = zero)
if /i %tsmethod% == KMS4k ( set keytype = ks) else ( set keytype = zero)
for /f " delims= " %% a in ( ' %psc% "$f=[System. IO.File]::ReadAllText('!_batp!' ) -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6% ' ) do (
for /f " delims= " %% a in ( ' %psc% "$f=[IO.File]::ReadAllText('!_batp!' ) -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6% ' ) do (
echo " %% a " | findstr /r " .*-.*-.*-.*-.* " %nul1% && ( set tsids = !tsids! %% a& set tempid = %% a)
echo " %% a " | findstr /r " .*-.*-.*-.*-.* " %nul1% && ( set tsids = !tsids! %% a& set tempid = %% a)
)
)
@ -784,7 +787,7 @@ call :dk_color %Red% "Checking Activation ID [Not Found] [%tsed
set error = 1
set error = 1
if /i %tsmethod% == KMS4k (
if /i %tsmethod% == KMS4k (
if /i %_actmethod% == Auto (
if /i %_actmethod% == Auto (
call : dk_color %Blue% " Connect to the Internet and try again. Script will use the StaticCID activation method ."
call : dk_color %Blue% " Return to the previous menu and select StaticCID activation method. Internet connection is required to activate ."
) else (
) else (
call : dk_color %Blue% " Use non-KMS4K activation options from the previous menu. "
call : dk_color %Blue% " Use non-KMS4K activation options from the previous menu. "
)
)
@ -1063,7 +1066,7 @@ goto :ts_esu
)
)
set resetstuff = 1
set resetstuff = 1
%psc% " $f=[System. IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) "
%psc% " $f=[IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) "
set resetstuff =
set resetstuff =
if !errorlevel! == 3 (
if !errorlevel! == 3 (
set error = 1
set error = 1
@ -1102,7 +1105,7 @@ set esuexistsup=
set esueditionlist =
set esueditionlist =
set esuexistbutnosup =
set esuexistbutnosup =
for %% # in ( EnterpriseS IoTEnterpriseS IoTEnterpriseSK) do ( if /i %tsedition% == %% # set isltsc = 1)
if %winbuild% GTR 14393 for %% # in ( EnterpriseS IoTEnterpriseS IoTEnterpriseSK) do ( if /i %tsedition% == %% # set isltsc = 1)
if exist " %SystemRoot% \Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum " set isServer = 1
if exist " %SystemRoot% \Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum " set isServer = 1
if /i %tsedition% == Embedded (
if /i %tsedition% == Embedded (
@ -1112,12 +1115,17 @@ if exist "%SystemRoot%\Servicing\Packages\WinEmb-Branding-Embedded-Standard-Pack
)
)
if not defined allapps call : dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined allapps call : dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
set w10EsuEditions = Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh
set w10EsuEditions = Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN
set minbuild = 0
if /i %tsedition% == ServerRdsh set minbuild = 5552
for %% # in ( Core CoreN CoreCountrySpecific CoreSingleLanguage IoTEnterprise) do ( if /i %tsedition% == %% # set minbuild = 6156)
if /i %tsedition% == PPIPro set minbuild = 6388
set /a UBR = 0
set /a UBR = 0
for /f " skip=2 tokens=2* " %% a in ( 'reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6% ' ) do if not errorlevel 1 set /a UBR =%% b
for /f " skip=2 tokens=2* " %% a in ( 'reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6% ' ) do if not errorlevel 1 set /a UBR =%% b
if %winbuild% EQU 19045 if %UBR% GEQ 6156 (
if %winbuild% EQU 19045 if %minbuild% GTR 0 if %UBR% GEQ %minbuild% (
set w10EsuEditionsLaterAdded = Core-CoreN-CoreCountrySpecific-CoreSingleLanguage-IoTEnterprise-
set w10EsuEditionsLaterAdded = %tsedition% -
)
)
if not defined isThinpc if not defined isltsc for %% # in (
if not defined isThinpc if not defined isltsc for %% # in (
@ -1135,15 +1143,18 @@ REM Windows8.1
11be7019-a309-4763-9a09-091d1722ffe3_Client-FES-ESU-Year3[1-3y]_-EmbeddedIndustry-EmbeddedIndustryE-
11be7019-a309-4763-9a09-091d1722ffe3_Client-FES-ESU-Year3[1-3y]_-EmbeddedIndustry-EmbeddedIndustryE-
REM WindowsServer2012/2012R2
REM WindowsServer2012/2012R2
55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
1b60284a-63b5-42da-8ec9-eaab825e2bc8_Server-ESU-Year5[4-5y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
REM Windows10
REM Windows10
f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions% -%w10EsuEditionsLaterAdded%
f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions% -%w10EsuEditionsLaterAdded%
1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions% -%w10EsuEditionsLaterAdded%
1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions% -%w10EsuEditionsLaterAdded%
83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-%w10EsuEditions% -%w10EsuEditionsLaterAdded%
83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-%w10EsuEditions% -%w10EsuEditionsLaterAdded%
0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-%w10EsuEditions% -%w10EsuEditionsLaterAdded%
0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-%w10EsuEditions% -%w10EsuEditionsLaterAdded%
b8527af1-5389-447c-9a88-2d1691ea33d3_Client-IoT-ESU-Year1_-IoTEnterprise-
REM WindowsServer2016
7b76ee02-0a75-4f08-85d5-bd0feadad0c0_Client-IoT-ESU-Year2_-IoTEnterprise-
91bcac0a-d7d3-4d2b-bd0c-72fed675f01b_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3_-IoTEnterprise-
4cd0ab30-73a4-4dde-972c-512f05be31df_Server-ESU-Year6[4-6y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
f69e2d51-3bbd-4ddf-8da7-a145e9dca597_Client-IoT-ESU-Year6[4-6y]_-IoTEnterprise-
REM Windows10LTSB2016
f2571710-2c24-4677-8fb5-a07d41d3c1aa_Client-ESU-Year3[1-3y]_-EnterpriseS-EnterpriseSN-
22badfe6-7d55-4485-874b-7ec317442134_Client-ESU-Year6[4-6y]_-EnterpriseS-EnterpriseSN-
) do (
) do (
for /f " tokens=1-3 delims=_ " %% A in ( " %% # " ) do (
for /f " tokens=1-3 delims=_ " %% A in ( " %% # " ) do (
echo " %allapps% " | find /i " %% A " %nul1% && (
echo " %allapps% " | find /i " %% A " %nul1% && (
@ -1199,7 +1210,7 @@ goto :ts_off
set esuavail =
set esuavail =
if defined _vis if defined isServer set esuavail = 1
if defined _vis if defined isServer set esuavail = 1
if %winbuild% LEQ 7602 if not defined _vis if not defined isThinpc set esuavail = 1
if %winbuild% LEQ 7602 if not defined _vis if not defined isThinpc set esuavail = 1
if %winbuild% GTR 7602 if %winbuild% LSS 10240 if defined isServer set esuavail = 1
if %winbuild% GTR 7602 if %winbuild% LEQ 14393 if defined isServer set esuavail = 1
if %winbuild% GEQ 10240 if %winbuild% LEQ 19045 if not defined isServer set esuavail = 1
if %winbuild% GEQ 10240 if %winbuild% LEQ 19045 if not defined isServer set esuavail = 1
if %winbuild% EQU 9600 set esuavail = 1
if %winbuild% EQU 9600 set esuavail = 1
@ -1317,9 +1328,9 @@ call :dk_color %Gray% "Checking Installed Office [Not Found]"
if defined ohub (
if defined ohub (
echo :
echo :
echo You only have the Office Dashboard app installed. Y ou need to install the full version of Office.
echo You only have the Office Dashboard app installed; y ou need to install the full version of Office.
)
)
call : dk_color %Blue% " Download and install Office from below URL and try again. "
call : dk_color %Blue% " Download and install Office from the URL below, then try again. "
if %_actwin% == 0 set fixes = %fixes% %mas% genuine-installation-media
if %_actwin% == 0 set fixes = %fixes% %mas% genuine-installation-media
call : dk_color %_Yellow% " %mas% genuine-installation-media "
call : dk_color %_Yellow% " %mas% genuine-installation-media "
goto : ts_act
goto : ts_act
@ -1469,7 +1480,7 @@ call :ts_process
: :========================================================================================================================================
: :========================================================================================================================================
: : mass()grave(dot) dev/office-license-is-not-genuine
: : mass{}grave{dot} dev/office-license-is-not-genuine
: : Add registry keys for volume products so that 'non-genuine' banner won't appear
: : Add registry keys for volume products so that 'non-genuine' banner won't appear
set " kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663 "
set " kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663 "
@ -1547,10 +1558,10 @@ if %winbuild% GEQ 10586 (
for %% # in ( " %SysPath% \spp\tokens\skus\ %tsedition% \*CSVLK*.xrm-ms " ) do (
for %% # in ( " %SysPath% \spp\tokens\skus\ %tsedition% \*CSVLK*.xrm-ms " ) do (
if defined _arr ( set " _arr=!_arr!; " %SysPath% \spp\tokens\skus\%tsedition% \%% ~nx#" " ) else ( set " _arr= " %SysPath% \spp\tokens\skus\%tsedition% \%% ~nx#" " )
if defined _arr ( set " _arr=!_arr!; " %SysPath% \spp\tokens\skus\%tsedition% \%% ~nx#" " ) else ( set " _arr= " %SysPath% \spp\tokens\skus\%tsedition% \%% ~nx#" " )
)
)
if defined _arr %psc% " $sls = Get-WmiObject %sps% ; $f=[System. IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!' " %nul%
if defined _arr %psc% " $sls = Get-WmiObject %sps% ; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!' " %nul%
)
)
for /f " delims= " %% a in ( ' %psc% "$f=[System. IO.File]::ReadAllText('!_batp!' ) -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6% ' ) do (
for /f " delims= " %% a in ( ' %psc% "$f=[IO.File]::ReadAllText('!_batp!' ) -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6% ' ) do (
echo " %% a " | findstr /r " .*-.*-.*-.*-.* " %nul1% && ( set tsids = !tsids! %% a& set tempid = %% a)
echo " %% a " | findstr /r " .*-.*-.*-.*-.* " %nul1% && ( set tsids = !tsids! %% a& set tempid = %% a)
)
)
@ -1744,7 +1755,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock...
echo :
echo :
set resetstuff = 1
set resetstuff = 1
%psc% " $f=[System. IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) "
%psc% " $f=[IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) "
if %errorlevel% == 3 (
if %errorlevel% == 3 (
call : dk_color %Red% " Reset Failed. "
call : dk_color %Red% " Reset Failed. "
@ -1792,7 +1803,7 @@ if %errorlevel%==1 exit /b
echo :
echo :
echo Fetching Supported Activation IDs list. Please wait...
echo Fetching Supported Activation IDs list. Please wait...
%psc% " $f=[System. IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';. ([scriptblock]::Create($f[1])) "
%psc% " $f=[IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';. ([scriptblock]::Create($f[1])) "
if %errorlevel% == 3 (
if %errorlevel% == 3 (
call : dk_color %Gray% " No supported activation ID found, aborting... "
call : dk_color %Gray% " No supported activation ID found, aborting... "
goto : dk_done
goto : dk_done
@ -1867,14 +1878,14 @@ $filteredResults = $results | Where-Object {
$true
$true
}
}
else {
else {
$_.Name -notlike " *CountrySpecific* "
$_.Name -like " *ESU* " -or $_.Name - notlike " *CountrySpecific* "
}
}
} | Where-Object {
} | Where-Object {
if ($env:tsedition - l i k e " * C l o u d E d i t i o n * " ) {
if ($env:tsedition - l i k e " * C l o u d E d i t i o n * " ) {
$true
$true
}
}
else {
else {
$_.Name -notlike " *CloudEdition* "
$_.Name -like " *ESU* " -or $_.Name - notlike " *CloudEdition* "
}
}
} | Where-Object {
} | Where-Object {
$_.Name -like " *CountrySpecific* " -or (IsMuiNotLocked $_.ID)
$_.Name -like " *CountrySpecific* " -or (IsMuiNotLocked $_.ID)
@ -1942,28 +1953,32 @@ echo Writing TrustedStore data...
if /i %tsmethod% == StaticCID ( echo Depositing Static Confirmation ID...) else ( echo Depositing Zero Confirmation ID...)
if /i %tsmethod% == StaticCID ( echo Depositing Static Confirmation ID...) else ( echo Depositing Zero Confirmation ID...)
)
)
echo :
echo :
%psc% " $f=[System. IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids% "
%psc% " $f=[IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids% "
if !errorlevel! == 3 (
if !errorlevel! == 3 (
if %_actman% == 0 ( if not defined showfix call : dk_color %Blue% " %_fixmsg% " )
if %_actman% == 0 ( if not defined showfix call : dk_color %Blue% " %_fixmsg% " )
set fixes = %fixes% %mas% troubleshoot
set fixes = %fixes% %mas% troubleshoot
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% troubleshoot "
) else (
) else (
if /i %tsmethod% == KMS4k if %winbuild% GEQ 26200 (
if /i %tsmethod% == KMS4k if %winbuild% GEQ 26100 if %_actwin% == 1 (
echo :
echo :
call : dk_color %Gray% " In Windows settings, you may see a renewal notification for activation that can be ignored. "
call : dk_color %Gray% " In Windows settings, you may see a renewal notification for activation that can be ignored. "
if /i %_actmethod% == Auto call : dk_color %Gray% " To avoid this notification, run the script with an internet connection to use the StaticCID method. "
if /i %_actmethod% == Auto call : dk_color %Gray% " To avoid this notification, run the script with an internet connection to use the StaticCID method. "
)
)
echo " %tsids% " | find /i " 7e94be23-b161-4956-a682-146ab291774c " %nul1% && (
echo " %tsids% " | find /i " 7e94be23-b161-4956-a682-146ab291774c " %nul1% && (
call : dk_color %Gray% " Windows Update can receive 1-3 years of ESU. 4-6 years ESU is not officially supported, but you can manually install updates . "
call : dk_color %Gray% " Windows Update gets 1-3 years of ESU; 4-6 are unofficial but let you install Server 2008 R2 updates manually . "
)
)
echo " %tsids% " | findstr /i " 4afc620f-12a4-48ad-8015-2aebfbd6e47c 11be7019-a309-4763-9a09-091d1722ffe3 " %nul1% && (
echo " %tsids% " | findstr /i " 4afc620f-12a4-48ad-8015-2aebfbd6e47c 11be7019-a309-4763-9a09-091d1722ffe3 " %nul1% && (
call : dk_color %Gray% " ESU is not officially supported on Windows 8.1, but you can manually install updates until Jan- 2024. "
call : dk_color %Gray% " ESU is not officially supported on Windows 8.1, but updates can be installed manually until January 2024. "
)
)
echo " %tsids% " | findstr /i " 0b533b5e-08b6-44f9-b885-c2de291ba456 f69e2d51-3bbd-4ddf-8da7-a145e9dca597 " %nul1% && (
echo " %tsids% " | findstr /i " 83d49986-add3-41d7-ba33-87c7bfb5c0fb 0b533b5e-08b6-44f9-b885-c2de291ba456 " %nul1% && (
call : dk_color %Gray% " Windows Update can receive 1-3 years of ESU. 4-6 years ESU is not officially supported, but it might be useful. "
call : dk_color %Gray% " Windows Update gets 1-3 years of ESU; 4-6 are unofficial but may let you install LTSC updates manually. "
if exist %SysPath% \ClipESUConsumer.exe ( %SysPath% \ClipESUConsumer.exe -evaluateEligibility)
if exist %SysPath% \ClipESU.exe ( %SysPath% \ClipESU.exe %nul% )
)
)
)
)
if defined esuexistsup echo Help: %mas% tsforge#windows-esu
if %_actwin% == 1 for %% # in ( 407) do if %osSKU% == %% # (
if %_actwin% == 1 for %% # in ( 407) do if %osSKU% == %% # (
call : dk_color %Red% " %winos% does not support activation on non-azure platforms. "
call : dk_color %Red% " %winos% does not support activation on non-azure platforms. "
)
)
@ -2223,7 +2238,7 @@ echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=k
set keytype = zero
set keytype = zero
)
)
for /f " delims= " %% a in ( ' %psc% "$f=[System. IO.File]::ReadAllText('!_batp!' ) -split ':offtsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6% ' ) do (
for /f " delims= " %% a in ( ' %psc% "$f=[IO.File]::ReadAllText('!_batp!' ) -split ':offtsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6% ' ) do (
echo " %% a " | findstr /r " .*-.*-.*-.*-.* " %nul1% && ( set tsids = !tsids! %% a& set _actid = %% a)
echo " %% a " | findstr /r " .*-.*-.*-.*-.* " %nul1% && ( set tsids = !tsids! %% a& set _actid = %% a)
)
)
set " _allactid=!tsids! "
set " _allactid=!tsids! "
@ -2344,7 +2359,7 @@ for %%# in ("!_oLPath!\%_License%*.xrm-ms") do (
if defined _arr ( set " _arr=!_arr!; " !_oLPath! \%% ~nx#" " ) else ( set " _arr= " !_oLPath! \%% ~nx#" " )
if defined _arr ( set " _arr=!_arr!; " !_oLPath! \%% ~nx#" " ) else ( set " _arr= " !_oLPath! \%% ~nx#" " )
)
)
%psc% " $sls = Get-WmiObject %sps% ; $f=[System. IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile ' " !_oLPath! \pkeyconfig-office.xrm-ms" ' " %nul%
%psc% " $sls = Get-WmiObject %sps% ; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile ' " !_oLPath! \pkeyconfig-office.xrm-ms" ' " %nul%
call : dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
call : dk_actids 0ff1ce15-a989-479d-af46-f275c6370663
echo " !allapps! " | find /i " !_actid! " %nul1% || (
echo " !allapps! " | find /i " !_actid! " %nul1% || (
@ -2449,10 +2464,10 @@ reg unload HKU\!defname! %nul%
if defined vnextexist (
if defined vnextexist (
echo :
echo :
call : dk_color %Gray% " Office vNext subscription detected: "
call : dk_color %Gray% " The logged-in Office account has a subscription license. "
call : dk_color %Blue% " If active, this license overrides other activation methods. "
call : dk_color %Blue% " If the subscription is active, it overrides other activation methods. "
call : dk_color %Blue% " If expiring soon, rerun the script after expiration . "
call : dk_color %Blue% " If it is expiring soon, rerun the activation script after it expires . "
call : dk_color2 %Blue% " If expired and script activation fails, get help - " %_Yellow% " %mas% troubleshoot "
call : dk_color2 %Blue% " If it has already expired and activation fails, get help here - " %_Yellow% " %mas% troubleshoot "
echo :
echo :
)
)
@ -2553,7 +2568,6 @@ if %upk_result%==1 echo Uninstalling Other/Grace Keys [Successful]
if %upk_result% == 2 (
if %upk_result% == 2 (
call : dk_color %Red% " Uninstalling Other/Grace Keys [Failed] "
call : dk_color %Red% " Uninstalling Other/Grace Keys [Failed] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " %_fixmsg% "
echo :
echo :
set showfix = 1
set showfix = 1
@ -2569,8 +2583,8 @@ exit /b
: oh_licrefresh
: oh_licrefresh
if exist " %SysPath% \spp\store_test\2.0\tokens.dat " (
if exist " %SysPath% \spp\store_test\2.0\tokens.dat " (
%psc% " Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[System. IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses " %nul%
%psc% " Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses " %nul%
if !errorlevel! NEQ 0 %psc% " $sls = Get-WmiObject SoftwareLicensingService; $f=[System. IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses " %nul%
if !errorlevel! NEQ 0 %psc% " $sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses " %nul%
)
)
exit /b
exit /b
@ -2725,7 +2739,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con
if %_wmic% EQU 1 for /f " tokens=2 delims== " %% a in ( '"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6% ' ) do if not errorlevel 1 set " wmiSKU= %% a "
if %_wmic% EQU 1 for /f " tokens=2 delims== " %% a in ( '"wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6% ' ) do if not errorlevel 1 set " wmiSKU= %% a "
if %_wmic% EQU 0 for /f " tokens=1 " %% a in ( ' %psc% "([WMI]'Win32_OperatingSystem=@' ) .OperatingSystemSKU" %nul6% ') do if not errorlevel 1 set " wmiSKU=%% a"
if %_wmic% EQU 0 for /f " tokens=1 " %% a in ( ' %psc% "([WMI]'Win32_OperatingSystem=@' ) .OperatingSystemSKU" %nul6% ') do if not errorlevel 1 set " wmiSKU=%% a"
if %winbuild% GEQ 15063 %psc% " $f=[System. IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1])) " %nul2% | find /i " Subscription_is_activated " %nul% && (
if %winbuild% GEQ 15063 %psc% " $f=[IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1])) " %nul2% | find /i " Subscription_is_activated " %nul% && (
if defined regSKU if defined slcSKU if not " %regSKU% " == " %slcSKU% " (
if defined regSKU if defined slcSKU if not " %regSKU% " == " %slcSKU% " (
set winsub = 1
set winsub = 1
set osSKU = %regSKU%
set osSKU = %regSKU%
@ -2789,7 +2803,6 @@ echo %keyecho% %~1 [Successful]
call : dk_color %Red% " %keyecho% %~1 [Failed] %keyerror% "
call : dk_color %Red% " %keyecho% %~1 [Failed] %keyerror% "
if not defined showfix (
if not defined showfix (
if defined altapplist call : dk_color %Red% " Activation ID not found for this key. "
if defined altapplist call : dk_color %Red% " Activation ID not found for this key. "
echo :
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " %_fixmsg% "
echo :
echo :
set showfix = 1
set showfix = 1
@ -2912,6 +2925,10 @@ set spperror=%errorlevel%
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
%eline%
%eline%
echo sc start %_slser% [Error Code: %spperror% ]
echo sc start %_slser% [Error Code: %spperror% ]
if %spperror% EQU 1053 (
call : dk_color %Blue% " Reboot your machine using the restart option and try again. "
call : dk_color %Blue% " If it still does not work, go back to Main Menu, select Troubleshoot and run Fix WPA Registry option. "
)
)
)
echo :
echo :
@ -2977,20 +2994,19 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\
set hcount = 0
set hcount = 0
for %% # in ( avira.com kaspersky.com virustotal.com mcafee.com) do (
for %% # in ( avira.com kaspersky.com virustotal.com mcafee.com) do (
find /i " %% # " %SysPath% \drivers\etc\hosts %nul% && set /a hcount += 1 )
find /i " %% # " %SysPath% \drivers\etc\hosts %nul% && set /a hcount += 1 )
if %hcount% == 4 set " results=[Antivirus URLs are blocked in hosts] "
if %hcount% == 4 set " results=Antivirus URLs blocked in hosts file "
sc start %_slser% %nul%
sc start %_slser% %nul%
echo " %errorlevel% " | findstr " 577 225 " %nul% && (
echo " %errorlevel% " | findstr " 577 225 " %nul% && (
set " results= %results% [ Likely File Infector] "
set " results= %results% Likely File Infector "
) || (
) || (
if not exist %SysPath% \%_slexe% if not exist %SysPath% \alg.exe ( set " results= %results% [Likely File Infector] " )
if not exist %SysPath% \%_slexe% if not exist %SysPath% \alg.exe ( set " results= %results% [Likely File Infector] " )
)
)
if not " %results% %pupfound% " == " " (
if not " %results% %pupfound% " == " " (
if defined pupfound call : dk_color %Gray% " Checking PUP Activators [Found %pupfound% ] "
if defined pupfound call : dk_color %Gray% " Checking PUP Activators [ %pupfound% ] "
if defined results call : dk_color %Red% " Checking Probable Mal %w% ware Infection... "
if defined results call : dk_color %Red% " Checking for Mal %w% ware Infection... [ %results% ] "
if defined results ( call : dk_color %Red% " %results% " & set showfix = 1)
call : dk_color %Gray% " It is highly likely that your Windows install is infected with mal %w% ware. Windows cannot be activated. "
echo :
set fixes = %fixes% %mas% remove_mal%w% ware
set fixes = %fixes% %mas% remove_mal%w% ware
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% remove_mal %w% ware "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% remove_mal %w% ware "
echo :
echo :
@ -3018,7 +3034,6 @@ call :dk_chkmal
sc query Null %nul% || (
sc query Null %nul% || (
call : dk_color %Red% " Checking Sandboxing [Found, script may not work properly] "
call : dk_color %Red% " Checking Sandboxing [Found, script may not work properly] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " If you are using any third-party antivirus, check if it is blocking the script. "
call : dk_color %Blue% " If you are using any third-party antivirus, check if it is blocking the script. "
echo :
echo :
)
)
@ -3034,7 +3049,6 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE" /v InstRoot
call : dk_color %Red% " Checking WinPE [Found] "
call : dk_color %Red% " Checking WinPE [Found] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " WinPE mode found. Reboot the system and run in normal mode. "
call : dk_color %Blue% " WinPE mode found. Reboot the system and run in normal mode. "
echo :
echo :
)
)
@ -3049,7 +3063,6 @@ set showfix=1
if defined safeboot_option (
if defined safeboot_option (
call : dk_color %Red% " Checking Boot Mode [ %safeboot_option% ] "
call : dk_color %Red% " Checking Boot Mode [ %safeboot_option% ] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " Safe mode found. Reboot the system and run in normal mode. "
call : dk_color %Blue% " Safe mode found. Reboot the system and run in normal mode. "
echo :
echo :
)
)
@ -3068,7 +3081,6 @@ if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
call : dk_color %Gray% " Checking Windows Setup State [ %imagestate% ] "
call : dk_color %Gray% " Checking Windows Setup State [ %imagestate% ] "
echo " %imagestate% " | find /i " RESEAL " %nul% && (
echo " %imagestate% " | find /i " RESEAL " %nul% && (
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " You need to run it in normal mode in case you are running it in Audit Mode. "
call : dk_color %Blue% " You need to run it in normal mode in case you are running it in Audit Mode. "
echo :
echo :
)
)
@ -3077,7 +3089,6 @@ set showfix=1
)
)
echo " %imagestate% " | find /i " UNDEPLOYABLE " %nul% && (
echo " %imagestate% " | find /i " UNDEPLOYABLE " %nul% && (
if not defined showfix (
if not defined showfix (
echo :
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% in-place_repair_upgrade
call : dk_color2 %Blue% " If the activation fails, do this - " %_Yellow% " %mas% in-place_repair_upgrade "
call : dk_color2 %Blue% " If the activation fails, do this - " %_Yellow% " %mas% in-place_repair_upgrade "
echo :
echo :
@ -3163,7 +3174,6 @@ if not defined showfix (
echo :
echo :
echo %serv_cste% | findstr /i " ClipSVC sppsvc " %nul% && (
echo %serv_cste% | findstr /i " ClipSVC sppsvc " %nul% && (
echo A registry fix has been applied to enable the disabled service.
echo A registry fix has been applied to enable the disabled service.
echo :
call : dk_color %Blue% " Reboot your machine using the restart option to fix this error. "
call : dk_color %Blue% " Reboot your machine using the restart option to fix this error. "
) || (
) || (
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% in-place_repair_upgrade
@ -3204,7 +3214,6 @@ if not defined showfix (
set listwospp = %_serv:sppsvc=%
set listwospp = %_serv:sppsvc=%
echo %serv_e% | findstr /i " !listwospp! " %nul% && (
echo %serv_e% | findstr /i " !listwospp! " %nul% && (
set showfix = 1
set showfix = 1
echo :
call : dk_color %Blue% " Reboot your machine using the restart option and run the script again. "
call : dk_color %Blue% " Reboot your machine using the restart option and run the script again. "
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% in-place_repair_upgrade
call : dk_color2 %Blue% " If service error is still not fixed, do this - " %_Yellow% " %mas% in-place_repair_upgrade "
call : dk_color2 %Blue% " If service error is still not fixed, do this - " %_Yellow% " %mas% in-place_repair_upgrade "
@ -3223,13 +3232,19 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
if %_wmic% EQU 0 %psc% " Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName " %nul2% | find /i " computersystem " %nul1%
if %_wmic% EQU 0 %psc% " Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName " %nul2% | find /i " computersystem " %nul1%
if %errorlevel% NEQ 0 set wmifailed = 1
if %errorlevel% NEQ 0 set wmifailed = 1
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
if %_wmic% EQU 0 %psc% " try { $null=([WMISEARCHER]'SELECT * FROM %sps% ').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult } " %nul%
set error_code = %errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set " error_code=0x %=ExitCode% "
echo " %error_code% " | findstr /i " 0x800410 0x800440 0x80131501 " %nul1% && set wmifailed = 1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
echo " %error_code% " | findstr /i " 0x800410 0x800440 0x80131501 " %nul1% && set wmifailed = 1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed (
if defined wmifailed (
call : dk_color %Red% " Checking WMI [Not Working] "
call : dk_color %Red% " Checking WMI [Not Working] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " Go back to Main Menu, select Troubleshoot and run Fix WMI option. "
call : dk_color %Blue% " Go back to Main Menu, select Troubleshoot and run Fix WMI option. "
echo :
echo :
)
)
@ -3244,7 +3259,6 @@ set showfix=1
if %winbuild% GEQ 7600 reg query " HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0 " /f ba02fed39662 /d %nul% || (
if %winbuild% GEQ 7600 reg query " HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0 " /f ba02fed39662 /d %nul% || (
call : dk_color %Red% " Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers] "
call : dk_color %Red% " Checking SPP Registry Key [Incorrect ModuleId Found] [Most likely caused by gaming spoofers] "
if not defined showfix (
if not defined showfix (
echo :
set fixes = %fixes% %mas% issues_due_to_gaming_spoofers
set fixes = %fixes% %mas% issues_due_to_gaming_spoofers
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% issues_due_to_gaming_spoofers "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% issues_due_to_gaming_spoofers "
echo :
echo :
@ -3265,7 +3279,6 @@ if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\Net
if %winbuild% GEQ 9200 if /i not " !tokenstore! " == " %SysPath% \spp\store " if /i not " !tokenstore! " == " %SysPath% \spp\store\2.0 " if /i not " !tokenstore! " == " %SysPath% \spp\store_test\2.0 " (
if %winbuild% GEQ 9200 if /i not " !tokenstore! " == " %SysPath% \spp\store " if /i not " !tokenstore! " == " %SysPath% \spp\store\2.0 " if /i not " !tokenstore! " == " %SysPath% \spp\store_test\2.0 " (
call : dk_color %Red% " Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!] "
call : dk_color %Red% " Checking TokenStore Registry Key [Correct Path Not Found] [!tokenstore!] "
if not defined showfix (
if not defined showfix (
echo :
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% in-place_repair_upgrade
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
echo :
echo :
@ -3296,7 +3309,6 @@ call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Creat
) else (
) else (
call : dk_color %Red% " Checking SPP Token Folder [Not Found, Failed to Create] [ %tokenstore% \] "
call : dk_color %Red% " Checking SPP Token Folder [Not Found, Failed to Create] [ %tokenstore% \] "
if not defined showfix (
if not defined showfix (
echo :
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% in-place_repair_upgrade
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
echo :
echo :
@ -3341,7 +3353,6 @@ if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
if defined permerror (
if defined permerror (
call : dk_color %Red% " Checking SPP Permissions [!permerror!] "
call : dk_color %Red% " Checking SPP Permissions [!permerror!] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " %_fixmsg% "
echo :
echo :
)
)
@ -3356,14 +3367,13 @@ set showfix=1
set chkalp =
set chkalp =
set wpainfo = NotFound
set wpainfo = NotFound
for /f " delims= " %% a in ( ' %psc% "$f=[System. IO.File]::ReadAllText('!_batp!' ) -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6% ' ) do ( set wpainfo = %% a)
for /f " delims= " %% a in ( ' %psc% "$f=[IO.File]::ReadAllText('!_batp!' ) -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6% ' ) do ( set wpainfo = %% a)
for /f " delims=0123456789 " %% i in ( " %wpainfo% " ) do set chkalp = %% i
for /f " delims=0123456789 " %% i in ( " %wpainfo% " ) do set chkalp = %% i
if defined chkalp (
if defined chkalp (
call : dk_color %Red% " Checking WPA Registry Errors [ %wpainfo% ] "
call : dk_color %Red% " Checking WPA Registry Errors [ %wpainfo% ] "
if not defined showfix (
if not defined showfix (
echo " %wpainfo% " | find /i " Error Found " %nul% && (
echo " %wpainfo% " | find /i " Error Found " %nul% && (
echo :
call : dk_color %Blue% " Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option. "
call : dk_color %Blue% " Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option. "
echo :
echo :
set error = 1
set error = 1
@ -3376,7 +3386,6 @@ set wpainfo=a
if not defined chkalp (
if not defined chkalp (
if %wpainfo% GEQ 5000 (
if %wpainfo% GEQ 5000 (
call : dk_color %Gray% " Checking WPA Registry Count [ %wpainfo% ] "
call : dk_color %Gray% " Checking WPA Registry Count [ %wpainfo% ] "
echo :
call : dk_color %Blue% " A large number of WPA registries have been found, which may cause high CPU usage. "
call : dk_color %Blue% " A large number of WPA registries have been found, which may cause high CPU usage. "
call : dk_color %Blue% " Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option. "
call : dk_color %Blue% " Go back to Main Menu, select Troubleshoot and run Fix WPA Registry option. "
echo :
echo :
@ -3392,7 +3401,6 @@ echo Checking WPA Registry Count [%wpainfo%]
reg query " HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed " %nul% && (
reg query " HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed " %nul% && (
call : dk_color %Red% " Checking Rearm [System is Rearmed] "
call : dk_color %Red% " Checking Rearm [System is Rearmed] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " Reboot your machine using the restart option to fix this error. "
call : dk_color %Blue% " Reboot your machine using the restart option to fix this error. "
echo :
echo :
)
)
@ -3404,7 +3412,6 @@ set showfix=1
reg query " HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState " %nul% && (
reg query " HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ClipSVC\Volatile\PersistedSystemState " %nul% && (
call : dk_color %Red% " Checking ClipSVC PersistedSystemState [Found] "
call : dk_color %Red% " Checking ClipSVC PersistedSystemState [Found] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " Reboot your machine using the restart option to fix this error. "
call : dk_color %Blue% " Reboot your machine using the restart option to fix this error. "
echo :
echo :
)
)
@ -3416,16 +3423,9 @@ set showfix=1
: : Check SoftwareLicensingService
: : Check SoftwareLicensingService
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
if %_wmic% EQU 0 %psc% " try { $null=([WMISEARCHER]'SELECT * FROM %sps% ').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult } " %nul%
set error_code = %errorlevel%
cmd /c exit /b %error_code%
if %error_code% NEQ 0 set " error_code=0x %=ExitCode% "
if %error_code% NEQ 0 (
if %error_code% NEQ 0 (
call : dk_color %Red% " Checking SoftwareLicensingService [Not Working] [ %error_code% ] "
call : dk_color %Red% " Checking SoftwareLicensingService [Not Working] [ %error_code% ] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " If activation still fails then run Fix WPA Registry option. "
call : dk_color %Blue% " If activation still fails then run Fix WPA Registry option. "
echo :
echo :
@ -3441,7 +3441,7 @@ set showfix=1
call : dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
call : dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
if not defined apps (
if not defined apps (
%psc% " if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System. IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses " %nul%
%psc% " if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses " %nul%
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed = 1
if not defined _vis if !errorlevel! NEQ 0 set rlicfailed = 1
call : dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
call : dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
)
)
@ -3455,7 +3455,6 @@ call :dk_color %Gray% "Checking Activation IDs [Key Not Installe
if not defined apps if not defined allapps (
if not defined apps if not defined allapps (
call : dk_color %Red% " Checking Activation IDs [Not found] "
call : dk_color %Red% " Checking Activation IDs [Not found] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " If activation still fails then run Fix WPA Registry option. "
call : dk_color %Blue% " If activation still fails then run Fix WPA Registry option. "
echo :
echo :
@ -3465,7 +3464,6 @@ set showfix=1
)
)
if not defined showfix if defined rlicfailed (
if not defined showfix if defined rlicfailed (
echo :
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " If activation still fails then run Fix WPA Registry option. "
call : dk_color %Blue% " If activation still fails then run Fix WPA Registry option. "
echo :
echo :
@ -3483,7 +3481,6 @@ if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Win
reg query " HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion " /v EditionID %nul2% | find /i " Eval " %nul1% || (
reg query " HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion " /v EditionID %nul2% | find /i " Eval " %nul1% || (
call : dk_color %Red% " Checking Eval Packages [License swapping found. Non-Eval licenses are installed in Eval Windows] "
call : dk_color %Red% " Checking Eval Packages [License swapping found. Non-Eval licenses are installed in Eval Windows] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " License swapping is not the right way to upgrade to the full version. Learn the correct method at the link below. "
call : dk_color %Blue% " License swapping is not the right way to upgrade to the full version. Learn the correct method at the link below. "
set fixes = %fixes% %mas% evaluation_editions
set fixes = %fixes% %mas% evaluation_editions
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% evaluation_editions "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% evaluation_editions "
@ -3501,7 +3498,6 @@ set showfix=1
reg query " HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion " %nul% || (
reg query " HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion " %nul% || (
call : dk_color %Red% " Checking HKU\S-1-5-20 Registry [Not Found] "
call : dk_color %Red% " Checking HKU\S-1-5-20 Registry [Not Found] "
if not defined showfix (
if not defined showfix (
echo :
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% in-place_repair_upgrade
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
echo :
echo :
@ -3539,6 +3535,13 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
if not exist " %SystemRoot% \Servicing\Packages\Microsoft-Windows-*- %osedition% -*.mum " (
if not exist " %SystemRoot% \Servicing\Packages\Microsoft-Windows-*- %osedition% -*.mum " (
if not exist " %SystemRoot% \Servicing\Packages\Microsoft-Windows- %osedition% Edition*.mum " (
if not exist " %SystemRoot% \Servicing\Packages\Microsoft-Windows- %osedition% Edition*.mum " (
call : dk_color %Red% " Checking Package Files [Not Found] [ %osedition% ] "
call : dk_color %Red% " Checking Package Files [Not Found] [ %osedition% ] "
if not defined showfix (
set fixes = %fixes% %mas% in-place_repair_upgrade
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
echo :
)
set error = 1
set showfix = 1
)
)
)
)
)
)
@ -3568,7 +3571,9 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
: : This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
: : This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
if exist " %SysPath% \wlms\wlms.exe " (
sc query wlms %nul%
if %errorlevel% NEQ 1060 (
echo Checking Eval WLMS Service [Found]
echo Checking Eval WLMS Service [Found]
)
)
@ -3583,7 +3588,6 @@ if defined _sppint (
echo %_sppint% | find /i " PerfOptions " %nul% && (
echo %_sppint% | find /i " PerfOptions " %nul% && (
call : dk_color %Red% " Checking SPP Interference In IFEO [ %_sppint% - System might deactivate later] "
call : dk_color %Red% " Checking SPP Interference In IFEO [ %_sppint% - System might deactivate later] "
if not defined showfix (
if not defined showfix (
echo :
call : dk_color %Blue% " %_fixmsg% "
call : dk_color %Blue% " %_fixmsg% "
echo :
echo :
)
)
@ -3618,7 +3622,6 @@ if "!taskinfo!"=="" set "taskinfo=Not Found"
call : dk_color %Gray% " Checking SvcRestartTask Status [!taskinfo!. System might deactivate later.] "
call : dk_color %Gray% " Checking SvcRestartTask Status [!taskinfo!. System might deactivate later.] "
if not defined showfix (
if not defined showfix (
echo :
echo " !taskinfo! " | findstr /i " Removed Not Found " %nul1% && (
echo " !taskinfo! " | findstr /i " Removed Not Found " %nul1% && (
set fixes = %fixes% %mas% in-place_repair_upgrade
set fixes = %fixes% %mas% in-place_repair_upgrade
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
call : dk_color2 %Blue% " Check this webpage for help - " %_Yellow% " %mas% in-place_repair_upgrade "
@ -3720,7 +3723,7 @@ if %_unattended%==1 timeout /t 2 & exit /b
if defined fixes (
if defined fixes (
call : dk_color %White% " Follow ALL the ABOVE blue lines. "
call : dk_color %White% " Follow ALL the ABOVE blue lines. "
call : dk_color2 %Blue% " Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore "
call : dk_color2 %Blue% " Press [1] to Open Support Webpage " %Gray% " Press [0] to Go Back "
choice /C:10 /N
choice /C:10 /N
if !errorlevel! == 2 exit /b
if !errorlevel! == 2 exit /b
if !errorlevel! == 1 ( start %selfgit% & start %github% & for %% # in ( %fixes% ) do ( start %% #) )
if !errorlevel! == 1 ( start %selfgit% & start %github% & for %% # in ( %fixes% ) do ( start %% #) )
@ -8835,26 +8838,27 @@ namespace LibTSforge.PhysicalStore
}
}
'@
'@
$ErrorActionPreference = 'Stop'
$ErrorActionPreference = 'Stop'
$binPath = " $env:_work\BIN\LibTSforge.dll "
$psMajorVer = (Get-Host).Version.Major
$psMajorVer = (Get-Host).Version.Major
$build = [System.Environment]::OSVersion.Version.Build
if (Test-Path - L i t e r a l P a t h $ b i n P a t h ) {
$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@(" System.dll " , " System.Core.dll " , " System.ServiceProcess.dll " , " System.Xml.dll " , " System.Xml.Linq.dll " )
Write-Host " LibTSforge.dll found in BIN folder. Loading the DLL... "
if ($psMajorVer - l e 2 ) { $ c p . C o m p i l e r O p t i o n s = " / d e f i n e : P O W E R S H E L L 2 / u n s a f e " } e l s e { $ c p . C o m p i l e r O p t i o n s = " / u n s a f e " }
Add-Type -Path $binPath
$lang = if ($psMajorVer -gt 2) { " CSharp " } else { " CSharpVersion3 " }
}
else {
$ctemp = " $env:SystemRoot\Temp\$([Guid]::NewGuid().Guid)\ "
$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@(" System.dll " , " System.Core.dll " , " System.ServiceProcess.dll " , " System.Xml.dll " , " System.Xml.Linq.dll " )
if (-Not ( T e s t - P a t h - P a t h $ c t e m p ) ) { N e w - I t e m - P a t h $ c t e m p - I t e m T y p e D i r e c t o r y > $ n u l l }
if ($psMajorVer - l e 2 ) { $ c p . C o m p i l e r O p t i o n s = " / d e f i n e : P O W E R S H E L L 2 / u n s a f e " } e l s e { $ c p . C o m p i l e r O p t i o n s = " / u n s a f e " }
$env:TMP = $ctemp
$lang = if ($psMajorVer -gt 2) { " CSharp " } else { " CSharpVersion3 " }
$env:TEMP = $ctemp
$ctemp = " $env:SystemRoot\Temp\ "
$cp.GenerateInMemory = $true
if (-Not ( T e s t - P a t h - P a t h $ c t e m p ) ) { N e w - I t e m - P a t h $ c t e m p - I t e m T y p e D i r e c t o r y > $ n u l l }
Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
$env:TMP = $ctemp
$env:TEMP = $ctemp
try {
$cp.TempFiles.Dispose()
$cp.GenerateInMemory = $true
} catch {
Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
# Older .NET Framework versions do not have that method, but they also don't create the folder that it removes.
}
}
Remove-Item -Path $ctemp
if ($env:_debug - e q ' 0 ' ) {
if ($env:_debug - e q ' 0 ' ) {
[LibTSforge.Logger]::HideOutput = $true
[LibTSforge.Logger]::HideOutput = $true
@ -8935,7 +8939,12 @@ if (-not $env:resetstuff) {
}
}
if ($env:tsmethod - e q " K M S 4 k " ) {
if ($env:tsmethod - e q " K M S 4 k " ) {
$GracePeriodStatus = Get-WmiInfo -tsactid $tsactid -property " GracePeriodRemaining "
$GracePeriodStatus = Get-WmiInfo -tsactid $tsactid -property " GracePeriodRemaining "
if ($GracePeriodStatus - g t 2 5 9 2 0 0 ) { $ a c t i v a t e d = 1 }
if ($GracePeriodStatus - e q 2 5 9 2 0 0 - o r ( [ d a t e t i m e ] : : N o w . A d d M i n u t e s ( $ G r a c e P e r i o d S t a t u s ) ) . Y e a r - g t 2 0 3 8 ) {
if ((($build - g e 2 6 1 0 0 - a n d $ G r a c e P e r i o d S t a t u s - g e 2 5 9 2 0 0 ) - o r
( $build -lt 26100 -and $GracePeriodStatus -gt 259200) )) {
$activated = 1
}
}
}
}
else {
else {
$licenseStatus = Get-WmiInfo -tsactid $tsactid -property " LicenseStatus "
$licenseStatus = Get-WmiInfo -tsactid $tsactid -property " LicenseStatus "
@ -8949,7 +8958,13 @@ if (-not $env:resetstuff) {
}
}
else {
else {
if ($env:tsmethod - e q " K M S 4 k " ) {
if ($env:tsmethod - e q " K M S 4 k " ) {
Write-Host " [$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod. " -ForegroundColor White -BackgroundColor DarkGreen
if ($build - g e 2 6 1 0 0 ) {
Write-Host " [$prodName] is activated with KMS4k for over 4,000 years. " -ForegroundColor White -BackgroundColor DarkGreen
Write-Host " From build 26100.7019, Windows will always display a remaining activation period of 180 days in Settings. " -ForegroundColor White -BackgroundColor Darkgray
}
else {
Write-Host " [$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod. " -ForegroundColor White -BackgroundColor DarkGreen
}
}
}
else {
else {
Write-Host " [$prodName] is permanently activated with $env:tsmethod. " -ForegroundColor White -BackgroundColor DarkGreen
Write-Host " [$prodName] is permanently activated with $env:tsmethod. " -ForegroundColor White -BackgroundColor DarkGreen