From 6c8732dd06e8ea604232b8fbd17218526c6f9552 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Tue, 18 Feb 2025 03:35:32 +0530 Subject: [PATCH 01/30] Correct the chart link in readme --- MAS/Separate-Files-Version/Activators/_ReadMe.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAS/Separate-Files-Version/Activators/_ReadMe.txt b/MAS/Separate-Files-Version/Activators/_ReadMe.txt index 2473884..058a628 100644 --- a/MAS/Separate-Files-Version/Activators/_ReadMe.txt +++ b/MAS/Separate-Files-Version/Activators/_ReadMe.txt @@ -10,4 +10,5 @@ Online KMS - Windows / Office - 180 Days. Lifetime With Renewal -------------------------------------------------------------------------------------- -For more details, check https://massgrave.dev/activations_comparison \ No newline at end of file +Check the below link for more details: +https://massgrave.dev/chart \ No newline at end of file From 6adb247334ed7cff17cc7ce2089fd2d4e77771bf Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Tue, 18 Feb 2025 03:42:42 +0530 Subject: [PATCH 02/30] Update W10 ESU editions list as per 19045.5552 --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 8 ++++---- .../Activators/TSforge_Activation.cmd | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index dfb8b2f..f67809e 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -4037,10 +4037,10 @@ REM Windows8.1 REM WindowsServer2012/2012R2 55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- REM Windows10 -83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3[1-3y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN- -0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN- -4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3[1-3y]_-IoTEnterprise- REM Removed IoTEnterpriseS because it already has longer support -f69e2d51-3bbd-4ddf-8da7-a145e9dca597_Client-IoT-ESU-Year6[4-6y]_-IoTEnterprise- REM Removed IoTEnterpriseS because it already has longer support +83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3[1-3y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3[1-3y]_-IoTEnterprise- +f69e2d51-3bbd-4ddf-8da7-a145e9dca597_Client-IoT-ESU-Year6[4-6y]_-IoTEnterprise- ) do ( for /f "tokens=1-3 delims=_" %%A in ("%%#") do ( echo "%allapps%" | find /i "%%A" %nul1% && ( diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 030e406..23b88b4 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -735,10 +735,10 @@ REM Windows8.1 REM WindowsServer2012/2012R2 55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- REM Windows10 -83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3[1-3y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN- -0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN- -4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3[1-3y]_-IoTEnterprise- REM Removed IoTEnterpriseS because it already has longer support -f69e2d51-3bbd-4ddf-8da7-a145e9dca597_Client-IoT-ESU-Year6[4-6y]_-IoTEnterprise- REM Removed IoTEnterpriseS because it already has longer support +83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3[1-3y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3[1-3y]_-IoTEnterprise- +f69e2d51-3bbd-4ddf-8da7-a145e9dca597_Client-IoT-ESU-Year6[4-6y]_-IoTEnterprise- ) do ( for /f "tokens=1-3 delims=_" %%A in ("%%#") do ( echo "%allapps%" | find /i "%%A" %nul1% && ( From 8d67d62c1590a0e6808557ff32c5325462a16879 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Tue, 18 Feb 2025 04:44:35 +0530 Subject: [PATCH 03/30] Update esu info --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 4 ++-- MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index f67809e..a2c8dee 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -4699,13 +4699,13 @@ set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" ) else ( 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 year ESU is not officially supported, but you can manually install updates." +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." ) 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." ) echo "%tsids%" | findstr /i "0b533b5e-08b6-44f9-b885-c2de291ba456 f69e2d51-3bbd-4ddf-8da7-a145e9dca597" %nul1% && ( -call :dk_color %Gray% "Windows Update can receive 1-3 years of ESU. 4-6 year ESU license is added just as a placeholder." +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." ) ) diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 23b88b4..03fddba 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1397,13 +1397,13 @@ set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" ) else ( 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 year ESU is not officially supported, but you can manually install updates." +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." ) 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." ) echo "%tsids%" | findstr /i "0b533b5e-08b6-44f9-b885-c2de291ba456 f69e2d51-3bbd-4ddf-8da7-a145e9dca597" %nul1% && ( -call :dk_color %Gray% "Windows Update can receive 1-3 years of ESU. 4-6 year ESU license is added just as a placeholder." +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." ) ) From a5bcfdd3e66db80694b44f323e1f7e40e30364a4 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sat, 22 Feb 2025 19:50:37 +0530 Subject: [PATCH 04/30] Update info in tsforge uninstall section --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 3 +-- MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index a2c8dee..6ad1a46 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -4740,8 +4740,7 @@ mode 100, 30 title Remove TSforge Activation %masver% echo: -echo TSforge activation doesn't modify any Windows component. -echo TSforge activation doesn't install any new file in the system. +echo TSforge activation doesn't modify any Windows components and doesn't install any new files. echo: echo Instead, it appends data to one of data files used by Software Protection Platform. echo: diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 03fddba..be410b2 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1438,8 +1438,7 @@ mode 100, 30 title Remove TSforge Activation %masver% echo: -echo TSforge activation doesn't modify any Windows component. -echo TSforge activation doesn't install any new file in the system. +echo TSforge activation doesn't modify any Windows components and doesn't install any new files. echo: echo Instead, it appends data to one of data files used by Software Protection Platform. echo: From a9eda8f572653ae1459757018f8a9691411635ef Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sat, 22 Feb 2025 20:13:09 +0530 Subject: [PATCH 05/30] Select 1 and 2Y ESU as well instead of only 3Y, just to be sure --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 8 ++++++-- .../Activators/TSforge_Activation.cmd | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 6ad1a46..45bd294 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -4037,9 +4037,13 @@ REM Windows8.1 REM WindowsServer2012/2012R2 55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- REM Windows10 -83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3[1-3y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- 0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- -4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3[1-3y]_-IoTEnterprise- +b8527af1-5389-447c-9a88-2d1691ea33d3_Client-IoT-ESU-Year1_-IoTEnterprise- +7b76ee02-0a75-4f08-85d5-bd0feadad0c0_Client-IoT-ESU-Year2_-IoTEnterprise- +4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3_-IoTEnterprise- f69e2d51-3bbd-4ddf-8da7-a145e9dca597_Client-IoT-ESU-Year6[4-6y]_-IoTEnterprise- ) do ( for /f "tokens=1-3 delims=_" %%A in ("%%#") do ( diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index be410b2..e04677d 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -735,9 +735,13 @@ REM Windows8.1 REM WindowsServer2012/2012R2 55b1dd2d-2209-4ea0-a805-06298bad25b3_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore- REM Windows10 -83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3[1-3y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- +83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- 0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh- -4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3[1-3y]_-IoTEnterprise- +b8527af1-5389-447c-9a88-2d1691ea33d3_Client-IoT-ESU-Year1_-IoTEnterprise- +7b76ee02-0a75-4f08-85d5-bd0feadad0c0_Client-IoT-ESU-Year2_-IoTEnterprise- +4dac5a0c-5709-4595-a32c-14a56a4a6b31_Client-IoT-ESU-Year3_-IoTEnterprise- f69e2d51-3bbd-4ddf-8da7-a145e9dca597_Client-IoT-ESU-Year6[4-6y]_-IoTEnterprise- ) do ( for /f "tokens=1-3 delims=_" %%A in ("%%#") do ( From 5e7e42a44655993b4975e9616b20ff2b8c8d0b59 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sat, 22 Feb 2025 20:52:26 +0530 Subject: [PATCH 06/30] Add a backup url in update check --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 14 ++++++++++---- .../Activators/HWID_Activation.cmd | 14 ++++++++++---- .../Activators/KMS38_Activation.cmd | 14 ++++++++++---- .../Activators/Ohook_Activation_AIO.cmd | 14 ++++++++++---- .../Activators/Online_KMS_Activation.cmd | 14 ++++++++++---- .../Activators/TSforge_Activation.cmd | 14 ++++++++++---- .../Change_Office_Edition.cmd | 14 ++++++++++---- .../Change_Windows_Edition.cmd | 14 ++++++++++---- MAS/Separate-Files-Version/Extract_OEM_Folder.cmd | 14 ++++++++++---- MAS/Separate-Files-Version/Troubleshoot.cmd | 14 ++++++++++---- 10 files changed, 100 insertions(+), 40 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 45bd294..a043b38 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -265,12 +265,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 6b960f8..1989d51 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -304,12 +304,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index 7ae669d..17fae23 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -307,12 +307,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 454644c..980cb50 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -297,12 +297,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 519c1bd..70632ce 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -326,12 +326,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index e04677d..1af9408 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -332,12 +332,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 05d4410..29fec81 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -257,12 +257,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index fa4f62f..3c954d7 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -262,12 +262,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index bae7818..2b70d33 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -256,12 +256,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index fb32306..1884358 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -257,12 +257,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080) set -= set old= +set pingp= set upver=%masver:.=% -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do ( -if not "%%#"=="" set old=1 -for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do ( -if not "%%#"=="" set old= +for %%A in ( +activ%-%ated.win +mass%-%grave.dev +) do if not defined pingp ( +for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do ( +if not "%%B"=="" (set old=1& set pingp=1) +for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do ( +if not "%%C"=="" set old= +) ) ) From 55afa30fcd9147fe54ad1a85193e9777df2bb63b Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sun, 23 Feb 2025 20:36:55 +0530 Subject: [PATCH 07/30] Improve powershell test --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 57 ++++++++++--------- .../Activators/HWID_Activation.cmd | 57 ++++++++++--------- .../Activators/KMS38_Activation.cmd | 57 ++++++++++--------- .../Activators/Ohook_Activation_AIO.cmd | 57 ++++++++++--------- .../Activators/Online_KMS_Activation.cmd | 57 ++++++++++--------- .../Activators/TSforge_Activation.cmd | 57 ++++++++++--------- .../Change_Office_Edition.cmd | 57 ++++++++++--------- .../Change_Windows_Edition.cmd | 57 ++++++++++--------- .../Extract_OEM_Folder.cmd | 57 ++++++++++--------- MAS/Separate-Files-Version/Troubleshoot.cmd | 57 ++++++++++--------- 10 files changed, 300 insertions(+), 270 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index a043b38..11b8ec9 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -180,33 +180,6 @@ goto dk_done ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto dk_done -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -219,6 +192,36 @@ goto dk_done ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto dk_done +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto dk_done +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 1989d51..fa3786a 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -219,33 +219,6 @@ goto dk_done ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto dk_done -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -258,6 +231,36 @@ goto dk_done ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto dk_done +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto dk_done +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index 17fae23..eeee718 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -222,33 +222,6 @@ goto dk_done ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto dk_done -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -261,6 +234,36 @@ goto dk_done ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto dk_done +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto dk_done +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 980cb50..a1679e1 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -212,33 +212,6 @@ goto dk_done ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto dk_done -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -251,6 +224,36 @@ goto dk_done ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto dk_done +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto dk_done +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 70632ce..e14f24b 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -241,33 +241,6 @@ goto dk_done ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto dk_done -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -280,6 +253,36 @@ goto dk_done ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto dk_done +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto dk_done +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 1af9408..96a273c 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -247,33 +247,6 @@ goto dk_done ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto dk_done -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -286,6 +259,36 @@ goto dk_done ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto dk_done +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto dk_done +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 29fec81..6ec47b5 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -172,33 +172,6 @@ goto dk_done ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto dk_done -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -211,6 +184,36 @@ goto dk_done ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto dk_done +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto dk_done +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 3c954d7..19c1c3a 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -177,33 +177,6 @@ goto dk_done ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto dk_done -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -216,6 +189,36 @@ goto dk_done ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto dk_done +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto dk_done +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index 2b70d33..c1b78c1 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -171,33 +171,6 @@ goto done2 ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto done2 -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -210,6 +183,36 @@ goto done2 ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto done2 +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto done2 +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index 1884358..73cb0c4 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -172,33 +172,6 @@ goto dk_done ::======================================================================================================================================== -:: Check PowerShell - -REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: - -cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( -%eline% -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" -echo: -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( -echo Failed to run Powershell command but Powershell is working. -echo: -cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" -echo: -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" -) || ( -echo PowerShell is not working. Aborting... -echo If you have applied restrictions on Powershell then undo those changes. -echo: -set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" -) -goto dk_done -) - -::======================================================================================================================================== - :: Elevate script as admin and pass arguments and preventing loop %nul1% fltmc || ( @@ -211,6 +184,36 @@ goto dk_done ::======================================================================================================================================== +:: Check PowerShell + +::pstst $ExecutionContext.SessionState.LanguageMode :pstst + +for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) + +if /i "%tstresult%"=="ConstrainedLanguage" ( +%eline% +echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo If you have applied restrictions on Powershell then undo those changes. +echo: +set fixes=%fixes% %mas%fix_powershell +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +goto dk_done +) + +if /i not "%tstresult%"=="FullLanguage" ( +%eline% +echo "%tstresult%" +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +echo PowerShell is not working properly. Aborting... +cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" +echo: +set fixes=%fixes% %mas%troubleshoot +call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +goto dk_done +) + +::======================================================================================================================================== + :: Disable QuickEdit and launch from conhost.exe to avoid Terminal app if %winbuild% GEQ 17763 ( From ab0cd24f89f5b16a35cc7a685b59d5fe5460289d Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Mon, 24 Feb 2025 00:36:35 +0530 Subject: [PATCH 08/30] Add more checks for powershell --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 26 ++++++++++++++----- .../Activators/HWID_Activation.cmd | 26 ++++++++++++++----- .../Activators/KMS38_Activation.cmd | 26 ++++++++++++++----- .../Activators/Ohook_Activation_AIO.cmd | 26 ++++++++++++++----- .../Activators/Online_KMS_Activation.cmd | 26 ++++++++++++++----- .../Activators/TSforge_Activation.cmd | 26 ++++++++++++++----- .../Change_Office_Edition.cmd | 26 ++++++++++++++----- .../Change_Windows_Edition.cmd | 26 ++++++++++++++----- .../Extract_OEM_Folder.cmd | 26 ++++++++++++++----- MAS/Separate-Files-Version/Troubleshoot.cmd | 26 ++++++++++++++----- 10 files changed, 190 insertions(+), 70 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 11b8ec9..06e4d83 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -196,11 +196,18 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -208,10 +215,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto dk_done +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index fa3786a..2730ec6 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -235,11 +235,18 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -247,10 +254,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto dk_done +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index eeee718..19586c1 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -238,11 +238,18 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -250,10 +257,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto dk_done +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index a1679e1..53860bd 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -228,11 +228,18 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -240,10 +247,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto dk_done +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index e14f24b..2a15a50 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -257,11 +257,18 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -269,10 +276,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto dk_done +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 96a273c..3067851 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -263,11 +263,18 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -275,10 +282,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto dk_done +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 6ec47b5..95d4044 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -188,11 +188,18 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -200,10 +207,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto dk_done +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 19c1c3a..10a1559 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -193,11 +193,18 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -205,10 +212,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto dk_done +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index c1b78c1..7c8c3d4 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -187,11 +187,18 @@ goto done2 ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -199,10 +206,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto done2 ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto done2 +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index 73cb0c4..8ce62b7 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -188,11 +188,18 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) +for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a) -if /i "%tstresult%"=="ConstrainedLanguage" ( +if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo ConstrainedLanguage mode found in PowerShell. Aborting... +echo %tstresult% +cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" + +REM check LanguageMode + +cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( +%eline% +echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell @@ -200,10 +207,15 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) -if /i not "%tstresult%"=="FullLanguage" ( -%eline% -echo "%tstresult%" -cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" +REM check Powershell core version + +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... +goto dk_done +) + +REM check antivirus and other errors + echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: From 69f1a206fb17d2d101954ed221094295d8dc5d59 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Fri, 14 Mar 2025 15:27:57 +0530 Subject: [PATCH 09/30] Change file hash --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 06e4d83..f8cda8c 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -1,4 +1,4 @@ -@::u78r-random +@::63489fhty3-random @set masver=3.0 @setlocal DisableDelayedExpansion @echo off From c4f33e96c472484b89b81d6b29cb995ea8148bf1 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sun, 16 Mar 2025 02:34:10 +0530 Subject: [PATCH 10/30] Update WPA keys check code --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 6 +++--- MAS/Separate-Files-Version/Activators/HWID_Activation.cmd | 6 +++--- MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd | 6 +++--- .../Activators/Ohook_Activation_AIO.cmd | 6 +++--- .../Activators/Online_KMS_Activation.cmd | 6 +++--- .../Activators/TSforge_Activation.cmd | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index f8cda8c..bdcee26 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -1879,7 +1879,7 @@ exit /b $wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA") $count = 0 foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $count++ } } @@ -1888,7 +1888,7 @@ $minBuildNumber = 14393 if ($osVersion.Build -ge $minBuildNumber) { $subkeyHashTable = @{} foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $keyNumber = $subkeyName -replace '.*-', '' $subkeyHashTable[$keyNumber] = $true } @@ -1902,7 +1902,7 @@ if ($osVersion.Build -ge $minBuildNumber) { } } $wpaKey.GetSubKeyNames() | ForEach-Object { - if ($_ -match '.*-.*-.*-.*-.*-') { + if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { if ($PSVersionTable.PSVersion.Major -lt 3) { cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" if ($LASTEXITCODE -ne 0) { diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 2730ec6..6a379f7 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -1594,7 +1594,7 @@ exit /b $wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA") $count = 0 foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $count++ } } @@ -1603,7 +1603,7 @@ $minBuildNumber = 14393 if ($osVersion.Build -ge $minBuildNumber) { $subkeyHashTable = @{} foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $keyNumber = $subkeyName -replace '.*-', '' $subkeyHashTable[$keyNumber] = $true } @@ -1617,7 +1617,7 @@ if ($osVersion.Build -ge $minBuildNumber) { } } $wpaKey.GetSubKeyNames() | ForEach-Object { - if ($_ -match '.*-.*-.*-.*-.*-') { + if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { if ($PSVersionTable.PSVersion.Major -lt 3) { cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" if ($LASTEXITCODE -ne 0) { diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index 19586c1..ff6e59d 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -1743,7 +1743,7 @@ exit /b $wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA") $count = 0 foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $count++ } } @@ -1752,7 +1752,7 @@ $minBuildNumber = 14393 if ($osVersion.Build -ge $minBuildNumber) { $subkeyHashTable = @{} foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $keyNumber = $subkeyName -replace '.*-', '' $subkeyHashTable[$keyNumber] = $true } @@ -1766,7 +1766,7 @@ if ($osVersion.Build -ge $minBuildNumber) { } } $wpaKey.GetSubKeyNames() | ForEach-Object { - if ($_ -match '.*-.*-.*-.*-.*-') { + if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { if ($PSVersionTable.PSVersion.Major -lt 3) { cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" if ($LASTEXITCODE -ne 0) { diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 53860bd..ce9ad93 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -2013,7 +2013,7 @@ exit /b $wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA") $count = 0 foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $count++ } } @@ -2022,7 +2022,7 @@ $minBuildNumber = 14393 if ($osVersion.Build -ge $minBuildNumber) { $subkeyHashTable = @{} foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $keyNumber = $subkeyName -replace '.*-', '' $subkeyHashTable[$keyNumber] = $true } @@ -2036,7 +2036,7 @@ if ($osVersion.Build -ge $minBuildNumber) { } } $wpaKey.GetSubKeyNames() | ForEach-Object { - if ($_ -match '.*-.*-.*-.*-.*-') { + if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { if ($PSVersionTable.PSVersion.Major -lt 3) { cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" if ($LASTEXITCODE -ne 0) { diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 2a15a50..f1576e0 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -3167,7 +3167,7 @@ exit /b $wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA") $count = 0 foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $count++ } } @@ -3176,7 +3176,7 @@ $minBuildNumber = 14393 if ($osVersion.Build -ge $minBuildNumber) { $subkeyHashTable = @{} foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $keyNumber = $subkeyName -replace '.*-', '' $subkeyHashTable[$keyNumber] = $true } @@ -3190,7 +3190,7 @@ if ($osVersion.Build -ge $minBuildNumber) { } } $wpaKey.GetSubKeyNames() | ForEach-Object { - if ($_ -match '.*-.*-.*-.*-.*-') { + if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { if ($PSVersionTable.PSVersion.Major -lt 3) { cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" if ($LASTEXITCODE -ne 0) { diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 3067851..1cf85e9 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -2722,7 +2722,7 @@ exit /b $wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA") $count = 0 foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $count++ } } @@ -2731,7 +2731,7 @@ $minBuildNumber = 14393 if ($osVersion.Build -ge $minBuildNumber) { $subkeyHashTable = @{} foreach ($subkeyName in $wpaKey.GetSubKeyNames()) { - if ($subkeyName -match '.*-.*-.*-.*-.*-') { + if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { $keyNumber = $subkeyName -replace '.*-', '' $subkeyHashTable[$keyNumber] = $true } @@ -2745,7 +2745,7 @@ if ($osVersion.Build -ge $minBuildNumber) { } } $wpaKey.GetSubKeyNames() | ForEach-Object { - if ($_ -match '.*-.*-.*-.*-.*-') { + if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') { if ($PSVersionTable.PSVersion.Major -lt 3) { cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1" if ($LASTEXITCODE -ne 0) { From fe001e6c39777cce8d059c0da35ea48a109ac929 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sun, 16 Mar 2025 03:04:40 +0530 Subject: [PATCH 11/30] Elaborate help message --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 120 +++++++++--------- .../Activators/HWID_Activation.cmd | 36 +++--- .../Activators/KMS38_Activation.cmd | 38 +++--- .../Activators/Ohook_Activation_AIO.cmd | 26 ++-- .../Activators/Online_KMS_Activation.cmd | 30 ++--- .../Activators/TSforge_Activation.cmd | 46 +++---- .../Change_Office_Edition.cmd | 30 ++--- .../Change_Windows_Edition.cmd | 26 ++-- .../Extract_OEM_Folder.cmd | 10 +- MAS/Separate-Files-Version/Troubleshoot.cmd | 10 +- 10 files changed, 186 insertions(+), 186 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index bdcee26..6581baf 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -76,7 +76,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -91,7 +91,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -137,7 +137,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -211,7 +211,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) @@ -228,7 +228,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -642,7 +642,7 @@ if not exist %SysPath%\%%# ( echo [%SysPath%\%%#] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -688,7 +688,7 @@ echo Evaluation editions cannot be activated outside of their evaluation period. call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period." echo: set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" goto dk_done ) ) @@ -775,7 +775,7 @@ echo %mas% ) else ( echo Required license files not found in %SysPath%\spp\tokens\skus\ set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) echo: goto dk_done @@ -954,7 +954,7 @@ findstr /i "%%#" "%SysPath%\drivers\etc\hosts" %nul1% && set "hosfail= [%%# Bloc ) call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]!hosfail!" set fixes=%fixes% %mas%licensing-servers-issue -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%licensing-servers-issue" ) ::========================================================================================================================================== @@ -991,7 +991,7 @@ call :dk_color %Red% "Checking Windows Update Registry [Corruption Found] if !wcount! GTR 2 ( call :dk_color %Red% "Windows seems to be infected with Mal%w%ware." set fixes=%fixes% %mas%remove_mal%w%ware -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" ) else ( call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it." ) @@ -1016,7 +1016,7 @@ if not defined wucorrupt if not defined wublock if not defined wuerror if not de echo "%error_code%" | findstr /i "0x80072e 0x80072f 0x800704cf 0x87e10bcf 0x800705b4" %nul% && ( call :dk_color %Red% "Checking Internet Issues [Found] %error_code%" set fixes=%fixes% %mas%licensing-servers-issue -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%licensing-servers-issue" ) ) ) @@ -1034,7 +1034,7 @@ call :dk_color %Blue% "Use TSforge activation option from the main menu instead. ) else ( if not defined error call :dk_color %Blue% "%_fixmsg%" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) ) @@ -1356,7 +1356,7 @@ echo sc start sppsvc [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -1432,7 +1432,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "%results%" set fixes=%fixes% %mas%remove_mal%w%ware -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: ) @@ -1552,7 +1552,7 @@ set showfix=1 ) echo %serv_e% | findstr /i "sppsvc-1060" %nul% && ( set fixes=%fixes% %mas%fix_service -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service" set showfix=1 ) ) @@ -1609,7 +1609,7 @@ 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% || ( call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]" set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) ) @@ -1739,7 +1739,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N 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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers -call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" +call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" set error=1 set showfix=1 ) @@ -1754,7 +1754,7 @@ set error=1 set showfix=1 call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) @@ -2189,7 +2189,7 @@ if not exist %SysPath%\sppsvc.exe ( echo [%SysPath%\sppsvc.exe] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -2468,7 +2468,7 @@ call :dk_color %Red% "Some errors were detected." if not defined ierror if not defined showfix if not defined serv_cor if not defined serv_cste call :dk_color %Blue% "%_fixmsg%" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) goto :dk_done @@ -3759,7 +3759,7 @@ if not exist %SysPath%\sppsvc.exe ( echo [%SysPath%\sppsvc.exe] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -3772,7 +3772,7 @@ echo Install .NET Framework 4.8 and Windows Management Framework 5.1 ) echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -3786,7 +3786,7 @@ echo Evaluation WLMS service is running, sppsvc service can not be stopped. Abor echo Install Non-Eval version for Windows build %winbuild%. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -3825,7 +3825,7 @@ call :dk_errorcheck if defined error ( call :dk_color %Red% "Some errors were detected. Aborting the operation..." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :dk_done ) @@ -3833,7 +3833,7 @@ call :ts_getedition if not defined tsedition ( call :dk_color %Red% "Checking Windows Edition ID [Not found in installed licenses, aborting...]" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :dk_done ) @@ -4114,7 +4114,7 @@ if %winbuild% EQU 9600 set esuavail=1 if defined esuavail ( call :dk_color %Red% "Checking Activation ID [ESU license is not found, make sure Windows is fully updated]" set fixes=%fixes% %mas%tsforge#windows-esu -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%tsforge#windows-esu" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%tsforge#windows-esu" ) else ( call :dk_color %Gray% "Checking Activation ID [ESU is not available for %winos%]" ) @@ -4478,7 +4478,7 @@ echo Checking Activation ID [%%A] [%%B] if not defined ohostexist ( call :dk_color %Gray% "Checking Activation ID [Not found for Office %KS% Host]" -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%tsforge#office-kms-host" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%tsforge#office-kms-host" ) echo: @@ -4544,7 +4544,7 @@ set resetstuff=1 if %errorlevel%==3 ( call :dk_color %Red% "Reset Failed." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) else ( call :dk_color %Green% "Reset process has been successfully done." ) @@ -4708,7 +4708,7 @@ call :dk_color %Gray% "To activate, check your internet connection and ensure th call :dk_color %Blue% "This Windows version is known to not activate due to MS Windows/Server issues." ) set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) ) @@ -4721,7 +4721,7 @@ echo: if !errorlevel!==3 ( if %_actman%==0 call :dk_color %Blue% "%_fixmsg%" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) else ( 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." @@ -4749,7 +4749,7 @@ call :dk_reeval %nul% if not defined tsids if defined error if not defined showfix ( set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) goto :dk_done @@ -4864,7 +4864,7 @@ call :dk_color %Red% "Checking Activation ID [Office %oVer%.0 ! set error=1 set showfix=1 set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) echo %%# | find /i "2024" %nul% && ( @@ -9681,7 +9681,7 @@ if defined _fmiss ( echo [%_fmiss%] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -9738,7 +9738,7 @@ echo Evaluation editions cannot be activated outside of their evaluation period. call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period." echo: set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) goto dk_done ) @@ -9754,7 +9754,7 @@ if not exist "!_work!\clipup.exe" ( echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] versions. echo The file is required for KMS38 activation. echo Check the below page for instructions on how to activate it. -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%kms38" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%kms38" goto dk_done ) ) @@ -9766,7 +9766,7 @@ if defined a_cor ( if !errorlevel!==3 ( %eline% echo Valid digital signature not found in clipup.exe file. -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -9834,13 +9834,13 @@ if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1 if defined skunotfound ( call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) if defined sppks ( call :dk_color %Red% "KMS38 activation is supported but failed to find the key." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) if not defined skunotfound if not defined sppks ( @@ -9890,7 +9890,7 @@ if %_wmic% EQU 0 for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELE if not defined app ( call :dk_color %Red% "Checking Installed GVLK Activation ID [Not Found] Aborting..." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :dk_done ) @@ -10058,7 +10058,7 @@ goto :k_final call :dk_color %Red% "Activation Failed" if not defined error call :dk_color %Blue% "%_fixmsg%" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ::======================================================================================================================================== @@ -10513,7 +10513,7 @@ if not exist %SysPath%\sppsvc.exe ( echo [%SysPath%\sppsvc.exe] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -10606,7 +10606,7 @@ call :dk_color %Blue% "Go back to main menu and use [Change Edition] option." ) else ( call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period." set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) goto :ks_office @@ -10656,13 +10656,13 @@ if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Componen if defined skunotfound ( call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) if defined sppks ( call :dk_color %Red% "%KS% activation is supported but failed to find the %KS% key." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) if not defined skunotfound if not defined sppks ( @@ -14728,7 +14728,7 @@ if not exist %SysPath%\%%# ( echo [%SysPath%\%%#] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -14761,7 +14761,7 @@ if not defined allapps ( echo Failed to find activation IDs. Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -14784,7 +14784,7 @@ if not defined osedition ( echo Failed to detect OS edition, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -14946,7 +14946,7 @@ echo [%targetedition% ^| %winbuild%] echo Failed to get product key from pkeyhelper.dll. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -15001,7 +15001,7 @@ call :dk_color %Gray% "Reboot is required to fully change the edition." call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) ) @@ -15082,7 +15082,7 @@ echo [%targetedition% ^| %winbuild%] echo Failed to get product key from pkeyhelper.dll. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -15158,7 +15158,7 @@ echo: call :dk_color %Blue% "In case there are errors, you should restart the system before trying again." echo: set fixes=%fixes% %mas%change_edition_issues -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%change_edition_issues" exit /b ::======================================================================================================================================== @@ -15581,7 +15581,7 @@ if not exist %SysPath%\sppsvc.exe ( echo [%SysPath%\sppsvc.exe] file is missing. Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -15619,7 +15619,7 @@ if %osedition%==0 ( echo Failed to detect OS Edition. Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -15692,7 +15692,7 @@ echo which is not officially supported on your Windows build version %winbuild%. echo Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -15706,7 +15706,7 @@ echo Unsupported Office %verchk% is installed on your Windows build version %win echo Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -15812,7 +15812,7 @@ if not exist %SystemRoot%\Temp\%list%.txt ( echo Failed to generate available editions list. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :oe_goback ) @@ -15877,7 +15877,7 @@ if not exist %SystemRoot%\Temp\getAppIds.txt ( echo Failed to generate available apps list. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :oe_goback ) ) @@ -16059,7 +16059,7 @@ if %errorcode% EQU 0 ( call :dk_color %Gray% "Now run the Office activation option from the main menu." ) else ( set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) call :oe_tempcleanup @@ -16202,7 +16202,7 @@ echo %c2rcommand% if %errorlevel% NEQ 0 ( echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) goto :oe_goback @@ -16350,7 +16350,7 @@ echo: echo %updcommand% %updcommand% echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot goto :oe_goback ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 6a379f7..50512c5 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -109,7 +109,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -124,7 +124,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -167,7 +167,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -250,7 +250,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) @@ -267,7 +267,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -373,7 +373,7 @@ if not exist %SysPath%\%%# ( echo [%SysPath%\%%#] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -419,7 +419,7 @@ echo Evaluation editions cannot be activated outside of their evaluation period. call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period." echo: set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" goto dk_done ) ) @@ -506,7 +506,7 @@ echo %mas% ) else ( echo Required license files not found in %SysPath%\spp\tokens\skus\ set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) echo: goto dk_done @@ -685,7 +685,7 @@ findstr /i "%%#" "%SysPath%\drivers\etc\hosts" %nul1% && set "hosfail= [%%# Bloc ) call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]!hosfail!" set fixes=%fixes% %mas%licensing-servers-issue -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%licensing-servers-issue" ) ::========================================================================================================================================== @@ -722,7 +722,7 @@ call :dk_color %Red% "Checking Windows Update Registry [Corruption Found] if !wcount! GTR 2 ( call :dk_color %Red% "Windows seems to be infected with Mal%w%ware." set fixes=%fixes% %mas%remove_mal%w%ware -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" ) else ( call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it." ) @@ -747,7 +747,7 @@ if not defined wucorrupt if not defined wublock if not defined wuerror if not de echo "%error_code%" | findstr /i "0x80072e 0x80072f 0x800704cf 0x87e10bcf 0x800705b4" %nul% && ( call :dk_color %Red% "Checking Internet Issues [Found] %error_code%" set fixes=%fixes% %mas%licensing-servers-issue -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%licensing-servers-issue" ) ) ) @@ -765,7 +765,7 @@ call :dk_color %Blue% "Use TSforge activation option from the main menu instead. ) else ( if not defined error call :dk_color %Blue% "%_fixmsg%" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) ) @@ -1071,7 +1071,7 @@ echo sc start sppsvc [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -1147,7 +1147,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "%results%" set fixes=%fixes% %mas%remove_mal%w%ware -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: ) @@ -1267,7 +1267,7 @@ set showfix=1 ) echo %serv_e% | findstr /i "sppsvc-1060" %nul% && ( set fixes=%fixes% %mas%fix_service -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service" set showfix=1 ) ) @@ -1324,7 +1324,7 @@ 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% || ( call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]" set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) ) @@ -1454,7 +1454,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N 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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers -call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" +call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" set error=1 set showfix=1 ) @@ -1469,7 +1469,7 @@ set error=1 set showfix=1 call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index ff6e59d..e5ed725 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -112,7 +112,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -127,7 +127,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -173,7 +173,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -253,7 +253,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) @@ -270,7 +270,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -413,7 +413,7 @@ if defined _fmiss ( echo [%_fmiss%] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -470,7 +470,7 @@ echo Evaluation editions cannot be activated outside of their evaluation period. call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period." echo: set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) goto dk_done ) @@ -486,7 +486,7 @@ if not exist "!_work!\clipup.exe" ( echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] versions. echo The file is required for KMS38 activation. echo Check the below page for instructions on how to activate it. -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%kms38" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%kms38" goto dk_done ) ) @@ -498,7 +498,7 @@ if defined a_cor ( if !errorlevel!==3 ( %eline% echo Valid digital signature not found in clipup.exe file. -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -566,13 +566,13 @@ if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1 if defined skunotfound ( call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) if defined sppks ( call :dk_color %Red% "KMS38 activation is supported but failed to find the key." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) if not defined skunotfound if not defined sppks ( @@ -622,7 +622,7 @@ if %_wmic% EQU 0 for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELE if not defined app ( call :dk_color %Red% "Checking Installed GVLK Activation ID [Not Found] Aborting..." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :dk_done ) @@ -790,7 +790,7 @@ goto :k_final call :dk_color %Red% "Activation Failed" if not defined error call :dk_color %Blue% "%_fixmsg%" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ::======================================================================================================================================== @@ -1175,7 +1175,7 @@ echo sc start sppsvc [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -1296,7 +1296,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "%results%" set fixes=%fixes% %mas%remove_mal%w%ware -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: ) @@ -1416,7 +1416,7 @@ set showfix=1 ) echo %serv_e% | findstr /i "sppsvc-1060" %nul% && ( set fixes=%fixes% %mas%fix_service -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service" set showfix=1 ) ) @@ -1473,7 +1473,7 @@ 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% || ( call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]" set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) ) @@ -1603,7 +1603,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N 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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers -call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" +call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" set error=1 set showfix=1 ) @@ -1618,7 +1618,7 @@ set error=1 set showfix=1 call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index ce9ad93..2f41448 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -109,7 +109,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -124,7 +124,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -167,7 +167,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -243,7 +243,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) @@ -260,7 +260,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -404,7 +404,7 @@ if not exist %SysPath%\sppsvc.exe ( echo [%SysPath%\sppsvc.exe] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -683,7 +683,7 @@ call :dk_color %Red% "Some errors were detected." if not defined ierror if not defined showfix if not defined serv_cor if not defined serv_cste call :dk_color %Blue% "%_fixmsg%" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) goto :dk_done @@ -1506,7 +1506,7 @@ echo sc start sppsvc [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -1566,7 +1566,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "%results%" set fixes=%fixes% %mas%remove_mal%w%ware -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: ) @@ -1686,7 +1686,7 @@ set showfix=1 ) echo %serv_e% | findstr /i "sppsvc-1060" %nul% && ( set fixes=%fixes% %mas%fix_service -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service" set showfix=1 ) ) @@ -1743,7 +1743,7 @@ 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% || ( call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]" set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) ) @@ -1873,7 +1873,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N 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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers -call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" +call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" set error=1 set showfix=1 ) @@ -1888,7 +1888,7 @@ set error=1 set showfix=1 call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index f1576e0..61d6f1c 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -134,7 +134,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -149,7 +149,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -198,7 +198,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -272,7 +272,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) @@ -289,7 +289,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -464,7 +464,7 @@ if not exist %SysPath%\sppsvc.exe ( echo [%SysPath%\sppsvc.exe] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -557,7 +557,7 @@ call :dk_color %Blue% "Go back to main menu and use [Change Edition] option." ) else ( call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period." set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) goto :ks_office @@ -607,13 +607,13 @@ if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Componen if defined skunotfound ( call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) if defined sppks ( call :dk_color %Red% "%KS% activation is supported but failed to find the %KS% key." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) if not defined skunotfound if not defined sppks ( @@ -2599,7 +2599,7 @@ echo sc start sppsvc [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -2720,7 +2720,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "%results%" set fixes=%fixes% %mas%remove_mal%w%ware -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: ) @@ -2840,7 +2840,7 @@ set showfix=1 ) echo %serv_e% | findstr /i "sppsvc-1060" %nul% && ( set fixes=%fixes% %mas%fix_service -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service" set showfix=1 ) ) @@ -2897,7 +2897,7 @@ 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% || ( call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]" set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) ) @@ -3027,7 +3027,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N 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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers -call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" +call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" set error=1 set showfix=1 ) @@ -3042,7 +3042,7 @@ set error=1 set showfix=1 call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 1cf85e9..d6bfc9a 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -138,7 +138,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -153,7 +153,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -204,7 +204,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -278,7 +278,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) @@ -295,7 +295,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -457,7 +457,7 @@ if not exist %SysPath%\sppsvc.exe ( echo [%SysPath%\sppsvc.exe] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -470,7 +470,7 @@ echo Install .NET Framework 4.8 and Windows Management Framework 5.1 ) echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -484,7 +484,7 @@ echo Evaluation WLMS service is running, sppsvc service can not be stopped. Abor echo Install Non-Eval version for Windows build %winbuild%. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -523,7 +523,7 @@ call :dk_errorcheck if defined error ( call :dk_color %Red% "Some errors were detected. Aborting the operation..." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :dk_done ) @@ -531,7 +531,7 @@ call :ts_getedition if not defined tsedition ( call :dk_color %Red% "Checking Windows Edition ID [Not found in installed licenses, aborting...]" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :dk_done ) @@ -812,7 +812,7 @@ if %winbuild% EQU 9600 set esuavail=1 if defined esuavail ( call :dk_color %Red% "Checking Activation ID [ESU license is not found, make sure Windows is fully updated]" set fixes=%fixes% %mas%tsforge#windows-esu -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%tsforge#windows-esu" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%tsforge#windows-esu" ) else ( call :dk_color %Gray% "Checking Activation ID [ESU is not available for %winos%]" ) @@ -1176,7 +1176,7 @@ echo Checking Activation ID [%%A] [%%B] if not defined ohostexist ( call :dk_color %Gray% "Checking Activation ID [Not found for Office %KS% Host]" -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%tsforge#office-kms-host" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%tsforge#office-kms-host" ) echo: @@ -1242,7 +1242,7 @@ set resetstuff=1 if %errorlevel%==3 ( call :dk_color %Red% "Reset Failed." set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) else ( call :dk_color %Green% "Reset process has been successfully done." ) @@ -1406,7 +1406,7 @@ call :dk_color %Gray% "To activate, check your internet connection and ensure th call :dk_color %Blue% "This Windows version is known to not activate due to MS Windows/Server issues." ) set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) ) @@ -1419,7 +1419,7 @@ echo: if !errorlevel!==3 ( if %_actman%==0 call :dk_color %Blue% "%_fixmsg%" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) else ( 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." @@ -1447,7 +1447,7 @@ call :dk_reeval %nul% if not defined tsids if defined error if not defined showfix ( set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) goto :dk_done @@ -1622,7 +1622,7 @@ call :dk_color %Red% "Checking Activation ID [Office %oVer%.0 ! set error=1 set showfix=1 set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) echo %%# | find /i "2024" %nul% && ( @@ -2199,7 +2199,7 @@ echo sc start sppsvc [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -2275,7 +2275,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..." if defined results call :dk_color %Red% "%results%" set fixes=%fixes% %mas%remove_mal%w%ware -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" echo: ) @@ -2395,7 +2395,7 @@ set showfix=1 ) echo %serv_e% | findstr /i "sppsvc-1060" %nul% && ( set fixes=%fixes% %mas%fix_service -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service" set showfix=1 ) ) @@ -2452,7 +2452,7 @@ 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% || ( call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]" set fixes=%fixes% %mas%evaluation_editions -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions" ) ) @@ -2582,7 +2582,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N 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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers -call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" +call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" set error=1 set showfix=1 ) @@ -2597,7 +2597,7 @@ set error=1 set showfix=1 call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]" set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 95d4044..32a8727 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -69,7 +69,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -84,7 +84,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -129,7 +129,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -203,7 +203,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) @@ -220,7 +220,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -319,7 +319,7 @@ if not exist %SysPath%\sppsvc.exe ( echo [%SysPath%\sppsvc.exe] file is missing. Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -357,7 +357,7 @@ if %osedition%==0 ( echo Failed to detect OS Edition. Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -430,7 +430,7 @@ echo which is not officially supported on your Windows build version %winbuild%. echo Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -444,7 +444,7 @@ echo Unsupported Office %verchk% is installed on your Windows build version %win echo Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -550,7 +550,7 @@ if not exist %SystemRoot%\Temp\%list%.txt ( echo Failed to generate available editions list. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :oe_goback ) @@ -615,7 +615,7 @@ if not exist %SystemRoot%\Temp\getAppIds.txt ( echo Failed to generate available apps list. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto :oe_goback ) ) @@ -797,7 +797,7 @@ if %errorcode% EQU 0 ( call :dk_color %Gray% "Now run the Office activation option from the main menu." ) else ( set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) call :oe_tempcleanup @@ -940,7 +940,7 @@ echo %c2rcommand% if %errorlevel% NEQ 0 ( echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) goto :oe_goback @@ -1088,7 +1088,7 @@ echo: echo %updcommand% %updcommand% echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot goto :oe_goback ::======================================================================================================================================== @@ -1412,7 +1412,7 @@ echo sc start sppsvc [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Common lines used in PowerShell reflection code diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 10a1559..2c0dbb8 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -74,7 +74,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -89,7 +89,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -134,7 +134,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -208,7 +208,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) @@ -225,7 +225,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -346,7 +346,7 @@ if not exist %SysPath%\%%# ( echo [%SysPath%\%%#] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) ) @@ -379,7 +379,7 @@ if not defined allapps ( echo Failed to find activation IDs. Aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -402,7 +402,7 @@ if not defined osedition ( echo Failed to detect OS edition, aborting... echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -564,7 +564,7 @@ echo [%targetedition% ^| %winbuild%] echo Failed to get product key from pkeyhelper.dll. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -619,7 +619,7 @@ call :dk_color %Gray% "Reboot is required to fully change the edition." call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) ) @@ -700,7 +700,7 @@ echo [%targetedition% ^| %winbuild%] echo Failed to get product key from pkeyhelper.dll. echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -776,7 +776,7 @@ echo: call :dk_color %Blue% "In case there are errors, you should restart the system before trying again." echo: set fixes=%fixes% %mas%change_edition_issues -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%change_edition_issues" exit /b :compresslog @@ -911,7 +911,7 @@ echo sc start sppsvc [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Common lines used in PowerShell reflection code diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index 7c8c3d4..735941d 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -69,7 +69,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -84,7 +84,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -128,7 +128,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -202,7 +202,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto done2 ) @@ -219,7 +219,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto done2 ) diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index 8ce62b7..1c12499 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -69,7 +69,7 @@ echo: echo Null service is not running, script may crash... echo: echo: -echo Help - %mas%fix_service +echo Check this webpage for help - %mas%fix_service echo: echo: ping 127.0.0.1 -n 20 @@ -84,7 +84,7 @@ echo: echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo: echo: -echo Help - %mas%troubleshoot +echo Check this webpage for help - %mas%troubleshoot echo: echo: ping 127.0.0.1 -n 20 >nul @@ -129,7 +129,7 @@ echo Failed to detect Windows build number. echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) @@ -203,7 +203,7 @@ echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: set fixes=%fixes% %mas%fix_powershell -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell" goto dk_done ) @@ -220,7 +220,7 @@ echo PowerShell is not working properly. Aborting... cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" echo: set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done ) From 1e3c0aaedfab33362007458996f38ba5de4c7192 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sat, 12 Apr 2025 19:00:48 +0530 Subject: [PATCH 12/30] Fix MSI Office detection for Visio and few other products --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 449 +++++++----------- .../Activators/Ohook_Activation_AIO.cmd | 146 +++++- .../Activators/Online_KMS_Activation.cmd | 293 +++++++----- .../Activators/TSforge_Activation.cmd | 234 ++++----- 4 files changed, 613 insertions(+), 509 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 6581baf..39f3b77 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -2856,7 +2856,7 @@ set "_common2=%CommonProgramFiles(x86)%" for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -call :ohookdata getmsiprod %2 +call :msiofficedata %2 echo: echo Activating Office... [MSI ^| %_version% ^| %_oArch%] @@ -3343,17 +3343,6 @@ if %oVer%==16 (echo "%%D" | find /i "Subscription" %nul% && set _sublic=1) ) ) -if %1==getmsiprod if %oVer%==%%A ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%B" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -reg query "%2\Registration\{%%B}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%E) else (set _oIds=%%E) -) -) -) - ) ) exit /b @@ -4921,7 +4910,7 @@ set "pkeypath=%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pk set "pkeypath=%_common2%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ) -call :ts_msiofficedata %2 +call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] @@ -9177,147 +9166,6 @@ Office-ActID -pkeypath "$env:pkeypath" -edition "$env:_License" -keytype "$env:k ::======================================================================================================================================== -:: 1st column = Office version number -:: 2nd column = Activation ID -:: 3rd column = Edition -:: Separator = "_" - -:ts_msiofficedata - -for %%# in ( -:: Office 2013 -15_ab4d047b-97cf-4126-a69f-34df08e2f254_AccessRetail -15_259de5be-492b-44b3-9d78-9645f848f7b0_AccessRuntimeRetail -15_4374022d-56b8-48c1-9bb7-d8f2fc726343_AccessVolume -15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_ExcelRetail -15_ac1ae7fd-b949-4e04-a330-849bc40638cf_ExcelVolume -15_cfaf5356-49e3-48a8-ab3c-e729ab791250_GrooveRetail -15_4825ac28-ce41-45a7-9e6e-1fed74057601_GrooveVolume -15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail -15_a2b90e7a-a797-4713-af90-f0becf52a1dd_HomeBusinessRetail -15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_HomeStudentARMRetail -15_ebef9f05-5273-404a-9253-c5e252f50555_HomeStudentPlusARMRetail -15_f2de350d-3028-410a-bfae-283e00b44d0e_HomeStudentRetail -15_44984381-406e-4a35-b1c3-e54f499556e2_InfoPathRetail -15_9e016989-4007-42a6-8051-64eb97110cf2_InfoPathVolume -15_9103f3ce-1084-447a-827e-d6097f68c895_LyncAcademicRetail -15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_LyncEntryRetail -15_fada6658-bfc6-4c4e-825a-59a89822cda8_LyncRetail -15_e1264e10-afaf-4439-a98b-256df8bb156f_LyncVolume -15_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail -15_f33485a0-310b-4b72-9a0e-b1d605510dbd_MondoVolume -15_3391e125-f6e4-4b1e-899c-a25e6092d40d_OneNoteFreeRetail -15_8b524bcc-67ea-4876-a509-45e46f6347e8_OneNoteRetail -15_b067e965-7521-455b-b9f7-c740204578a2_OneNoteVolume -15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_OutlookRetail -15_8d577c50-ae5e-47fd-a240-24986f73d503_OutlookVolume -15_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail -15_17e9df2d-ed91-4382-904b-4fed6a12caf0_PersonalRetail -15_31743b82-bfbc-44b6-aa12-85d42e644d5b_PowerPointRetail -15_e40dcb44-1d5c-4085-8e8f-943f33c4f004_PowerPointVolume -15_064383fa-1538-491c-859b-0ecab169a0ab_ProPlusRetail -15_2b88c4f2-ea8f-43cd-805e-4d41346e18a7_ProPlusVolume -15_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail -15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_ProfessionalRetail -15_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail -15_ed34dc89-1c27-4ecd-8b2f-63d0f4cedc32_ProjectProVolume -15_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail -15_2b9e4a37-6230-4b42-bee2-e25ce86c8c7a_ProjectStdVolume -15_c3a0814a-70a4-471f-af37-2313a6331111_PublisherRetail -15_38ea49f6-ad1d-43f1-9888-99a35d7c9409_PublisherVolume -15_ba3e3833-6a7e-445a-89d0-7802a9a68588_SPDRetail -15_32255c0a-16b4-4ce2-b388-8a4267e219eb_StandardRetail -15_a24cca51-3d54-4c41-8a76-4031f5338cb2_StandardVolume -15_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail -15_3e4294dd-a765-49bc-8dbd-cf8b62a4bd3d_VisioProVolume -15_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail -15_44a1f6ff-0876-4edb-9169-dbb43101ee89_VisioStdVolume -15_191509f2-6977-456f-ab30-cf0492b1e93a_WordRetail -15_9cedef15-be37-4ff0-a08a-13a045540641_WordVolume -:: Office 365 - 15.0 version -15_742178ed-6b28-42dd-b3d7-b7c0ea78741b_O365BusinessRetail -15_a96f8dae-da54-4fad-bdc6-108da592707a_O365HomePremRetail -15_e3dacc06-3bc2-4e13-8e59-8e05f3232325_O365ProPlusRetail -15_0bc1dae4-6158-4a1c-a893-807665b934b2_O365SmallBusPremRetail -:: Office 365 - 16.0 version -16_742178ed-6b28-42dd-b3d7-b7c0ea78741b_O365BusinessRetail -16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_O365EduCloudRetail -16_a96f8dae-da54-4fad-bdc6-108da592707a_O365HomePremRetail -16_e3dacc06-3bc2-4e13-8e59-8e05f3232325_O365ProPlusRetail -16_0bc1dae4-6158-4a1c-a893-807665b934b2_O365SmallBusPremRetail -:: Office 2016 -16_bfa358b0-98f1-4125-842e-585fa13032e6_AccessRetail -16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_AccessRuntimeRetail -16_3b2fa33f-cd5a-43a5-bd95-f49f3f546b0b_AccessVolume -16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_ExcelRetail -16_685062a7-6024-42e7-8c5f-6bb9e63e697f_ExcelVolume -16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail -16_86834d00-7896-4a38-8fae-32f20b86fa2b_HomeBusinessRetail -16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_HomeStudentARMRetail -16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_HomeStudentPlusARMRetail -16_c28acdb8-d8b3-4199-baa4-024d09e97c99_HomeStudentRetail -16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_HomeStudentVNextRetail -16_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail -16_2cd0ea7e-749f-4288-a05e-567c573b2a6c_MondoVolume -16_436366de-5579-4f24-96db-3893e4400030_OneNoteFreeRetail -16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_OneNoteRetail -16_23b672da-a456-4860-a8f3-e062a501d7e8_OneNoteVolume -16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_OutlookRetail -16_50059979-ac6f-4458-9e79-710bcb41721a_OutlookVolume -16_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail -16_a9f645a1-0d6a-4978-926a-abcb363b72a6_PersonalRetail -16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_PowerPointRetail -16_9b4060c9-a7f5-4a66-b732-faf248b7240f_PowerPointVolume -16_de52bd50-9564-4adc-8fcb-a345c17f84f9_ProPlusRetail -16_c47456e3-265d-47b6-8ca0-c30abbd0ca36_ProPlusVolume -16_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail -16_d64edc00-7453-4301-8428-197343fafb16_ProfessionalRetail -16_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail -16_82f502b5-b0b0-4349-bd2c-c560df85b248_ProjectProVolume -16_16728639-a9ab-4994-b6d8-f81051e69833_ProjectProXVolume -16_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail -16_82e6b314-2a62-4e51-9220-61358dd230e6_ProjectStdVolume -16_431058f0-c059-44c5-b9e7-ed2dd46b6789_ProjectStdXVolume -16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_PublisherRetail -16_fcc1757b-5d5f-486a-87cf-c4d6dedb6032_PublisherVolume -16_9103f3ce-1084-447a-827e-d6097f68c895_SkypeServiceBypassRetail -16_971cd368-f2e1-49c1-aedd-330909ce18b6_SkypeforBusinessEntryRetail -16_418d2b9f-b491-4d7f-84f1-49e27cc66597_SkypeforBusinessRetail -16_03ca3b9a-0869-4749-8988-3cbc9d9f51bb_SkypeforBusinessVolume -16_4a31c291-3a12-4c64-b8ab-cd79212be45e_StandardRetail -16_0ed94aac-2234-4309-ba29-74bdbb887083_StandardVolume -16_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail -16_295b2c03-4b1c-4221-b292-1411f468bd02_VisioProVolume -16_0594dc12-8444-4912-936a-747ca742dbdb_VisioProXVolume -16_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail -16_44151c2d-c398-471f-946f-7660542e3369_VisioStdVolume -16_1d1c6879-39a3-47a5-9a6d-aceefa6a289d_VisioStdXVolume -16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_WordRetail -16_c3000759-551f-4f4a-bcac-a4b42cbf1de2_WordVolume -) do ( -for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( - -if "%oVer%"=="%%A" ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%B" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -if "%oVer%"=="14" ( -REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml -echo %%C | find /i "Visio" %nul% && set prodId=0057 -) -reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%1\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%C) else (set _oIds=%%C) -) -) -) - -) -) -exit /b - -::======================================================================================================================================== - :ts_getedition set tsedition= @@ -11247,7 +11095,7 @@ for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if ex if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" call :ksdata getmsiprod %2 -call :ks_msiretaildata getmsiret %2 +call :msiofficedata %2 getmsiret echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] @@ -12097,132 +11945,195 @@ exit /b :: 1st column = Office version number :: 2nd column = Activation ID -:: 3rd column = Edition -:: 4th column = Other Edition IDs if they are part of the same primary product (For reference only) +:: 3rd column = Product ID from branding.xml +:: 4th column = Edition +:: 5th column = Other Edition IDs if they are part of the same primary product (For reference only) :: Separator = "_" -:ks_msiretaildata +:: EditionID Notes: +:: For Office 2013 and later, all Edition IDs are clearly defined, and each ID corresponds to its specific licensing. + +:: In Office 2010, the situation is a bit more complicated. +:: Products typically fall into two separate categories: Volume License (VL) and Non-VL. This is because a single installation cannot include both Retail and VL licensing types. +:: Some Edition IDs share the same primary product ID. For example, installing ProPlusVL also installs ProPlusAcadVL licenses, as both use 0011 as the primary product ID. +:: Therefore, in the script, we grouped VL and Non-VL versions by primary product ID and selected the highest Edition ID when multiple Edition IDs existed for the same primary product ID. + +:: There are a few exceptions to this 2010 rule: Visio (Premium, Pro, Standard) and OEM-SingleImage. + +:: For Visio, the issue is that branding.xml lists incorrect primary product IDs. The correct primary product ID for all three Visio variants is 0057. Based on the criteria above, we chose Visio-Premium as the representative Edition ID among the three. +:: For OEM-SingleImage, it installs multiple Edition IDs and uses 003D as the primary product ID. Following our method, we selected the highest available Edition ID—ProfessionalR in this case. + +:msiofficedata for %%# in ( -:: Office 2010 -14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_AccessR -14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_AccessRuntimeR -14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_ExcelR -14_7004b7f0-6407-4f45-8eac-966e5f868bde_GrooveR -14_7b7d1f17-fdcb-4820-9789-9bec6e377821_HomeBusinessR_[HomeBusinessDemoR] -14_19316117-30a8-4773-8fd9-7f7231f4e060_HomeBusinessSubR -14_09e2d37e-474b-4121-8626-58ad9be5776f_HomeStudentR_[HomeStudentDemoR] -14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_HSExcelR -14_25fe4611-b44d-49cc-ae87-2143d299194e_HSOneNoteR -14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_HSPowerPointR -14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_HSWordR -14_ef1da464-01c8-43a6-91af-e4e5713744f9_InfoPathR -14_14f5946a-debc-4716-babc-7e2c240fec08_MondoR -14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_OEM -14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_OneNoteR -14_fbf4ac36-31c8-4340-8666-79873129cf40_OutlookR -14_acb51361-c0db-4895-9497-1831c41f31a6_PersonalR_[PersonalDemoR,PersonalPrepaidR] -14_133c8359-4e93-4241-8118-30bb18737ea0_PowerPointR -14_8b559c37-0117-413e-921b-b853aeb6e210_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR] -14_725714d7-d58f-4d12-9fa8-35873c6f7215_ProjectProR_[ProjectProMSDNR] -14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_ProjectProSubR -14_688f6589-2bd9-424e-a152-b13f36aa6de1_ProjectStdR -14_71af7e84-93e6-4363-9b69-699e04e74071_ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] -14_e98ef0c0-71c4-42ce-8305-287d8721e26c_ProPlusSubR -14_98677603-a668-4fa4-9980-3f1f05f78f69_PublisherR -14_dbe3aee0-5183-4ff7-8142-66050173cb01_SmallBusBasicsR_[SmallBusBasicsMSDNR] -14_b78df69e-0966-40b1-ae85-30a5134dedd0_SPDR -14_d3422cfb-8d8b-4ead-99f9-eab0ccd990d7_StandardR -14_2745e581-565a-4670-ae90-6bf7c57ffe43_StarterR -14_66cad568-c2dc-459d-93ec-2f3cb967ee34_VisioSIR_Prem[Pro,Std] -14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_WordR +14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR +14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR +14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL +14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR +14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL +14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR +14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL +14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR] +14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR +14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR] +14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_0029_HSExcelR +14_25fe4611-b44d-49cc-ae87-2143d299194e_00A3_HSOneNoteR +14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_0037_HSPowerPointR +14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_002B_HSWordR +14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR +14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL +14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR +14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL +14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception +14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR +14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL +14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR +14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL +14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR] +14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR +14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL +14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR] +14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR] +14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_011F_ProjectProSubR +14_1cf57a59-c532-4e56-9a7d-ffa2fe94b474_003B_ProjectProVL +14_688f6589-2bd9-424e-a152-b13f36aa6de1_003A_ProjectStdR +14_11b39439-6b93-4642-9570-f2eb81be2238_003A_ProjectStdVL +14_71af7e84-93e6-4363-9b69-699e04e74071_0011_ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] +14_e98ef0c0-71c4-42ce-8305-287d8721e26c_011D_ProPlusSubR +14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_0011_ProPlusVL_[ProPlusAcadVL] +14_98677603-a668-4fa4-9980-3f1f05f78f69_0019_PublisherR +14_3d014759-b128-4466-9018-e80f6320d9d0_0019_PublisherVL +14_dbe3aee0-5183-4ff7-8142-66050173cb01_008B_SmallBusBasicsR_[SmallBusBasicsMSDNR] +14_8090771e-d41a-4482-929e-de87f1f47e46_008B_SmallBusBasicsVL +14_b78df69e-0966-40b1-ae85-30a5134dedd0_0017_SPDR +14_d3422cfb-8d8b-4ead-99f9-eab0ccd990d7_0012_StandardR +14_1f76e346-e0be-49bc-9954-70ec53a4fcfe_0012_StandardVL_[StandardAcadVL] +14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR +14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception +14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception +14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR +14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL :: Office 2013 -15_ab4d047b-97cf-4126-a69f-34df08e2f254_AccessRetail -15_259de5be-492b-44b3-9d78-9645f848f7b0_AccessRuntimeRetail -15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_ExcelRetail -15_cfaf5356-49e3-48a8-ab3c-e729ab791250_GrooveRetail -15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail -15_a2b90e7a-a797-4713-af90-f0becf52a1dd_HomeBusinessRetail -15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_HomeStudentARMRetail -15_ebef9f05-5273-404a-9253-c5e252f50555_HomeStudentPlusARMRetail -15_f2de350d-3028-410a-bfae-283e00b44d0e_HomeStudentRetail -15_44984381-406e-4a35-b1c3-e54f499556e2_InfoPathRetail -15_9103f3ce-1084-447a-827e-d6097f68c895_LyncAcademicRetail -15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_LyncEntryRetail -15_fada6658-bfc6-4c4e-825a-59a89822cda8_LyncRetail -15_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail -15_3391e125-f6e4-4b1e-899c-a25e6092d40d_OneNoteFreeRetail -15_8b524bcc-67ea-4876-a509-45e46f6347e8_OneNoteRetail -15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_OutlookRetail -15_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail -15_17e9df2d-ed91-4382-904b-4fed6a12caf0_PersonalRetail -15_31743b82-bfbc-44b6-aa12-85d42e644d5b_PowerPointRetail -15_064383fa-1538-491c-859b-0ecab169a0ab_ProPlusRetail -15_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail -15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_ProfessionalRetail -15_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail -15_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail -15_c3a0814a-70a4-471f-af37-2313a6331111_PublisherRetail -15_ba3e3833-6a7e-445a-89d0-7802a9a68588_SPDRetail -15_32255c0a-16b4-4ce2-b388-8a4267e219eb_StandardRetail -15_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail -15_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail -15_191509f2-6977-456f-ab30-cf0492b1e93a_WordRetail +15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail +15_259de5be-492b-44b3-9d78-9645f848f7b0_001C_AccessRuntimeRetail +15_4374022d-56b8-48c1-9bb7-d8f2fc726343_0015_AccessVolume +15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_0016_ExcelRetail +15_ac1ae7fd-b949-4e04-a330-849bc40638cf_0016_ExcelVolume +15_cfaf5356-49e3-48a8-ab3c-e729ab791250_00BA_GrooveRetail +15_4825ac28-ce41-45a7-9e6e-1fed74057601_00BA_GrooveVolume +15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail +15_cd256150-a898-441f-aac0-9f8f33390e45_0013_HomeBusinessRetail +15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_00CE_HomeStudentARMRetail +15_ebef9f05-5273-404a-9253-c5e252f50555_00DA_HomeStudentPlusARMRetail +15_98685d21-78bd-4c62-bc4f-653344a63035_002F_HomeStudentRetail +15_44984381-406e-4a35-b1c3-e54f499556e2_0044_InfoPathRetail +15_9e016989-4007-42a6-8051-64eb97110cf2_0044_InfoPathVolume +15_9103f3ce-1084-447a-827e-d6097f68c895_00EA_LyncAcademicRetail +15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_012D_LyncEntryRetail +15_fada6658-bfc6-4c4e-825a-59a89822cda8_012C_LyncRetail +15_e1264e10-afaf-4439-a98b-256df8bb156f_012C_LyncVolume +15_3169c8df-f659-4f95-9cc6-3115e6596e83_000F_MondoRetail +15_f33485a0-310b-4b72-9a0e-b1d605510dbd_000F_MondoVolume +15_3391e125-f6e4-4b1e-899c-a25e6092d40d_00A1_OneNoteFreeRetail +15_8b524bcc-67ea-4876-a509-45e46f6347e8_00A1_OneNoteRetail +15_b067e965-7521-455b-b9f7-c740204578a2_00A1_OneNoteVolume +15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_001A_OutlookRetail +15_8d577c50-ae5e-47fd-a240-24986f73d503_001A_OutlookVolume +15_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail +15_17e9df2d-ed91-4382-904b-4fed6a12caf0_0033_PersonalRetail +15_31743b82-bfbc-44b6-aa12-85d42e644d5b_0018_PowerPointRetail +15_e40dcb44-1d5c-4085-8e8f-943f33c4f004_0018_PowerPointVolume +15_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail +15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_0014_ProfessionalRetail +15_f2435de4-5fc0-4e5b-ac97-34f515ec5ee7_003B_ProjectProRetail +15_ed34dc89-1c27-4ecd-8b2f-63d0f4cedc32_003B_ProjectProVolume +15_5517e6a2-739b-4822-946f-7f0f1c5934b1_003A_ProjectStdRetail +15_2b9e4a37-6230-4b42-bee2-e25ce86c8c7a_003A_ProjectStdVolume +15_064383fa-1538-491c-859b-0ecab169a0ab_0011_ProPlusRetail +15_2b88c4f2-ea8f-43cd-805e-4d41346e18a7_0011_ProPlusVolume +15_c3a0814a-70a4-471f-af37-2313a6331111_0019_PublisherRetail +15_38ea49f6-ad1d-43f1-9888-99a35d7c9409_0019_PublisherVolume +15_ba3e3833-6a7e-445a-89d0-7802a9a68588_0017_SPDRetail +15_32255c0a-16b4-4ce2-b388-8a4267e219eb_0012_StandardRetail +15_a24cca51-3d54-4c41-8a76-4031f5338cb2_0012_StandardVolume +15_15d12ad4-622d-4257-976c-5eb3282fb93d_0051_VisioProRetail +15_3e4294dd-a765-49bc-8dbd-cf8b62a4bd3d_0051_VisioProVolume +15_dae597ce-5823-4c77-9580-7268b93a4b23_0053_VisioStdRetail +15_44a1f6ff-0876-4edb-9169-dbb43101ee89_0053_VisioStdVolume +15_191509f2-6977-456f-ab30-cf0492b1e93a_001B_WordRetail +15_9cedef15-be37-4ff0-a08a-13a045540641_001B_WordVolume :: Office 365 - 15.0 version -15_6337137e-7c07-4197-8986-bece6a76fc33_O365BusinessRetail -15_537ea5b5-7d50-4876-bd38-a53a77caca32_O365HomePremRetail -15_149dbce7-a48e-44db-8364-a53386cd4580_O365ProPlusRetail -15_bacd4614-5bef-4a5e-bafc-de4c788037a2_O365SmallBusPremRetail +15_befee371-a2f5-4648-85db-a2c55fdf324c_00E9_O365BusinessRetail +15_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail +15_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail +15_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail :: Office 365 - 16.0 version -16_6337137e-7c07-4197-8986-bece6a76fc33_O365BusinessRetail -16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_O365EduCloudRetail -16_537ea5b5-7d50-4876-bd38-a53a77caca32_O365HomePremRetail -16_149dbce7-a48e-44db-8364-a53386cd4580_O365ProPlusRetail -16_bacd4614-5bef-4a5e-bafc-de4c788037a2_O365SmallBusPremRetail +16_6337137e-7c07-4197-8986-bece6a76fc33_00E9_O365BusinessRetail +16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_00D6_O365EduCloudRetail +16_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail +16_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail +16_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail :: Office 2016 -16_bfa358b0-98f1-4125-842e-585fa13032e6_AccessRetail -16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_AccessRuntimeRetail -16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_ExcelRetail -16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail -16_86834d00-7896-4a38-8fae-32f20b86fa2b_HomeBusinessRetail -16_c28acdb8-d8b3-4199-baa4-024d09e97c99_HomeStudentRetail -16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_HomeStudentARMRetail -16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_HomeStudentPlusARMRetail -16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_HomeStudentVNextRetail -16_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail -16_436366de-5579-4f24-96db-3893e4400030_OneNoteFreeRetail -16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_OneNoteRetail -16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_OutlookRetail -16_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail -16_a9f645a1-0d6a-4978-926a-abcb363b72a6_PersonalRetail -16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_PowerPointRetail -16_de52bd50-9564-4adc-8fcb-a345c17f84f9_ProPlusRetail -16_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail -16_d64edc00-7453-4301-8428-197343fafb16_ProfessionalRetail -16_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail -16_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail -16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_PublisherRetail -16_9103f3ce-1084-447a-827e-d6097f68c895_SkypeServiceBypassRetail -16_971cd368-f2e1-49c1-aedd-330909ce18b6_SkypeforBusinessEntryRetail -16_418d2b9f-b491-4d7f-84f1-49e27cc66597_SkypeforBusinessRetail -16_4a31c291-3a12-4c64-b8ab-cd79212be45e_StandardRetail -16_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail -16_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail -16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_WordRetail +16_bfa358b0-98f1-4125-842e-585fa13032e6_0015_AccessRetail +16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_001C_AccessRuntimeRetail +16_3b2fa33f-cd5a-43a5-bd95-f49f3f546b0b_0015_AccessVolume +16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_0016_ExcelRetail +16_685062a7-6024-42e7-8c5f-6bb9e63e697f_0016_ExcelVolume +16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail +16_86834d00-7896-4a38-8fae-32f20b86fa2b_0013_HomeBusinessRetail +16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_00CE_HomeStudentARMRetail +16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_00DA_HomeStudentPlusARMRetail +16_c28acdb8-d8b3-4199-baa4-024d09e97c99_002F_HomeStudentRetail +16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_002F_HomeStudentVNextRetail +16_b21367df-9545-4f02-9f24-240691da0e58_000F_MondoRetail +16_2cd0ea7e-749f-4288-a05e-567c573b2a6c_000F_MondoVolume +16_436366de-5579-4f24-96db-3893e4400030_00A3_OneNoteFreeRetail +16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_00A1_OneNoteRetail +16_23b672da-a456-4860-a8f3-e062a501d7e8_00A1_OneNoteVolume +16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_001A_OutlookRetail +16_50059979-ac6f-4458-9e79-710bcb41721a_001A_OutlookVolume +16_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail +16_a9f645a1-0d6a-4978-926a-abcb363b72a6_0033_PersonalRetail +16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_0018_PowerPointRetail +16_9b4060c9-a7f5-4a66-b732-faf248b7240f_0018_PowerPointVolume +16_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail +16_d64edc00-7453-4301-8428-197343fafb16_0014_ProfessionalRetail +16_0f42f316-00b1-48c5-ada4-2f52b5720ad0_003B_ProjectProRetail +16_82f502b5-b0b0-4349-bd2c-c560df85b248_003B_ProjectProVolume +16_16728639-a9ab-4994-b6d8-f81051e69833_003B_ProjectProXVolume +16_e9f0b3fc-962f-4944-ad06-05c10b6bcd5e_003A_ProjectStdRetail +16_82e6b314-2a62-4e51-9220-61358dd230e6_003A_ProjectStdVolume +16_431058f0-c059-44c5-b9e7-ed2dd46b6789_003A_ProjectStdXVolume +16_de52bd50-9564-4adc-8fcb-a345c17f84f9_0011_ProPlusRetail +16_c47456e3-265d-47b6-8ca0-c30abbd0ca36_0011_ProPlusVolume +16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_0019_PublisherRetail +16_fcc1757b-5d5f-486a-87cf-c4d6dedb6032_0019_PublisherVolume +16_971cd368-f2e1-49c1-aedd-330909ce18b6_012D_SkypeforBusinessEntryRetail +16_418d2b9f-b491-4d7f-84f1-49e27cc66597_012C_SkypeforBusinessRetail +16_03ca3b9a-0869-4749-8988-3cbc9d9f51bb_012C_SkypeforBusinessVolume +16_9103f3ce-1084-447a-827e-d6097f68c895_012C_SkypeServiceBypassRetail +16_4a31c291-3a12-4c64-b8ab-cd79212be45e_0012_StandardRetail +16_0ed94aac-2234-4309-ba29-74bdbb887083_0012_StandardVolume +16_2dfe2075-2d04-4e43-816a-eb60bbb77574_0051_VisioProRetail +16_295b2c03-4b1c-4221-b292-1411f468bd02_0051_VisioProVolume +16_0594dc12-8444-4912-936a-747ca742dbdb_0051_VisioProXVolume +16_c76dbcbc-d71b-4f45-b5b3-b7494cb4e23e_0053_VisioStdRetail +16_44151c2d-c398-471f-946f-7660542e3369_0053_VisioStdVolume +16_1d1c6879-39a3-47a5-9a6d-aceefa6a289d_0053_VisioStdXVolume +16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_001B_WordRetail +16_c3000759-551f-4f4a-bcac-a4b42cbf1de2_001B_WordVolume ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -if %1==getmsiret if "%oVer%"=="%%A" ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%B" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -if "%oVer%"=="14" ( -REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml -echo %%C | find /i "Visio" %nul% && set prodId=0057 +set getIds=1 +if "%oVer%"=="%%A" ( +if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) + +if defined getIds ( +reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( +reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( +if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) -reg query "%2\Registration\{%%B}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%C) else (set _oIds=%%C) ) ) ) diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 2f41448..8a3ccb0 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -1071,7 +1071,7 @@ set "_common2=%CommonProgramFiles(x86)%" for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -call :ohookdata getmsiprod %2 +call :msiofficedata %2 echo: echo Activating Office... [MSI ^| %_version% ^| %_oArch%] @@ -2338,13 +2338,143 @@ if %oVer%==16 (echo "%%D" | find /i "Subscription" %nul% && set _sublic=1) ) ) -if %1==getmsiprod if %oVer%==%%A ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%B" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -reg query "%2\Registration\{%%B}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%E) else (set _oIds=%%E) +) +) +exit /b + +::======================================================================================================================================== + +:: 1st column = Office version number +:: 2nd column = Activation ID +:: 3rd column = Product ID from branding.xml +:: 4th column = Edition +:: 5th column = Other Edition IDs if they are part of the same primary product (For reference only) +:: Separator = "_" + +:msiofficedata + +for %%# in ( +:: Office 2013 +15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail +15_259de5be-492b-44b3-9d78-9645f848f7b0_001C_AccessRuntimeRetail +15_4374022d-56b8-48c1-9bb7-d8f2fc726343_0015_AccessVolume +15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_0016_ExcelRetail +15_ac1ae7fd-b949-4e04-a330-849bc40638cf_0016_ExcelVolume +15_cfaf5356-49e3-48a8-ab3c-e729ab791250_00BA_GrooveRetail +15_4825ac28-ce41-45a7-9e6e-1fed74057601_00BA_GrooveVolume +15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail +15_cd256150-a898-441f-aac0-9f8f33390e45_0013_HomeBusinessRetail +15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_00CE_HomeStudentARMRetail +15_ebef9f05-5273-404a-9253-c5e252f50555_00DA_HomeStudentPlusARMRetail +15_98685d21-78bd-4c62-bc4f-653344a63035_002F_HomeStudentRetail +15_44984381-406e-4a35-b1c3-e54f499556e2_0044_InfoPathRetail +15_9e016989-4007-42a6-8051-64eb97110cf2_0044_InfoPathVolume +15_9103f3ce-1084-447a-827e-d6097f68c895_00EA_LyncAcademicRetail +15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_012D_LyncEntryRetail +15_fada6658-bfc6-4c4e-825a-59a89822cda8_012C_LyncRetail +15_e1264e10-afaf-4439-a98b-256df8bb156f_012C_LyncVolume +15_3169c8df-f659-4f95-9cc6-3115e6596e83_000F_MondoRetail +15_f33485a0-310b-4b72-9a0e-b1d605510dbd_000F_MondoVolume +15_3391e125-f6e4-4b1e-899c-a25e6092d40d_00A1_OneNoteFreeRetail +15_8b524bcc-67ea-4876-a509-45e46f6347e8_00A1_OneNoteRetail +15_b067e965-7521-455b-b9f7-c740204578a2_00A1_OneNoteVolume +15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_001A_OutlookRetail +15_8d577c50-ae5e-47fd-a240-24986f73d503_001A_OutlookVolume +15_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail +15_17e9df2d-ed91-4382-904b-4fed6a12caf0_0033_PersonalRetail +15_31743b82-bfbc-44b6-aa12-85d42e644d5b_0018_PowerPointRetail +15_e40dcb44-1d5c-4085-8e8f-943f33c4f004_0018_PowerPointVolume +15_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail +15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_0014_ProfessionalRetail +15_f2435de4-5fc0-4e5b-ac97-34f515ec5ee7_003B_ProjectProRetail +15_ed34dc89-1c27-4ecd-8b2f-63d0f4cedc32_003B_ProjectProVolume +15_5517e6a2-739b-4822-946f-7f0f1c5934b1_003A_ProjectStdRetail +15_2b9e4a37-6230-4b42-bee2-e25ce86c8c7a_003A_ProjectStdVolume +15_064383fa-1538-491c-859b-0ecab169a0ab_0011_ProPlusRetail +15_2b88c4f2-ea8f-43cd-805e-4d41346e18a7_0011_ProPlusVolume +15_c3a0814a-70a4-471f-af37-2313a6331111_0019_PublisherRetail +15_38ea49f6-ad1d-43f1-9888-99a35d7c9409_0019_PublisherVolume +15_ba3e3833-6a7e-445a-89d0-7802a9a68588_0017_SPDRetail +15_32255c0a-16b4-4ce2-b388-8a4267e219eb_0012_StandardRetail +15_a24cca51-3d54-4c41-8a76-4031f5338cb2_0012_StandardVolume +15_15d12ad4-622d-4257-976c-5eb3282fb93d_0051_VisioProRetail +15_3e4294dd-a765-49bc-8dbd-cf8b62a4bd3d_0051_VisioProVolume +15_dae597ce-5823-4c77-9580-7268b93a4b23_0053_VisioStdRetail +15_44a1f6ff-0876-4edb-9169-dbb43101ee89_0053_VisioStdVolume +15_191509f2-6977-456f-ab30-cf0492b1e93a_001B_WordRetail +15_9cedef15-be37-4ff0-a08a-13a045540641_001B_WordVolume +:: Office 365 - 15.0 version +15_befee371-a2f5-4648-85db-a2c55fdf324c_00E9_O365BusinessRetail +15_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail +15_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail +15_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail +:: Office 365 - 16.0 version +16_6337137e-7c07-4197-8986-bece6a76fc33_00E9_O365BusinessRetail +16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_00D6_O365EduCloudRetail +16_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail +16_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail +16_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail +:: Office 2016 +16_bfa358b0-98f1-4125-842e-585fa13032e6_0015_AccessRetail +16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_001C_AccessRuntimeRetail +16_3b2fa33f-cd5a-43a5-bd95-f49f3f546b0b_0015_AccessVolume +16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_0016_ExcelRetail +16_685062a7-6024-42e7-8c5f-6bb9e63e697f_0016_ExcelVolume +16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail +16_86834d00-7896-4a38-8fae-32f20b86fa2b_0013_HomeBusinessRetail +16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_00CE_HomeStudentARMRetail +16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_00DA_HomeStudentPlusARMRetail +16_c28acdb8-d8b3-4199-baa4-024d09e97c99_002F_HomeStudentRetail +16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_002F_HomeStudentVNextRetail +16_b21367df-9545-4f02-9f24-240691da0e58_000F_MondoRetail +16_2cd0ea7e-749f-4288-a05e-567c573b2a6c_000F_MondoVolume +16_436366de-5579-4f24-96db-3893e4400030_00A3_OneNoteFreeRetail +16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_00A1_OneNoteRetail +16_23b672da-a456-4860-a8f3-e062a501d7e8_00A1_OneNoteVolume +16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_001A_OutlookRetail +16_50059979-ac6f-4458-9e79-710bcb41721a_001A_OutlookVolume +16_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail +16_a9f645a1-0d6a-4978-926a-abcb363b72a6_0033_PersonalRetail +16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_0018_PowerPointRetail +16_9b4060c9-a7f5-4a66-b732-faf248b7240f_0018_PowerPointVolume +16_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail +16_d64edc00-7453-4301-8428-197343fafb16_0014_ProfessionalRetail +16_0f42f316-00b1-48c5-ada4-2f52b5720ad0_003B_ProjectProRetail +16_82f502b5-b0b0-4349-bd2c-c560df85b248_003B_ProjectProVolume +16_16728639-a9ab-4994-b6d8-f81051e69833_003B_ProjectProXVolume +16_e9f0b3fc-962f-4944-ad06-05c10b6bcd5e_003A_ProjectStdRetail +16_82e6b314-2a62-4e51-9220-61358dd230e6_003A_ProjectStdVolume +16_431058f0-c059-44c5-b9e7-ed2dd46b6789_003A_ProjectStdXVolume +16_de52bd50-9564-4adc-8fcb-a345c17f84f9_0011_ProPlusRetail +16_c47456e3-265d-47b6-8ca0-c30abbd0ca36_0011_ProPlusVolume +16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_0019_PublisherRetail +16_fcc1757b-5d5f-486a-87cf-c4d6dedb6032_0019_PublisherVolume +16_971cd368-f2e1-49c1-aedd-330909ce18b6_012D_SkypeforBusinessEntryRetail +16_418d2b9f-b491-4d7f-84f1-49e27cc66597_012C_SkypeforBusinessRetail +16_03ca3b9a-0869-4749-8988-3cbc9d9f51bb_012C_SkypeforBusinessVolume +16_9103f3ce-1084-447a-827e-d6097f68c895_012C_SkypeServiceBypassRetail +16_4a31c291-3a12-4c64-b8ab-cd79212be45e_0012_StandardRetail +16_0ed94aac-2234-4309-ba29-74bdbb887083_0012_StandardVolume +16_2dfe2075-2d04-4e43-816a-eb60bbb77574_0051_VisioProRetail +16_295b2c03-4b1c-4221-b292-1411f468bd02_0051_VisioProVolume +16_0594dc12-8444-4912-936a-747ca742dbdb_0051_VisioProXVolume +16_c76dbcbc-d71b-4f45-b5b3-b7494cb4e23e_0053_VisioStdRetail +16_44151c2d-c398-471f-946f-7660542e3369_0053_VisioStdVolume +16_1d1c6879-39a3-47a5-9a6d-aceefa6a289d_0053_VisioStdXVolume +16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_001B_WordRetail +16_c3000759-551f-4f4a-bcac-a4b42cbf1de2_001B_WordVolume +) do ( +for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( + +set getIds=1 +if "%oVer%"=="%%A" ( +if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) + +if defined getIds ( +reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( +reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( +if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) +) ) ) ) diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 61d6f1c..8dd961b 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -1230,7 +1230,7 @@ for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if ex if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" call :ksdata getmsiprod %2 -call :ks_msiretaildata getmsiret %2 +call :msiofficedata %2 getmsiret echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] @@ -3261,132 +3261,195 @@ exit /b :: 1st column = Office version number :: 2nd column = Activation ID -:: 3rd column = Edition -:: 4th column = Other Edition IDs if they are part of the same primary product (For reference only) +:: 3rd column = Product ID from branding.xml +:: 4th column = Edition +:: 5th column = Other Edition IDs if they are part of the same primary product (For reference only) :: Separator = "_" -:ks_msiretaildata +:: EditionID Notes: +:: For Office 2013 and later, all Edition IDs are clearly defined, and each ID corresponds to its specific licensing. + +:: In Office 2010, the situation is a bit more complicated. +:: Products typically fall into two separate categories: Volume License (VL) and Non-VL. This is because a single installation cannot include both Retail and VL licensing types. +:: Some Edition IDs share the same primary product ID. For example, installing ProPlusVL also installs ProPlusAcadVL licenses, as both use 0011 as the primary product ID. +:: Therefore, in the script, we grouped VL and Non-VL versions by primary product ID and selected the highest Edition ID when multiple Edition IDs existed for the same primary product ID. + +:: There are a few exceptions to this 2010 rule: Visio (Premium, Pro, Standard) and OEM-SingleImage. + +:: For Visio, the issue is that branding.xml lists incorrect primary product IDs. The correct primary product ID for all three Visio variants is 0057. Based on the criteria above, we chose Visio-Premium as the representative Edition ID among the three. +:: For OEM-SingleImage, it installs multiple Edition IDs and uses 003D as the primary product ID. Following our method, we selected the highest available Edition ID—ProfessionalR in this case. + +:msiofficedata for %%# in ( -:: Office 2010 -14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_AccessR -14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_AccessRuntimeR -14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_ExcelR -14_7004b7f0-6407-4f45-8eac-966e5f868bde_GrooveR -14_7b7d1f17-fdcb-4820-9789-9bec6e377821_HomeBusinessR_[HomeBusinessDemoR] -14_19316117-30a8-4773-8fd9-7f7231f4e060_HomeBusinessSubR -14_09e2d37e-474b-4121-8626-58ad9be5776f_HomeStudentR_[HomeStudentDemoR] -14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_HSExcelR -14_25fe4611-b44d-49cc-ae87-2143d299194e_HSOneNoteR -14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_HSPowerPointR -14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_HSWordR -14_ef1da464-01c8-43a6-91af-e4e5713744f9_InfoPathR -14_14f5946a-debc-4716-babc-7e2c240fec08_MondoR -14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_OEM -14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_OneNoteR -14_fbf4ac36-31c8-4340-8666-79873129cf40_OutlookR -14_acb51361-c0db-4895-9497-1831c41f31a6_PersonalR_[PersonalDemoR,PersonalPrepaidR] -14_133c8359-4e93-4241-8118-30bb18737ea0_PowerPointR -14_8b559c37-0117-413e-921b-b853aeb6e210_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR] -14_725714d7-d58f-4d12-9fa8-35873c6f7215_ProjectProR_[ProjectProMSDNR] -14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_ProjectProSubR -14_688f6589-2bd9-424e-a152-b13f36aa6de1_ProjectStdR -14_71af7e84-93e6-4363-9b69-699e04e74071_ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] -14_e98ef0c0-71c4-42ce-8305-287d8721e26c_ProPlusSubR -14_98677603-a668-4fa4-9980-3f1f05f78f69_PublisherR -14_dbe3aee0-5183-4ff7-8142-66050173cb01_SmallBusBasicsR_[SmallBusBasicsMSDNR] -14_b78df69e-0966-40b1-ae85-30a5134dedd0_SPDR -14_d3422cfb-8d8b-4ead-99f9-eab0ccd990d7_StandardR -14_2745e581-565a-4670-ae90-6bf7c57ffe43_StarterR -14_66cad568-c2dc-459d-93ec-2f3cb967ee34_VisioSIR_Prem[Pro,Std] -14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_WordR +14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR +14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR +14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL +14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR +14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL +14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR +14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL +14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR] +14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR +14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR] +14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_0029_HSExcelR +14_25fe4611-b44d-49cc-ae87-2143d299194e_00A3_HSOneNoteR +14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_0037_HSPowerPointR +14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_002B_HSWordR +14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR +14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL +14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR +14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL +14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception +14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR +14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL +14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR +14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL +14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR] +14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR +14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL +14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR] +14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR] +14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_011F_ProjectProSubR +14_1cf57a59-c532-4e56-9a7d-ffa2fe94b474_003B_ProjectProVL +14_688f6589-2bd9-424e-a152-b13f36aa6de1_003A_ProjectStdR +14_11b39439-6b93-4642-9570-f2eb81be2238_003A_ProjectStdVL +14_71af7e84-93e6-4363-9b69-699e04e74071_0011_ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] +14_e98ef0c0-71c4-42ce-8305-287d8721e26c_011D_ProPlusSubR +14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_0011_ProPlusVL_[ProPlusAcadVL] +14_98677603-a668-4fa4-9980-3f1f05f78f69_0019_PublisherR +14_3d014759-b128-4466-9018-e80f6320d9d0_0019_PublisherVL +14_dbe3aee0-5183-4ff7-8142-66050173cb01_008B_SmallBusBasicsR_[SmallBusBasicsMSDNR] +14_8090771e-d41a-4482-929e-de87f1f47e46_008B_SmallBusBasicsVL +14_b78df69e-0966-40b1-ae85-30a5134dedd0_0017_SPDR +14_d3422cfb-8d8b-4ead-99f9-eab0ccd990d7_0012_StandardR +14_1f76e346-e0be-49bc-9954-70ec53a4fcfe_0012_StandardVL_[StandardAcadVL] +14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR +14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception +14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception +14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR +14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL :: Office 2013 -15_ab4d047b-97cf-4126-a69f-34df08e2f254_AccessRetail -15_259de5be-492b-44b3-9d78-9645f848f7b0_AccessRuntimeRetail -15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_ExcelRetail -15_cfaf5356-49e3-48a8-ab3c-e729ab791250_GrooveRetail -15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail -15_a2b90e7a-a797-4713-af90-f0becf52a1dd_HomeBusinessRetail -15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_HomeStudentARMRetail -15_ebef9f05-5273-404a-9253-c5e252f50555_HomeStudentPlusARMRetail -15_f2de350d-3028-410a-bfae-283e00b44d0e_HomeStudentRetail -15_44984381-406e-4a35-b1c3-e54f499556e2_InfoPathRetail -15_9103f3ce-1084-447a-827e-d6097f68c895_LyncAcademicRetail -15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_LyncEntryRetail -15_fada6658-bfc6-4c4e-825a-59a89822cda8_LyncRetail -15_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail -15_3391e125-f6e4-4b1e-899c-a25e6092d40d_OneNoteFreeRetail -15_8b524bcc-67ea-4876-a509-45e46f6347e8_OneNoteRetail -15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_OutlookRetail -15_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail -15_17e9df2d-ed91-4382-904b-4fed6a12caf0_PersonalRetail -15_31743b82-bfbc-44b6-aa12-85d42e644d5b_PowerPointRetail -15_064383fa-1538-491c-859b-0ecab169a0ab_ProPlusRetail -15_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail -15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_ProfessionalRetail -15_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail -15_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail -15_c3a0814a-70a4-471f-af37-2313a6331111_PublisherRetail -15_ba3e3833-6a7e-445a-89d0-7802a9a68588_SPDRetail -15_32255c0a-16b4-4ce2-b388-8a4267e219eb_StandardRetail -15_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail -15_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail -15_191509f2-6977-456f-ab30-cf0492b1e93a_WordRetail +15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail +15_259de5be-492b-44b3-9d78-9645f848f7b0_001C_AccessRuntimeRetail +15_4374022d-56b8-48c1-9bb7-d8f2fc726343_0015_AccessVolume +15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_0016_ExcelRetail +15_ac1ae7fd-b949-4e04-a330-849bc40638cf_0016_ExcelVolume +15_cfaf5356-49e3-48a8-ab3c-e729ab791250_00BA_GrooveRetail +15_4825ac28-ce41-45a7-9e6e-1fed74057601_00BA_GrooveVolume +15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail +15_cd256150-a898-441f-aac0-9f8f33390e45_0013_HomeBusinessRetail +15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_00CE_HomeStudentARMRetail +15_ebef9f05-5273-404a-9253-c5e252f50555_00DA_HomeStudentPlusARMRetail +15_98685d21-78bd-4c62-bc4f-653344a63035_002F_HomeStudentRetail +15_44984381-406e-4a35-b1c3-e54f499556e2_0044_InfoPathRetail +15_9e016989-4007-42a6-8051-64eb97110cf2_0044_InfoPathVolume +15_9103f3ce-1084-447a-827e-d6097f68c895_00EA_LyncAcademicRetail +15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_012D_LyncEntryRetail +15_fada6658-bfc6-4c4e-825a-59a89822cda8_012C_LyncRetail +15_e1264e10-afaf-4439-a98b-256df8bb156f_012C_LyncVolume +15_3169c8df-f659-4f95-9cc6-3115e6596e83_000F_MondoRetail +15_f33485a0-310b-4b72-9a0e-b1d605510dbd_000F_MondoVolume +15_3391e125-f6e4-4b1e-899c-a25e6092d40d_00A1_OneNoteFreeRetail +15_8b524bcc-67ea-4876-a509-45e46f6347e8_00A1_OneNoteRetail +15_b067e965-7521-455b-b9f7-c740204578a2_00A1_OneNoteVolume +15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_001A_OutlookRetail +15_8d577c50-ae5e-47fd-a240-24986f73d503_001A_OutlookVolume +15_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail +15_17e9df2d-ed91-4382-904b-4fed6a12caf0_0033_PersonalRetail +15_31743b82-bfbc-44b6-aa12-85d42e644d5b_0018_PowerPointRetail +15_e40dcb44-1d5c-4085-8e8f-943f33c4f004_0018_PowerPointVolume +15_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail +15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_0014_ProfessionalRetail +15_f2435de4-5fc0-4e5b-ac97-34f515ec5ee7_003B_ProjectProRetail +15_ed34dc89-1c27-4ecd-8b2f-63d0f4cedc32_003B_ProjectProVolume +15_5517e6a2-739b-4822-946f-7f0f1c5934b1_003A_ProjectStdRetail +15_2b9e4a37-6230-4b42-bee2-e25ce86c8c7a_003A_ProjectStdVolume +15_064383fa-1538-491c-859b-0ecab169a0ab_0011_ProPlusRetail +15_2b88c4f2-ea8f-43cd-805e-4d41346e18a7_0011_ProPlusVolume +15_c3a0814a-70a4-471f-af37-2313a6331111_0019_PublisherRetail +15_38ea49f6-ad1d-43f1-9888-99a35d7c9409_0019_PublisherVolume +15_ba3e3833-6a7e-445a-89d0-7802a9a68588_0017_SPDRetail +15_32255c0a-16b4-4ce2-b388-8a4267e219eb_0012_StandardRetail +15_a24cca51-3d54-4c41-8a76-4031f5338cb2_0012_StandardVolume +15_15d12ad4-622d-4257-976c-5eb3282fb93d_0051_VisioProRetail +15_3e4294dd-a765-49bc-8dbd-cf8b62a4bd3d_0051_VisioProVolume +15_dae597ce-5823-4c77-9580-7268b93a4b23_0053_VisioStdRetail +15_44a1f6ff-0876-4edb-9169-dbb43101ee89_0053_VisioStdVolume +15_191509f2-6977-456f-ab30-cf0492b1e93a_001B_WordRetail +15_9cedef15-be37-4ff0-a08a-13a045540641_001B_WordVolume :: Office 365 - 15.0 version -15_6337137e-7c07-4197-8986-bece6a76fc33_O365BusinessRetail -15_537ea5b5-7d50-4876-bd38-a53a77caca32_O365HomePremRetail -15_149dbce7-a48e-44db-8364-a53386cd4580_O365ProPlusRetail -15_bacd4614-5bef-4a5e-bafc-de4c788037a2_O365SmallBusPremRetail +15_befee371-a2f5-4648-85db-a2c55fdf324c_00E9_O365BusinessRetail +15_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail +15_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail +15_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail :: Office 365 - 16.0 version -16_6337137e-7c07-4197-8986-bece6a76fc33_O365BusinessRetail -16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_O365EduCloudRetail -16_537ea5b5-7d50-4876-bd38-a53a77caca32_O365HomePremRetail -16_149dbce7-a48e-44db-8364-a53386cd4580_O365ProPlusRetail -16_bacd4614-5bef-4a5e-bafc-de4c788037a2_O365SmallBusPremRetail +16_6337137e-7c07-4197-8986-bece6a76fc33_00E9_O365BusinessRetail +16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_00D6_O365EduCloudRetail +16_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail +16_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail +16_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail :: Office 2016 -16_bfa358b0-98f1-4125-842e-585fa13032e6_AccessRetail -16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_AccessRuntimeRetail -16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_ExcelRetail -16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail -16_86834d00-7896-4a38-8fae-32f20b86fa2b_HomeBusinessRetail -16_c28acdb8-d8b3-4199-baa4-024d09e97c99_HomeStudentRetail -16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_HomeStudentARMRetail -16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_HomeStudentPlusARMRetail -16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_HomeStudentVNextRetail -16_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail -16_436366de-5579-4f24-96db-3893e4400030_OneNoteFreeRetail -16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_OneNoteRetail -16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_OutlookRetail -16_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail -16_a9f645a1-0d6a-4978-926a-abcb363b72a6_PersonalRetail -16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_PowerPointRetail -16_de52bd50-9564-4adc-8fcb-a345c17f84f9_ProPlusRetail -16_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail -16_d64edc00-7453-4301-8428-197343fafb16_ProfessionalRetail -16_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail -16_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail -16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_PublisherRetail -16_9103f3ce-1084-447a-827e-d6097f68c895_SkypeServiceBypassRetail -16_971cd368-f2e1-49c1-aedd-330909ce18b6_SkypeforBusinessEntryRetail -16_418d2b9f-b491-4d7f-84f1-49e27cc66597_SkypeforBusinessRetail -16_4a31c291-3a12-4c64-b8ab-cd79212be45e_StandardRetail -16_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail -16_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail -16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_WordRetail +16_bfa358b0-98f1-4125-842e-585fa13032e6_0015_AccessRetail +16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_001C_AccessRuntimeRetail +16_3b2fa33f-cd5a-43a5-bd95-f49f3f546b0b_0015_AccessVolume +16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_0016_ExcelRetail +16_685062a7-6024-42e7-8c5f-6bb9e63e697f_0016_ExcelVolume +16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail +16_86834d00-7896-4a38-8fae-32f20b86fa2b_0013_HomeBusinessRetail +16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_00CE_HomeStudentARMRetail +16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_00DA_HomeStudentPlusARMRetail +16_c28acdb8-d8b3-4199-baa4-024d09e97c99_002F_HomeStudentRetail +16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_002F_HomeStudentVNextRetail +16_b21367df-9545-4f02-9f24-240691da0e58_000F_MondoRetail +16_2cd0ea7e-749f-4288-a05e-567c573b2a6c_000F_MondoVolume +16_436366de-5579-4f24-96db-3893e4400030_00A3_OneNoteFreeRetail +16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_00A1_OneNoteRetail +16_23b672da-a456-4860-a8f3-e062a501d7e8_00A1_OneNoteVolume +16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_001A_OutlookRetail +16_50059979-ac6f-4458-9e79-710bcb41721a_001A_OutlookVolume +16_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail +16_a9f645a1-0d6a-4978-926a-abcb363b72a6_0033_PersonalRetail +16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_0018_PowerPointRetail +16_9b4060c9-a7f5-4a66-b732-faf248b7240f_0018_PowerPointVolume +16_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail +16_d64edc00-7453-4301-8428-197343fafb16_0014_ProfessionalRetail +16_0f42f316-00b1-48c5-ada4-2f52b5720ad0_003B_ProjectProRetail +16_82f502b5-b0b0-4349-bd2c-c560df85b248_003B_ProjectProVolume +16_16728639-a9ab-4994-b6d8-f81051e69833_003B_ProjectProXVolume +16_e9f0b3fc-962f-4944-ad06-05c10b6bcd5e_003A_ProjectStdRetail +16_82e6b314-2a62-4e51-9220-61358dd230e6_003A_ProjectStdVolume +16_431058f0-c059-44c5-b9e7-ed2dd46b6789_003A_ProjectStdXVolume +16_de52bd50-9564-4adc-8fcb-a345c17f84f9_0011_ProPlusRetail +16_c47456e3-265d-47b6-8ca0-c30abbd0ca36_0011_ProPlusVolume +16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_0019_PublisherRetail +16_fcc1757b-5d5f-486a-87cf-c4d6dedb6032_0019_PublisherVolume +16_971cd368-f2e1-49c1-aedd-330909ce18b6_012D_SkypeforBusinessEntryRetail +16_418d2b9f-b491-4d7f-84f1-49e27cc66597_012C_SkypeforBusinessRetail +16_03ca3b9a-0869-4749-8988-3cbc9d9f51bb_012C_SkypeforBusinessVolume +16_9103f3ce-1084-447a-827e-d6097f68c895_012C_SkypeServiceBypassRetail +16_4a31c291-3a12-4c64-b8ab-cd79212be45e_0012_StandardRetail +16_0ed94aac-2234-4309-ba29-74bdbb887083_0012_StandardVolume +16_2dfe2075-2d04-4e43-816a-eb60bbb77574_0051_VisioProRetail +16_295b2c03-4b1c-4221-b292-1411f468bd02_0051_VisioProVolume +16_0594dc12-8444-4912-936a-747ca742dbdb_0051_VisioProXVolume +16_c76dbcbc-d71b-4f45-b5b3-b7494cb4e23e_0053_VisioStdRetail +16_44151c2d-c398-471f-946f-7660542e3369_0053_VisioStdVolume +16_1d1c6879-39a3-47a5-9a6d-aceefa6a289d_0053_VisioStdXVolume +16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_001B_WordRetail +16_c3000759-551f-4f4a-bcac-a4b42cbf1de2_001B_WordVolume ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -if %1==getmsiret if "%oVer%"=="%%A" ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%B" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -if "%oVer%"=="14" ( -REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml -echo %%C | find /i "Visio" %nul% && set prodId=0057 +set getIds=1 +if "%oVer%"=="%%A" ( +if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) + +if defined getIds ( +reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( +reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( +if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) -reg query "%2\Registration\{%%B}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%C) else (set _oIds=%%C) ) ) ) diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index d6bfc9a..3c62eb3 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1679,7 +1679,7 @@ set "pkeypath=%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pk set "pkeypath=%_common2%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ) -call :ts_msiofficedata %2 +call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] @@ -7041,135 +7041,135 @@ Office-ActID -pkeypath "$env:pkeypath" -edition "$env:_License" -keytype "$env:k :: 1st column = Office version number :: 2nd column = Activation ID -:: 3rd column = Edition +:: 3rd column = Product ID from branding.xml +:: 4th column = Edition +:: 5th column = Other Edition IDs if they are part of the same primary product (For reference only) :: Separator = "_" -:ts_msiofficedata +:msiofficedata for %%# in ( :: Office 2013 -15_ab4d047b-97cf-4126-a69f-34df08e2f254_AccessRetail -15_259de5be-492b-44b3-9d78-9645f848f7b0_AccessRuntimeRetail -15_4374022d-56b8-48c1-9bb7-d8f2fc726343_AccessVolume -15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_ExcelRetail -15_ac1ae7fd-b949-4e04-a330-849bc40638cf_ExcelVolume -15_cfaf5356-49e3-48a8-ab3c-e729ab791250_GrooveRetail -15_4825ac28-ce41-45a7-9e6e-1fed74057601_GrooveVolume -15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail -15_a2b90e7a-a797-4713-af90-f0becf52a1dd_HomeBusinessRetail -15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_HomeStudentARMRetail -15_ebef9f05-5273-404a-9253-c5e252f50555_HomeStudentPlusARMRetail -15_f2de350d-3028-410a-bfae-283e00b44d0e_HomeStudentRetail -15_44984381-406e-4a35-b1c3-e54f499556e2_InfoPathRetail -15_9e016989-4007-42a6-8051-64eb97110cf2_InfoPathVolume -15_9103f3ce-1084-447a-827e-d6097f68c895_LyncAcademicRetail -15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_LyncEntryRetail -15_fada6658-bfc6-4c4e-825a-59a89822cda8_LyncRetail -15_e1264e10-afaf-4439-a98b-256df8bb156f_LyncVolume -15_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail -15_f33485a0-310b-4b72-9a0e-b1d605510dbd_MondoVolume -15_3391e125-f6e4-4b1e-899c-a25e6092d40d_OneNoteFreeRetail -15_8b524bcc-67ea-4876-a509-45e46f6347e8_OneNoteRetail -15_b067e965-7521-455b-b9f7-c740204578a2_OneNoteVolume -15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_OutlookRetail -15_8d577c50-ae5e-47fd-a240-24986f73d503_OutlookVolume -15_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail -15_17e9df2d-ed91-4382-904b-4fed6a12caf0_PersonalRetail -15_31743b82-bfbc-44b6-aa12-85d42e644d5b_PowerPointRetail -15_e40dcb44-1d5c-4085-8e8f-943f33c4f004_PowerPointVolume -15_064383fa-1538-491c-859b-0ecab169a0ab_ProPlusRetail -15_2b88c4f2-ea8f-43cd-805e-4d41346e18a7_ProPlusVolume -15_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail -15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_ProfessionalRetail -15_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail -15_ed34dc89-1c27-4ecd-8b2f-63d0f4cedc32_ProjectProVolume -15_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail -15_2b9e4a37-6230-4b42-bee2-e25ce86c8c7a_ProjectStdVolume -15_c3a0814a-70a4-471f-af37-2313a6331111_PublisherRetail -15_38ea49f6-ad1d-43f1-9888-99a35d7c9409_PublisherVolume -15_ba3e3833-6a7e-445a-89d0-7802a9a68588_SPDRetail -15_32255c0a-16b4-4ce2-b388-8a4267e219eb_StandardRetail -15_a24cca51-3d54-4c41-8a76-4031f5338cb2_StandardVolume -15_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail -15_3e4294dd-a765-49bc-8dbd-cf8b62a4bd3d_VisioProVolume -15_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail -15_44a1f6ff-0876-4edb-9169-dbb43101ee89_VisioStdVolume -15_191509f2-6977-456f-ab30-cf0492b1e93a_WordRetail -15_9cedef15-be37-4ff0-a08a-13a045540641_WordVolume +15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail +15_259de5be-492b-44b3-9d78-9645f848f7b0_001C_AccessRuntimeRetail +15_4374022d-56b8-48c1-9bb7-d8f2fc726343_0015_AccessVolume +15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_0016_ExcelRetail +15_ac1ae7fd-b949-4e04-a330-849bc40638cf_0016_ExcelVolume +15_cfaf5356-49e3-48a8-ab3c-e729ab791250_00BA_GrooveRetail +15_4825ac28-ce41-45a7-9e6e-1fed74057601_00BA_GrooveVolume +15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail +15_cd256150-a898-441f-aac0-9f8f33390e45_0013_HomeBusinessRetail +15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_00CE_HomeStudentARMRetail +15_ebef9f05-5273-404a-9253-c5e252f50555_00DA_HomeStudentPlusARMRetail +15_98685d21-78bd-4c62-bc4f-653344a63035_002F_HomeStudentRetail +15_44984381-406e-4a35-b1c3-e54f499556e2_0044_InfoPathRetail +15_9e016989-4007-42a6-8051-64eb97110cf2_0044_InfoPathVolume +15_9103f3ce-1084-447a-827e-d6097f68c895_00EA_LyncAcademicRetail +15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_012D_LyncEntryRetail +15_fada6658-bfc6-4c4e-825a-59a89822cda8_012C_LyncRetail +15_e1264e10-afaf-4439-a98b-256df8bb156f_012C_LyncVolume +15_3169c8df-f659-4f95-9cc6-3115e6596e83_000F_MondoRetail +15_f33485a0-310b-4b72-9a0e-b1d605510dbd_000F_MondoVolume +15_3391e125-f6e4-4b1e-899c-a25e6092d40d_00A1_OneNoteFreeRetail +15_8b524bcc-67ea-4876-a509-45e46f6347e8_00A1_OneNoteRetail +15_b067e965-7521-455b-b9f7-c740204578a2_00A1_OneNoteVolume +15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_001A_OutlookRetail +15_8d577c50-ae5e-47fd-a240-24986f73d503_001A_OutlookVolume +15_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail +15_17e9df2d-ed91-4382-904b-4fed6a12caf0_0033_PersonalRetail +15_31743b82-bfbc-44b6-aa12-85d42e644d5b_0018_PowerPointRetail +15_e40dcb44-1d5c-4085-8e8f-943f33c4f004_0018_PowerPointVolume +15_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail +15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_0014_ProfessionalRetail +15_f2435de4-5fc0-4e5b-ac97-34f515ec5ee7_003B_ProjectProRetail +15_ed34dc89-1c27-4ecd-8b2f-63d0f4cedc32_003B_ProjectProVolume +15_5517e6a2-739b-4822-946f-7f0f1c5934b1_003A_ProjectStdRetail +15_2b9e4a37-6230-4b42-bee2-e25ce86c8c7a_003A_ProjectStdVolume +15_064383fa-1538-491c-859b-0ecab169a0ab_0011_ProPlusRetail +15_2b88c4f2-ea8f-43cd-805e-4d41346e18a7_0011_ProPlusVolume +15_c3a0814a-70a4-471f-af37-2313a6331111_0019_PublisherRetail +15_38ea49f6-ad1d-43f1-9888-99a35d7c9409_0019_PublisherVolume +15_ba3e3833-6a7e-445a-89d0-7802a9a68588_0017_SPDRetail +15_32255c0a-16b4-4ce2-b388-8a4267e219eb_0012_StandardRetail +15_a24cca51-3d54-4c41-8a76-4031f5338cb2_0012_StandardVolume +15_15d12ad4-622d-4257-976c-5eb3282fb93d_0051_VisioProRetail +15_3e4294dd-a765-49bc-8dbd-cf8b62a4bd3d_0051_VisioProVolume +15_dae597ce-5823-4c77-9580-7268b93a4b23_0053_VisioStdRetail +15_44a1f6ff-0876-4edb-9169-dbb43101ee89_0053_VisioStdVolume +15_191509f2-6977-456f-ab30-cf0492b1e93a_001B_WordRetail +15_9cedef15-be37-4ff0-a08a-13a045540641_001B_WordVolume :: Office 365 - 15.0 version -15_742178ed-6b28-42dd-b3d7-b7c0ea78741b_O365BusinessRetail -15_a96f8dae-da54-4fad-bdc6-108da592707a_O365HomePremRetail -15_e3dacc06-3bc2-4e13-8e59-8e05f3232325_O365ProPlusRetail -15_0bc1dae4-6158-4a1c-a893-807665b934b2_O365SmallBusPremRetail +15_befee371-a2f5-4648-85db-a2c55fdf324c_00E9_O365BusinessRetail +15_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail +15_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail +15_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail :: Office 365 - 16.0 version -16_742178ed-6b28-42dd-b3d7-b7c0ea78741b_O365BusinessRetail -16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_O365EduCloudRetail -16_a96f8dae-da54-4fad-bdc6-108da592707a_O365HomePremRetail -16_e3dacc06-3bc2-4e13-8e59-8e05f3232325_O365ProPlusRetail -16_0bc1dae4-6158-4a1c-a893-807665b934b2_O365SmallBusPremRetail +16_6337137e-7c07-4197-8986-bece6a76fc33_00E9_O365BusinessRetail +16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_00D6_O365EduCloudRetail +16_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail +16_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail +16_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail :: Office 2016 -16_bfa358b0-98f1-4125-842e-585fa13032e6_AccessRetail -16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_AccessRuntimeRetail -16_3b2fa33f-cd5a-43a5-bd95-f49f3f546b0b_AccessVolume -16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_ExcelRetail -16_685062a7-6024-42e7-8c5f-6bb9e63e697f_ExcelVolume -16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail -16_86834d00-7896-4a38-8fae-32f20b86fa2b_HomeBusinessRetail -16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_HomeStudentARMRetail -16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_HomeStudentPlusARMRetail -16_c28acdb8-d8b3-4199-baa4-024d09e97c99_HomeStudentRetail -16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_HomeStudentVNextRetail -16_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail -16_2cd0ea7e-749f-4288-a05e-567c573b2a6c_MondoVolume -16_436366de-5579-4f24-96db-3893e4400030_OneNoteFreeRetail -16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_OneNoteRetail -16_23b672da-a456-4860-a8f3-e062a501d7e8_OneNoteVolume -16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_OutlookRetail -16_50059979-ac6f-4458-9e79-710bcb41721a_OutlookVolume -16_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail -16_a9f645a1-0d6a-4978-926a-abcb363b72a6_PersonalRetail -16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_PowerPointRetail -16_9b4060c9-a7f5-4a66-b732-faf248b7240f_PowerPointVolume -16_de52bd50-9564-4adc-8fcb-a345c17f84f9_ProPlusRetail -16_c47456e3-265d-47b6-8ca0-c30abbd0ca36_ProPlusVolume -16_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail -16_d64edc00-7453-4301-8428-197343fafb16_ProfessionalRetail -16_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail -16_82f502b5-b0b0-4349-bd2c-c560df85b248_ProjectProVolume -16_16728639-a9ab-4994-b6d8-f81051e69833_ProjectProXVolume -16_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail -16_82e6b314-2a62-4e51-9220-61358dd230e6_ProjectStdVolume -16_431058f0-c059-44c5-b9e7-ed2dd46b6789_ProjectStdXVolume -16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_PublisherRetail -16_fcc1757b-5d5f-486a-87cf-c4d6dedb6032_PublisherVolume -16_9103f3ce-1084-447a-827e-d6097f68c895_SkypeServiceBypassRetail -16_971cd368-f2e1-49c1-aedd-330909ce18b6_SkypeforBusinessEntryRetail -16_418d2b9f-b491-4d7f-84f1-49e27cc66597_SkypeforBusinessRetail -16_03ca3b9a-0869-4749-8988-3cbc9d9f51bb_SkypeforBusinessVolume -16_4a31c291-3a12-4c64-b8ab-cd79212be45e_StandardRetail -16_0ed94aac-2234-4309-ba29-74bdbb887083_StandardVolume -16_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail -16_295b2c03-4b1c-4221-b292-1411f468bd02_VisioProVolume -16_0594dc12-8444-4912-936a-747ca742dbdb_VisioProXVolume -16_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail -16_44151c2d-c398-471f-946f-7660542e3369_VisioStdVolume -16_1d1c6879-39a3-47a5-9a6d-aceefa6a289d_VisioStdXVolume -16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_WordRetail -16_c3000759-551f-4f4a-bcac-a4b42cbf1de2_WordVolume +16_bfa358b0-98f1-4125-842e-585fa13032e6_0015_AccessRetail +16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_001C_AccessRuntimeRetail +16_3b2fa33f-cd5a-43a5-bd95-f49f3f546b0b_0015_AccessVolume +16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_0016_ExcelRetail +16_685062a7-6024-42e7-8c5f-6bb9e63e697f_0016_ExcelVolume +16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail +16_86834d00-7896-4a38-8fae-32f20b86fa2b_0013_HomeBusinessRetail +16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_00CE_HomeStudentARMRetail +16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_00DA_HomeStudentPlusARMRetail +16_c28acdb8-d8b3-4199-baa4-024d09e97c99_002F_HomeStudentRetail +16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_002F_HomeStudentVNextRetail +16_b21367df-9545-4f02-9f24-240691da0e58_000F_MondoRetail +16_2cd0ea7e-749f-4288-a05e-567c573b2a6c_000F_MondoVolume +16_436366de-5579-4f24-96db-3893e4400030_00A3_OneNoteFreeRetail +16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_00A1_OneNoteRetail +16_23b672da-a456-4860-a8f3-e062a501d7e8_00A1_OneNoteVolume +16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_001A_OutlookRetail +16_50059979-ac6f-4458-9e79-710bcb41721a_001A_OutlookVolume +16_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail +16_a9f645a1-0d6a-4978-926a-abcb363b72a6_0033_PersonalRetail +16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_0018_PowerPointRetail +16_9b4060c9-a7f5-4a66-b732-faf248b7240f_0018_PowerPointVolume +16_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail +16_d64edc00-7453-4301-8428-197343fafb16_0014_ProfessionalRetail +16_0f42f316-00b1-48c5-ada4-2f52b5720ad0_003B_ProjectProRetail +16_82f502b5-b0b0-4349-bd2c-c560df85b248_003B_ProjectProVolume +16_16728639-a9ab-4994-b6d8-f81051e69833_003B_ProjectProXVolume +16_e9f0b3fc-962f-4944-ad06-05c10b6bcd5e_003A_ProjectStdRetail +16_82e6b314-2a62-4e51-9220-61358dd230e6_003A_ProjectStdVolume +16_431058f0-c059-44c5-b9e7-ed2dd46b6789_003A_ProjectStdXVolume +16_de52bd50-9564-4adc-8fcb-a345c17f84f9_0011_ProPlusRetail +16_c47456e3-265d-47b6-8ca0-c30abbd0ca36_0011_ProPlusVolume +16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_0019_PublisherRetail +16_fcc1757b-5d5f-486a-87cf-c4d6dedb6032_0019_PublisherVolume +16_971cd368-f2e1-49c1-aedd-330909ce18b6_012D_SkypeforBusinessEntryRetail +16_418d2b9f-b491-4d7f-84f1-49e27cc66597_012C_SkypeforBusinessRetail +16_03ca3b9a-0869-4749-8988-3cbc9d9f51bb_012C_SkypeforBusinessVolume +16_9103f3ce-1084-447a-827e-d6097f68c895_012C_SkypeServiceBypassRetail +16_4a31c291-3a12-4c64-b8ab-cd79212be45e_0012_StandardRetail +16_0ed94aac-2234-4309-ba29-74bdbb887083_0012_StandardVolume +16_2dfe2075-2d04-4e43-816a-eb60bbb77574_0051_VisioProRetail +16_295b2c03-4b1c-4221-b292-1411f468bd02_0051_VisioProVolume +16_0594dc12-8444-4912-936a-747ca742dbdb_0051_VisioProXVolume +16_c76dbcbc-d71b-4f45-b5b3-b7494cb4e23e_0053_VisioStdRetail +16_44151c2d-c398-471f-946f-7660542e3369_0053_VisioStdVolume +16_1d1c6879-39a3-47a5-9a6d-aceefa6a289d_0053_VisioStdXVolume +16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_001B_WordRetail +16_c3000759-551f-4f4a-bcac-a4b42cbf1de2_001B_WordVolume ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( +set getIds=1 if "%oVer%"=="%%A" ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%B" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -if "%oVer%"=="14" ( -REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml -echo %%C | find /i "Visio" %nul% && set prodId=0057 +if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) + +if defined getIds ( +reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( +reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( +if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) -reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%1\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%C) else (set _oIds=%%C) ) ) ) From 60dd549a4982c39f972271b638f3af2ab98c776e Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sat, 12 Apr 2025 20:07:24 +0530 Subject: [PATCH 13/30] Don't add SharedComputerLicensing registry on Server for old Office versions --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 4 ++-- .../Activators/Ohook_Activation_AIO.cmd | 2 +- MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 39f3b77..b630bcd 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -2812,7 +2812,7 @@ call :dk_color %_Yellow% "%mas%" :: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server :: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server -if defined winserver if defined _config ( +if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( echo %_oIds% | find /i "Retail" %nul1% && ( set scaIsNeeded=1 reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1% @@ -4869,7 +4869,7 @@ echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic :: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server :: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server -if defined winserver if defined _config ( +if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( echo %_oIds% | find /i "Retail" %nul1% && ( set scaIsNeeded=1 reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1% diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 8a3ccb0..b037146 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -1027,7 +1027,7 @@ call :dk_color %_Yellow% "%mas%" :: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server :: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server -if defined winserver if defined _config ( +if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( echo %_oIds% | find /i "Retail" %nul1% && ( set scaIsNeeded=1 reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1% diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 3c62eb3..37b6232 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1638,7 +1638,7 @@ echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic :: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server :: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server -if defined winserver if defined _config ( +if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" ( echo %_oIds% | find /i "Retail" %nul1% && ( set scaIsNeeded=1 reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1% From 8673fbbfdabf9fdf34823c4e276ed3a4ef4095ba Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sun, 13 Apr 2025 03:45:34 +0530 Subject: [PATCH 14/30] Add -nop -c with Powershell --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 6 +++--- MAS/Separate-Files-Version/Activators/HWID_Activation.cmd | 4 ++-- MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd | 4 ++-- .../Activators/Ohook_Activation_AIO.cmd | 4 ++-- .../Activators/Online_KMS_Activation.cmd | 6 +++--- .../Activators/TSforge_Activation.cmd | 4 ++-- MAS/Separate-Files-Version/Change_Office_Edition.cmd | 4 ++-- MAS/Separate-Files-Version/Change_Windows_Edition.cmd | 4 ++-- MAS/Separate-Files-Version/Extract_OEM_Folder.cmd | 4 ++-- MAS/Separate-Files-Version/Troubleshoot.cmd | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index b630bcd..0effebc 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -200,7 +200,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -1068,7 +1068,7 @@ goto :dk_done :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G @@ -11261,7 +11261,7 @@ set _tserror= set winbuild=1 set "nul=>nul 2>&1" for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G -set psc=powershell.exe +set psc=powershell.exe -nop -c set run_once= set t_name=Renewal Task diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 50512c5..8e8f039 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -239,7 +239,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -799,7 +799,7 @@ goto :dk_done :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index e5ed725..f352fc1 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -242,7 +242,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -905,7 +905,7 @@ $key.SetAccessControl($acl) :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index b037146..602e142 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -232,7 +232,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -1327,7 +1327,7 @@ exit /b :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 8dd961b..fe3370a 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -261,7 +261,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -1646,7 +1646,7 @@ set _tserror= set winbuild=1 set "nul=>nul 2>&1" for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G -set psc=powershell.exe +set psc=powershell.exe -nop -c set run_once= set t_name=Renewal Task @@ -2332,7 +2332,7 @@ exit /b :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 37b6232..24077db 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -267,7 +267,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -1955,7 +1955,7 @@ exit /b :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 32a8727..05f0639 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -192,7 +192,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -1343,7 +1343,7 @@ if ($appIdsList.Count -gt 0) { :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 2c0dbb8..7524407 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -197,7 +197,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -815,7 +815,7 @@ exit /b :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index 735941d..d5db12e 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -191,7 +191,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -723,7 +723,7 @@ exit /b :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index 1c12499..a3d3b8b 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -192,7 +192,7 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor if /i not "%tstresult%"=="FullLanguage" ( %eline% -echo %tstresult% +echo: %tstresult% cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode @@ -1460,7 +1460,7 @@ exit /b :dk_setvar -set psc=powershell.exe +set psc=powershell.exe -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G From 3b739d7e2bac5ac01c0dac87855ca1fb72c6b54b Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sun, 13 Apr 2025 04:25:10 +0530 Subject: [PATCH 15/30] Add malware check in Powershell test --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 12 +++++++++++- .../Activators/HWID_Activation.cmd | 12 +++++++++++- .../Activators/KMS38_Activation.cmd | 12 +++++++++++- .../Activators/Ohook_Activation_AIO.cmd | 12 +++++++++++- .../Activators/Online_KMS_Activation.cmd | 12 +++++++++++- .../Activators/TSforge_Activation.cmd | 12 +++++++++++- MAS/Separate-Files-Version/Change_Office_Edition.cmd | 12 +++++++++++- .../Change_Windows_Edition.cmd | 12 +++++++++++- MAS/Separate-Files-Version/Extract_OEM_Folder.cmd | 12 +++++++++++- MAS/Separate-Files-Version/Troubleshoot.cmd | 12 +++++++++++- 10 files changed, 110 insertions(+), 10 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 0effebc..d7a91d5 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -206,7 +206,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -222,6 +221,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto dk_done ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto dk_done +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 8e8f039..61515a9 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -245,7 +245,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -261,6 +260,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto dk_done ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto dk_done +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index f352fc1..31e5bb0 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -248,7 +248,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -264,6 +263,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto dk_done ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto dk_done +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 602e142..186365e 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -238,7 +238,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -254,6 +253,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto dk_done ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto dk_done +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index fe3370a..e1e40b3 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -267,7 +267,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -283,6 +282,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto dk_done ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto dk_done +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 24077db..d3559ee 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -273,7 +273,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -289,6 +288,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto dk_done ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto dk_done +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 05f0639..0e71bb4 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -198,7 +198,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -214,6 +213,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto dk_done ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto dk_done +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 7524407..c9a5155 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -203,7 +203,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -219,6 +218,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto dk_done ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto dk_done +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index d5db12e..e9db519 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -197,7 +197,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -213,6 +212,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto done2 ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto done2 +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index a3d3b8b..818091f 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -198,7 +198,6 @@ cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" REM check LanguageMode cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( -%eline% echo FullLanguage mode not found in PowerShell. Aborting... echo If you have applied restrictions on Powershell then undo those changes. echo: @@ -214,6 +213,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power goto dk_done ) +REM check for Mal-ware that may cause issues with Powershell + +for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" ( +echo "%%f" +echo Mal%blank%ware found, PowerShell is not working properly. +echo: +set fixes=%fixes% %mas%remove_mal%w%ware +call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware" +goto dk_done +) + REM check antivirus and other errors echo PowerShell is not working properly. Aborting... From c316b42e5cd166aa5c10a54d03ca0c5e5d63f4cd Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Mon, 14 Apr 2025 04:10:58 +0530 Subject: [PATCH 16/30] Simplify the code related to "disable quickedit and avoid Terminal app" --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 37 +++++++++---------- .../Activators/HWID_Activation.cmd | 37 +++++++++---------- .../Activators/KMS38_Activation.cmd | 37 +++++++++---------- .../Activators/Ohook_Activation_AIO.cmd | 37 +++++++++---------- .../Activators/Online_KMS_Activation.cmd | 37 +++++++++---------- .../Activators/TSforge_Activation.cmd | 37 +++++++++---------- .../Change_Office_Edition.cmd | 37 +++++++++---------- .../Change_Windows_Edition.cmd | 37 +++++++++---------- .../Extract_OEM_Folder.cmd | 37 +++++++++---------- MAS/Separate-Files-Version/Troubleshoot.cmd | 37 +++++++++---------- 10 files changed, 180 insertions(+), 190 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index d7a91d5..2a42c2b 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -254,34 +254,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 61515a9..8f65bbd 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -293,34 +293,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index 31e5bb0..bcac266 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -296,34 +296,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 186365e..e97586c 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -286,34 +286,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index e1e40b3..6c652a2 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -315,34 +315,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index d3559ee..4a9af9c 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -321,34 +321,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 0e71bb4..264a58e 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -246,34 +246,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index c9a5155..37b02c1 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -251,34 +251,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index e9db519..df142d4 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -245,34 +245,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index 818091f..483f6da 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -246,34 +246,33 @@ set terminal= :: Check if script is running in Terminal app -set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0); -set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128); -set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128); -set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow(); -set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero); - if defined terminal ( -%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal= +set lines=0 +for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A +if !lines! GEQ 100 set terminal= ) -if defined ps32onArm goto :skipQE if %_unattended%==1 goto :skipQE for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE) +:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app +:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes +:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error + +set resetQE=1 +reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0 +reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1% + if defined terminal ( -set "launchcmd=start conhost.exe %psc%" -) else ( -set "launchcmd=%psc%" +start conhost.exe "!_batf!" %_args% -qedit +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b +) else if %resetQE% EQU 1 ( +start cmd.exe /c ""!_batf!" %_args% -qedit" +start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1% +exit /b ) -:: Disable QuickEdit in current session - -set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);" -set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);" -set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);" -set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);" - -%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1) :skipQE ::======================================================================================================================================== From 0d61475468de80b7f711038384e754331a14c7d8 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Tue, 15 Apr 2025 07:02:19 +0530 Subject: [PATCH 17/30] Fix an issue where Office doesn't need activation but TSforge would show phone license missing error --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 25 +++++++++++++++++++ .../Activators/TSforge_Activation.cmd | 25 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 2a42c2b..4410980 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -8874,6 +8874,24 @@ function Get-WmiInfo { } } +function slGetSkuInfo($SkuId) { + $t = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0) + $t.DefinePInvokeMethod('SLOpen', 'slc.dll', 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $t.DefinePInvokeMethod('SLClose', 'slc.dll', 22, 1, [IntPtr], @([IntPtr]), 1, 3).SetImplementationFlags(128) + $t.DefinePInvokeMethod('SLGetProductSkuInformation', 'slc.dll', 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $w = $t.CreateType() + $hSLC = 0 + try { + [void]$w::SLOpen([ref]$hSLC) + $c = 0; $b = 0 + $r = $w::SLGetProductSkuInformation($hSLC, [ref][Guid]$SkuId, "msft:sl/EUL/PHONE/PUBLIC", [ref]$null, [ref]$c, [ref]$b) + return ($r -eq 0) + } + finally { + [void]$w::SLClose($hSLC) + } +} + if ($env:resetstuff -eq $null) { foreach ($tsactid in $tsactids) { try { @@ -8884,6 +8902,13 @@ if ($env:resetstuff -eq $null) { $prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null } } [LibTSforge.Modifiers.GenPKeyInstall]::InstallGenPKey($ver, $prod, $tsactid) + if ($prodName -match 'Office' -and -not (slGetSkuInfo($tsactid))) { + $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" + if ($licenseStatus -eq 1) { + Write-Host "[$prodName] is already permanently activated." -ForegroundColor White -BackgroundColor DarkGreen + continue + } + } [LibTSforge.Activators.ZeroCID]::Activate($ver, $prod, $tsactid) $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" if ($licenseStatus -eq 1) { diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 4a9af9c..3330a77 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -6747,6 +6747,24 @@ function Get-WmiInfo { } } +function slGetSkuInfo($SkuId) { + $t = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0) + $t.DefinePInvokeMethod('SLOpen', 'slc.dll', 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $t.DefinePInvokeMethod('SLClose', 'slc.dll', 22, 1, [IntPtr], @([IntPtr]), 1, 3).SetImplementationFlags(128) + $t.DefinePInvokeMethod('SLGetProductSkuInformation', 'slc.dll', 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $w = $t.CreateType() + $hSLC = 0 + try { + [void]$w::SLOpen([ref]$hSLC) + $c = 0; $b = 0 + $r = $w::SLGetProductSkuInformation($hSLC, [ref][Guid]$SkuId, "msft:sl/EUL/PHONE/PUBLIC", [ref]$null, [ref]$c, [ref]$b) + return ($r -eq 0) + } + finally { + [void]$w::SLClose($hSLC) + } +} + if ($env:resetstuff -eq $null) { foreach ($tsactid in $tsactids) { try { @@ -6757,6 +6775,13 @@ if ($env:resetstuff -eq $null) { $prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null } } [LibTSforge.Modifiers.GenPKeyInstall]::InstallGenPKey($ver, $prod, $tsactid) + if ($prodName -match 'Office' -and -not (slGetSkuInfo($tsactid))) { + $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" + if ($licenseStatus -eq 1) { + Write-Host "[$prodName] is already permanently activated." -ForegroundColor White -BackgroundColor DarkGreen + continue + } + } [LibTSforge.Activators.ZeroCID]::Activate($ver, $prod, $tsactid) $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" if ($licenseStatus -eq 1) { From f5a0a63165d9e6b57719f48322baac60e29a2e6a Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Tue, 15 Apr 2025 08:39:39 +0530 Subject: [PATCH 18/30] Cleanup leftover branding.xml related code --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 61 ++----------------- .../Activators/Ohook_Activation_AIO.cmd | 15 ----- .../Activators/Online_KMS_Activation.cmd | 41 ++----------- .../Activators/TSforge_Activation.cmd | 15 ----- 4 files changed, 12 insertions(+), 120 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 4410980..fc5db47 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -2608,7 +2608,6 @@ set _prids= set _config= set _version= set _License= -set _oBranding= exit /b ::======================================================================================================================================== @@ -2862,20 +2861,11 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - call :msiofficedata %2 echo: echo Activating Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found, aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found, aborting activation...]" @@ -4790,7 +4780,6 @@ set _prids= set _config= set _version= set _License= -set _oBranding= exit /b ::======================================================================================================================================== @@ -4910,9 +4899,6 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - if exist "%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ( set "pkeypath=%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ) else if exist "%_common2%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ( @@ -4924,12 +4910,6 @@ call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]" @@ -10951,7 +10931,7 @@ set _prids= set _config= set _version= set _License= -set _oBranding= +set _oMSI= exit /b ::======================================================================================================================================== @@ -11033,7 +11013,7 @@ exit /b for %%# in (%_oIds%) do ( set skipprocess= -if %_NoEditionChange%==1 if not defined _oBranding ( +if %_NoEditionChange%==1 if not defined _oMSI ( set foundprod= call :ksdata chkprod %%# if not defined foundprod ( @@ -11082,7 +11062,7 @@ if not "!key!"=="" ( echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic call :dk_inskey "[!key!] [!_prod!]" ) else ( -if not defined _oBranding ( +if not defined _oMSI ( set error=1 call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]" call :dk_color %Blue% "Make sure you are using Latest MAS script." @@ -11105,6 +11085,7 @@ exit /b :: Process Office MSI Version call :ks_reset +set _oMSI=1 if "%1"=="14" ( call :dk_actids 59a52881-a989-479d-af46-f275c6370663 @@ -11125,21 +11106,11 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - -call :ksdata getmsiprod %2 -call :msiofficedata %2 getmsiret +call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]" @@ -12159,18 +12130,13 @@ for %%# in ( ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -set getIds=1 if "%oVer%"=="%%A" ( -if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) - -if defined getIds ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) ) ) -) ) ) @@ -12443,7 +12409,7 @@ if /i "%2"=="%%D" ( set key=%%B set _actid=%%A set _allactid=!_allactid! %%A -) else if not defined _oBranding if %_NoEditionChange%==0 ( +) else if not defined _oMSI if %_NoEditionChange%==0 ( echo: %%E | find /i "-%2-" %nul% && ( set key=%%B set _altoffid=%%D @@ -12453,21 +12419,6 @@ set _allactid=!_allactid! %%A ) ) -if %1==getmsiprod if "%oVer%"=="%%C" ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%A" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -if "%oVer%"=="14" ( -REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml -echo %%D | find /i "Visio" %nul% && set prodId=0057 -) -reg query "%2\Registration\{%%A}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) -) -) -) - ) ) exit /b diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index e97586c..04b78db 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -823,7 +823,6 @@ set _prids= set _config= set _version= set _License= -set _oBranding= exit /b ::======================================================================================================================================== @@ -1077,20 +1076,11 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - call :msiofficedata %2 echo: echo Activating Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found, aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found, aborting activation...]" @@ -2475,18 +2465,13 @@ for %%# in ( ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -set getIds=1 if "%oVer%"=="%%A" ( -if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) - -if defined getIds ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) ) ) -) ) ) diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 6c652a2..d8759e2 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -1029,7 +1029,7 @@ set _prids= set _config= set _version= set _License= -set _oBranding= +set _oMSI= exit /b ::======================================================================================================================================== @@ -1143,7 +1143,7 @@ exit /b for %%# in (%_oIds%) do ( set skipprocess= -if %_NoEditionChange%==1 if not defined _oBranding ( +if %_NoEditionChange%==1 if not defined _oMSI ( set foundprod= call :ksdata chkprod %%# if not defined foundprod ( @@ -1192,7 +1192,7 @@ if not "!key!"=="" ( echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic call :dk_inskey "[!key!] [!_prod!]" ) else ( -if not defined _oBranding ( +if not defined _oMSI ( set error=1 call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]" call :dk_color %Blue% "Make sure you are using Latest MAS script." @@ -1215,6 +1215,7 @@ exit /b :: Process Office MSI Version call :ks_reset +set _oMSI=1 if "%1"=="14" ( call :dk_actids 59a52881-a989-479d-af46-f275c6370663 @@ -1235,21 +1236,11 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - -call :ksdata getmsiprod %2 -call :msiofficedata %2 getmsiret +call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]" @@ -3450,18 +3441,13 @@ for %%# in ( ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -set getIds=1 if "%oVer%"=="%%A" ( -if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) - -if defined getIds ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) ) ) -) ) ) @@ -3734,7 +3720,7 @@ if /i "%2"=="%%D" ( set key=%%B set _actid=%%A set _allactid=!_allactid! %%A -) else if not defined _oBranding if %_NoEditionChange%==0 ( +) else if not defined _oMSI if %_NoEditionChange%==0 ( echo: %%E | find /i "-%2-" %nul% && ( set key=%%B set _altoffid=%%D @@ -3744,21 +3730,6 @@ set _allactid=!_allactid! %%A ) ) -if %1==getmsiprod if "%oVer%"=="%%C" ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%A" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -if "%oVer%"=="14" ( -REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml -echo %%D | find /i "Visio" %nul% && set prodId=0057 -) -reg query "%2\Registration\{%%A}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) -) -) -) - ) ) exit /b diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 3330a77..7da980b 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1499,7 +1499,6 @@ set _prids= set _config= set _version= set _License= -set _oBranding= exit /b ::======================================================================================================================================== @@ -1679,9 +1678,6 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - if exist "%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ( set "pkeypath=%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ) else if exist "%_common2%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ( @@ -1693,12 +1689,6 @@ call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]" @@ -7195,18 +7185,13 @@ for %%# in ( ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -set getIds=1 if "%oVer%"=="%%A" ( -if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) - -if defined getIds ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) ) ) -) ) ) From 294837dfe0eed177b177954e7ba8b5841af55264 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Wed, 16 Apr 2025 03:47:15 +0530 Subject: [PATCH 19/30] Add the updated CAS by abbodi1406 --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 1013 ++++++++++++----- .../Check_Activation_Status.cmd | 1013 ++++++++++++----- 2 files changed, 1514 insertions(+), 512 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index fc5db47..b5a94e7 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -12508,6 +12508,7 @@ $IID = $IID.IsPresent -Or $Dlv.IsPresent $NT6 = $winbuild -GE 6000 $NT7 = $winbuild -GE 7600 +$NT8 = $winbuild -GE 9200 $NT9 = $winbuild -GE 9600 $Admin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) @@ -12583,55 +12584,375 @@ function CheckOhook & $noAll } -#region WMI -function DetectID($strSLP, $strAppId) -{ - $ppk = (" AND PartialProductKey <> NULL)", ")")[$All.IsPresent] - $fltr = "SELECT ID FROM $strSLP WHERE (ApplicationID='$strAppId'" - $clause = $fltr + $ppk - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - return ($sWmi.Get().Count -GT 0) +#region SSSS +function BoolToWStr($bVal) { + ("TRUE", "FALSE")[!$bVal] } -function GetID($strSLP, $strAppId) -{ - $NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001) - $IDs = [Collections.ArrayList]@() - $isAdd = (" AND LicenseDependsOn <> NULL)", ")")[$NT5] - $noAdd = " AND LicenseDependsOn IS NULL)" - $query = "SELECT ID FROM $strSLP WHERE (ApplicationID='$strAppId' AND PartialProductKey" +function InitializePInvoke($LaDll, $bOffice) { + $Marshal = [System.Runtime.InteropServices.Marshal] + $Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly((Get-Random), 'Run').DefineDynamicModule((Get-Random), $False) + $SLApp = $NT7 -Or $bOffice -Or ($LaDll -EQ 'sppc.dll' -And [Diagnostics.FileVersionInfo]::GetVersionInfo("$SysPath\sppc.dll").FilePrivatePart -GE 16501) - if ($All.IsPresent) { - $fltr = $query + " IS NULL" - $clause = $fltr + $isAdd - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {} - if (-Not $NT5) { - $clause = $fltr + $noAdd - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {} + $Win32 = $null + $Class = $Module.DefineType((Get-Random), 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0) + $Class.DefinePInvokeMethod('SLClose', $LaDll, 22, 1, [Int32], @([IntPtr]), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLOpen', $LaDll, 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGenerateOfflineInstallationId', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetSLIDList', $LaDll, 22, 1, [Int32], @([IntPtr], [UInt32], [Guid].MakeByRefType(), [UInt32], [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetLicensingStatusInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [Guid].MakeByRefType(), [IntPtr], [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetPKeyInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetProductSkuInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetServiceInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + if ($SLApp) { + $Class.DefinePInvokeMethod('SLGetApplicationInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + } + if ($bOffice) { + $Win32 = $Class.CreateType() + return + } + if ($NT6) { + $Class.DefinePInvokeMethod('SLGetWindowsInformation', 'slc.dll', 22, 1, [Int32], @([String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 22, 1, [Int32], @([String], [UInt32].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLIsGenuineLocal', 'slwga.dll', 22, 1, [Int32], @([Guid].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr]), 1, 3).SetImplementationFlags(128) + } + if ($NT7) { + $Class.DefinePInvokeMethod('SLIsWindowsGenuineLocal', 'slc.dll', 'Public, Static', 'Standard', [Int32], @([UInt32].MakeByRefType()), 'Winapi', 'Unicode').SetImplementationFlags('PreserveSig') + } + + if ($DllSubscription) { + $Class.DefinePInvokeMethod('ClipGetSubscriptionStatus', 'Clipc.dll', 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Struct = $Class.DefineNestedType('SubStatus', 'NestedPublic, SequentialLayout, Sealed, BeforeFieldInit', [ValueType], 0) + [void]$Struct.DefineField('dwEnabled', [UInt32], 'Public') + [void]$Struct.DefineField('dwSku', [UInt32], 6) + [void]$Struct.DefineField('dwState', [UInt32], 6) + $SubStatus = $Struct.CreateType() + } + + $Win32 = $Class.CreateType() +} + +function SlGetInfoIID($SkuId) +{ + $bData = 0 + + if ($Win32::SLGenerateOfflineInstallationId( + $hSLC, + [ref][Guid]$SkuId, + [ref]$bData + )) + { + return $null + } + + $rData = $Marshal::PtrToStringUni($bData) + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoSku($SkuId, $Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetProductSkuInformation( + $hSLC, + [ref][Guid]$SkuId, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $null + } + + if ($tData -EQ 1) + { + $rData = $Marshal::PtrToStringUni($bData) + } + elseif ($tData -EQ 4) + { + $rData = $Marshal::ReadInt32($bData) + } + elseif ($tData -EQ 3 -And $cData -EQ 8) + { + $rData = $Marshal::ReadInt64($bData) + } + else + { + $rData = $null + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoService($Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetServiceInformation( + $hSLC, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $null + } + + if ($tData -EQ 1) + { + $rData = $Marshal::PtrToStringUni($bData) + } + elseif ($tData -EQ 4) + { + $rData = $Marshal::ReadInt32($bData) + } + elseif ($tData -EQ 3 -And $cData -EQ 8) + { + $rData = $Marshal::ReadInt64($bData) + } + else + { + $rData = $null + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoApp($AppId, $Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetApplicationInformation( + $hSLC, + [ref][Guid]$AppId, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $null + } + + if ($tData -EQ 1) + { + $rData = $Marshal::PtrToStringUni($bData) + } + elseif ($tData -EQ 4) + { + $rData = $Marshal::ReadInt32($bData) + } + elseif ($tData -EQ 3 -And $cData -EQ 8) + { + $rData = $Marshal::ReadInt64($bData) + } + else + { + $rData = $null + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoSvcApp($strApp, $Value) +{ + if ($SLApp) + { + $rData = SlGetInfoApp $strApp $Value + } + else + { + $rData = SlGetInfoService $Value + } + return $rData +} + +function SlGetInfoPKey($PkeyId, $Value) +{ + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetPKeyInformation( + $hSLC, + [ref][Guid]$PKeyId, + $Value, + [ref]$null, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $null + } + + $rData = $Marshal::PtrToStringUni($bData) + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoLicensing($AppId, $SkuId) +{ + $LicenseStatus = 0 + $GracePeriodRemaining = 0 + $hrReason = 0 + $EvaluationEndDate = 0 + + $cStatus = 0 + $pStatus = 0 + + $ret = $Win32::SLGetLicensingStatusInformation( + $hSLC, + [ref][Guid]$AppId, + [ref][Guid]$SkuId, + 0, + [ref]$cStatus, + [ref]$pStatus + ) + + if ($ret -Or !$cStatus) + { + return + } + + [IntPtr]$ppStatus = [Int64]$pStatus + [Int64]40 * ($cStatus - 1) + $eStatus = $Marshal::ReadInt32($ppStatus, 16) + $GracePeriodRemaining = $Marshal::ReadInt32($ppStatus, 20) + $hrReason = $Marshal::ReadInt32($ppStatus, 28) + $EvaluationEndDate = $Marshal::ReadInt64($ppStatus, 32) + + if ($eStatus -EQ 3) + { + $eStatus = 5 + } + if ($eStatus -EQ 2) + { + if ($hrReason -EQ 0x4004F00D) + { + $eStatus = 3 + } + elseif ($hrReason -EQ 0x4004F065) + { + $eStatus = 4 + } + elseif ($hrReason -EQ 0x4004FC06) + { + $eStatus = 6 } } + $LicenseStatus = $eStatus - $fltr = $query + " <> NULL" - $clause = $fltr + $isAdd - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {} - if (-Not $NT5) { - $clause = $fltr + $noAdd - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {} + $Marshal::FreeHGlobal($pStatus) + return +} + +function SlCheckInfo($SkuId, $Value) +{ + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetProductSkuInformation( + $hSLC, + [ref][Guid]$SkuId, + $Value, + [ref]$null, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $false } - return $IDs + if ($Value -EQ "pkeyId") + { + $rData = $Marshal::PtrToStringUni($bData) + } + else + { + $rData = $true + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoSLID($AppId) +{ + $cReturnIds = 0 + $pReturnIds = 0 + + $ret = $Win32::SLGetSLIDList( + $hSLC, + 0, + [ref][Guid]$AppId, + 1, + [ref]$cReturnIds, + [ref]$pReturnIds + ) + + if ($ret -Or !$cReturnIds) + { + return + } + + $a1List = @() + $a2List = @() + $a3List = @() + $a4List = @() + + foreach ($i in 0..($cReturnIds - 1)) + { + $bytes = New-Object byte[] 16 + $Marshal::Copy([Int64]$pReturnIds + [Int64]16 * $i, $bytes, 0, 16) + $actid = ([Guid]$bytes).Guid + $gPPK = SlCheckInfo $actid "pkeyId" + $gAdd = SlCheckInfo $actid "DependsOn" + if ($All.IsPresent) { + if (!$gPPK -And $gAdd) { $a1List += @{id = $actid; pk = $null; ex = $true} } + if (!$gPPK -And !$gAdd) { $a2List += @{id = $actid; pk = $null; ex = $false} } + } + if ($gPPK -And $gAdd) { $a3List += @{id = $actid; pk = $gPPK; ex = $true} } + if ($gPPK -And !$gAdd) { $a4List += @{id = $actid; pk = $gPPK; ex = $false} } + } + + $Marshal::FreeHGlobal($pReturnIds) + return ($a1List + $a2List + $a3List + $a4List) } function DetectSubscription { + try + { + $objSvc = New-Object PSObject + $wmiSvc = [wmisearcher]"SELECT SubscriptionType, SubscriptionStatus, SubscriptionEdition, SubscriptionExpiry FROM SoftwareLicensingService" + $wmiSvc.Options.Rewindable = $false + $wmiSvc.Get() | select -Expand Properties -EA 0 | foreach { $objSvc | Add-Member 8 $_.Name $_.Value } + $wmiSvc.Dispose() + } + catch + { + return + } + if ($null -EQ $objSvc.SubscriptionType -Or $objSvc.SubscriptionType -EQ 120) { return } @@ -12663,161 +12984,188 @@ function DetectSubscription { } CONOUT "`nSubscription information:" - CONOUT " Edition: $SubMsgEdition" CONOUT " Type : $SubMsgType" CONOUT " Status : $SubMsgStatus" + CONOUT " Edition: $SubMsgEdition" CONOUT " Expiry : $SubMsgExpiry" } function DetectAdbaClient { + $propADBA | foreach { set $_ (SlGetInfoSku $ID $_) } CONOUT "`nAD Activation client information:" CONOUT " Object Name: $ADActivationObjectName" CONOUT " Domain Name: $ADActivationObjectDN" - CONOUT " CSVLK Extended PID: $ADActivationCsvlkPid" - CONOUT " CSVLK Activation ID: $ADActivationCsvlkSkuId" + CONOUT " CSVLK Extended PID: $ADActivationCsvlkPID" + CONOUT " CSVLK Activation ID: $ADActivationCsvlkSkuID" } function DetectAvmClient { + $propAVMA | foreach { set $_ (SlGetInfoSku $ID $_) } CONOUT "`nAutomatic VM Activation client information:" - if (-Not [String]::IsNullOrEmpty($IAID)) { - CONOUT " Guest IAID: $IAID" + if (-Not [String]::IsNullOrEmpty($InheritedActivationId)) { + CONOUT " Guest IAID: $InheritedActivationId" } else { CONOUT " Guest IAID: Not Available" } - if (-Not [String]::IsNullOrEmpty($AutomaticVMActivationHostMachineName)) { - CONOUT " Host machine name: $AutomaticVMActivationHostMachineName" + if (-Not [String]::IsNullOrEmpty($InheritedActivationHostMachineName)) { + CONOUT " Host machine name: $InheritedActivationHostMachineName" } else { CONOUT " Host machine name: Not Available" } - if ($AutomaticVMActivationLastActivationTime.Substring(0,4) -NE "1601") { - $EED = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($AutomaticVMActivationLastActivationTime),$null,48).ToString('yyyy-MM-dd hh:mm:ss tt') - CONOUT " Activation time: $EED UTC" - } else { - CONOUT " Activation time: Not Available" - } - if (-Not [String]::IsNullOrEmpty($AutomaticVMActivationHostDigitalPid2)) { - CONOUT " Host Digital PID2: $AutomaticVMActivationHostDigitalPid2" + if (-Not [String]::IsNullOrEmpty($InheritedActivationHostDigitalPid2)) { + CONOUT " Host Digital PID2: $InheritedActivationHostDigitalPid2" } else { CONOUT " Host Digital PID2: Not Available" } + if ($InheritedActivationActivationTime) { + $IAAT = [DateTime]::FromFileTime($InheritedActivationActivationTime).ToString('yyyy-MM-dd hh:mm:ss tt') + CONOUT " Activation time: $IAAT" + } else { + CONOUT " Activation time: Not Available" + } } function DetectKmsHost { + $IsKeyManagementService = SlGetInfoSvcApp $strApp 'IsKeyManagementService' + if (-Not $IsKeyManagementService) { + return + } + if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} + if ($Vista -Or $NT5) { - $KeyManagementServiceListeningPort = strGetRegistry $SLKeyPath "KeyManagementServiceListeningPort" - $KeyManagementServiceDnsPublishing = strGetRegistry $SLKeyPath "DisableDnsPublishing" - $KeyManagementServiceLowPriority = strGetRegistry $SLKeyPath "EnableKmsLowPriority" - if (-Not $KeyManagementServiceDnsPublishing) {$KeyManagementServiceDnsPublishing = "TRUE"} - if (-Not $KeyManagementServiceLowPriority) {$KeyManagementServiceLowPriority = "FALSE"} + $regk = $SLKeyPath + } elseif ($strSLP -EQ $oslp) { + $regk = $OPKeyPath } else { - $KeyManagementServiceListeningPort = $objSvc.KeyManagementServiceListeningPort - $KeyManagementServiceDnsPublishing = $objSvc.KeyManagementServiceDnsPublishing - $KeyManagementServiceLowPriority = $objSvc.KeyManagementServiceLowPriority + $regk = $SPKeyPath + } + $KMSListening = strGetRegistry $regk "KeyManagementServiceListeningPort" + $KMSPublishing = strGetRegistry $regk "DisableDnsPublishing" + $KMSPriority = strGetRegistry $regk "EnableKmsLowPriority" + + if (-Not $KMSListening) {$KMSListening = 1688} + if (-Not $KMSPublishing) {$KMSPublishing = "TRUE"} else {$KMSPublishing = BoolToWStr (!$KMSPublishing)} + if (-Not $KMSPriority) {$KMSPriority = "FALSE"} else {$KMSPriority = BoolToWStr $KMSPriority} + + if ($KMSPublishing -EQ "TRUE") {$KMSPublishing = "Enabled"} else {$KMSPublishing = "Disabled"} + if ($KMSPriority -EQ "TRUE") {$KMSPriority = "Low"} else {$KMSPriority = "Normal"} + + if ($SLApp) + { + $propKMSServer | foreach { set $_ (SlGetInfoApp $strApp $_) } + } + else + { + $propKMSServer | foreach { set $_ (SlGetInfoService $_) } } - if (-Not $KeyManagementServiceListeningPort) {$KeyManagementServiceListeningPort = 1688} - if ($KeyManagementServiceDnsPublishing -EQ "TRUE") { - $KeyManagementServiceDnsPublishing = "Enabled" - } else { - $KeyManagementServiceDnsPublishing = "Disabled" - } - if ($KeyManagementServiceLowPriority -EQ "TRUE") { - $KeyManagementServiceLowPriority = "Low" - } else { - $KeyManagementServiceLowPriority = "Normal" - } + $KMSRequests = $KeyManagementServiceTotalRequests + $NoRequests = ($null -EQ $KMSRequests) -Or ($KMSRequests -EQ -1) -Or ($KMSRequests -EQ 4294967295) CONOUT "`nKey Management Service host information:" CONOUT " Current count: $KeyManagementServiceCurrentCount" - CONOUT " Listening on Port: $KeyManagementServiceListeningPort" - CONOUT " DNS publishing: $KeyManagementServiceDnsPublishing" - CONOUT " KMS priority: $KeyManagementServiceLowPriority" - if (-Not [String]::IsNullOrEmpty($KeyManagementServiceTotalRequests)) { - CONOUT "`nKey Management Service cumulative requests received from clients:" - CONOUT " Total: $KeyManagementServiceTotalRequests" - CONOUT " Failed: $KeyManagementServiceFailedRequests" - CONOUT " Unlicensed: $KeyManagementServiceUnlicensedRequests" - CONOUT " Licensed: $KeyManagementServiceLicensedRequests" - CONOUT " Initial grace period: $KeyManagementServiceOOBGraceRequests" - CONOUT " Expired or Hardware out of tolerance: $KeyManagementServiceOOTGraceRequests" - CONOUT " Non-genuine grace period: $KeyManagementServiceNonGenuineGraceRequests" - if ($null -NE $KeyManagementServiceNotificationRequests) {CONOUT " Notification: $KeyManagementServiceNotificationRequests"} + CONOUT " Listening on Port: $KMSListening" + CONOUT " DNS publishing: $KMSPublishing" + CONOUT " KMS priority: $KMSPriority" + if ($NoRequests) { + return } + CONOUT "`nKey Management Service cumulative requests received from clients:" + CONOUT " Total: $KeyManagementServiceTotalRequests" + CONOUT " Failed: $KeyManagementServiceFailedRequests" + CONOUT " Unlicensed: $KeyManagementServiceUnlicensedRequests" + CONOUT " Licensed: $KeyManagementServiceLicensedRequests" + CONOUT " Initial grace period: $KeyManagementServiceOOBGraceRequests" + CONOUT " Expired or Hardware out of tolerance: $KeyManagementServiceOOTGraceRequests" + CONOUT " Non-genuine grace period: $KeyManagementServiceNonGenuineGraceRequests" + if ($null -NE $KeyManagementServiceNotificationRequests) {CONOUT " Notification: $KeyManagementServiceNotificationRequests"} } function DetectKmsClient { - if ($null -NE $VLActivationTypeEnabled) {CONOUT "Configured Activation Type: $($VLActTypes[$VLActivationTypeEnabled])"} + if ($strSLP -EQ $wslp -And $NT8) + { + $VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $ID) "VLActivationType" + if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath + '\' + $strApp) "VLActivationType"} + if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath) "VLActivationType"} + if ($null -EQ $VLType -Or $VLType -GT 3) {$VLType = 0} + } + if ($null -NE $VLType) {CONOUT "Configured Activation Type: $($VLActTypes[$VLType])"} + CONOUT "`r" if ($LicenseStatus -NE 1) { CONOUT "Please activate the product in order to update KMS client information values." return } - if ($Vista) { - $KeyManagementServicePort = strGetRegistry $SLKeyPath "KeyManagementServicePort" - $DiscoveredKeyManagementServiceMachineName = strGetRegistry $NSKeyPath "DiscoveredKeyManagementServiceName" - $DiscoveredKeyManagementServiceMachinePort = strGetRegistry $NSKeyPath "DiscoveredKeyManagementServicePort" + if ($NT7 -Or $strSLP -EQ $oslp) { + $propKMSClient | foreach { set $_ (SlGetInfoSku $ID $_) } + if ($strSLP -EQ $oslp) {$regk = $OPKeyPath} else {$regk = $SPKeyPath} + $KMSCaching = strGetRegistry $regk "DisableKeyManagementServiceHostCaching" + if (-Not $KMSCaching) {$KMSCaching = "TRUE"} else {$KMSCaching = BoolToWStr (!$KMSCaching)} } - if ([String]::IsNullOrEmpty($KeyManagementServiceMachine)) { + "ClientMachineID" | foreach { set $_ (SlGetInfoService $_) } + + if ($Vista) { + $propKMSVista | foreach { set $_ (SlGetInfoService $_) } + $KeyManagementServicePort = strGetRegistry $SLKeyPath "KeyManagementServicePort" + $DiscoveredKeyManagementServiceName = strGetRegistry $NSKeyPath "DiscoveredKeyManagementServiceName" + $DiscoveredKeyManagementServicePort = strGetRegistry $NSKeyPath "DiscoveredKeyManagementServicePort" + } + + if ([String]::IsNullOrEmpty($KeyManagementServiceName)) { $KmsReg = $null } else { if (-Not $KeyManagementServicePort) {$KeyManagementServicePort = 1688} - $KmsReg = "Registered KMS machine name: ${KeyManagementServiceMachine}:${KeyManagementServicePort}" + $KmsReg = "Registered KMS machine name: ${KeyManagementServiceName}:${KeyManagementServicePort}" } - if ([String]::IsNullOrEmpty($DiscoveredKeyManagementServiceMachineName)) { + if ([String]::IsNullOrEmpty($DiscoveredKeyManagementServiceName)) { $KmsDns = "DNS auto-discovery: KMS name not available" if ($Vista -And -Not $Admin) {$KmsDns = "DNS auto-discovery: Run the script as administrator to retrieve info"} } else { - if (-Not $DiscoveredKeyManagementServiceMachinePort) {$DiscoveredKeyManagementServiceMachinePort = 1688} - $KmsDns = "KMS machine name from DNS: ${DiscoveredKeyManagementServiceMachineName}:${DiscoveredKeyManagementServiceMachinePort}" + if (-Not $DiscoveredKeyManagementServicePort) {$DiscoveredKeyManagementServicePort = 1688} + $KmsDns = "KMS machine name from DNS: ${DiscoveredKeyManagementServiceName}:${DiscoveredKeyManagementServicePort}" } - if ($null -NE $objSvc.KeyManagementServiceHostCaching) { - if ($objSvc.KeyManagementServiceHostCaching -EQ "TRUE") { - $KeyManagementServiceHostCaching = "Enabled" - } else { - $KeyManagementServiceHostCaching = "Disabled" + if ($null -NE $KMSCaching) { + if ($KMSCaching -EQ "TRUE") {$KMSCaching = "Enabled"} else {$KMSCaching = "Disabled"} + } + + if ($strSLP -EQ $wslp -And $NT9) { + if ([String]::IsNullOrEmpty($DiscoveredKeyManagementServiceIpAddress)) { + $DiscoveredKeyManagementServiceIpAddress = "not available" } } CONOUT "Key Management Service client information:" - CONOUT " Client Machine ID (CMID): $($objSvc.ClientMachineID)" + CONOUT " Client Machine ID (CMID): $ClientMachineID" if ($null -EQ $KmsReg) { CONOUT " $KmsDns" CONOUT " Registered KMS machine name: KMS name not available" } else { CONOUT " $KmsReg" } - if ($null -NE $DiscoveredKeyManagementServiceMachineIpAddress) {CONOUT " KMS machine IP address: $DiscoveredKeyManagementServiceMachineIpAddress"} - CONOUT " KMS machine extended PID: $KeyManagementServiceProductKeyID" + if ($null -NE $DiscoveredKeyManagementServiceIpAddress) {CONOUT " KMS machine IP address: $DiscoveredKeyManagementServiceIpAddress"} + CONOUT " KMS machine extended PID: $CustomerPID" CONOUT " Activation interval: $VLActivationInterval minutes" CONOUT " Renewal interval: $VLRenewalInterval minutes" - if ($null -NE $KeyManagementServiceHostCaching) {CONOUT " KMS host caching: $KeyManagementServiceHostCaching"} + if ($null -NE $KMSCaching) {CONOUT " KMS host caching: $KMSCaching"} if (-Not [String]::IsNullOrEmpty($KeyManagementServiceLookupDomain)) {CONOUT " KMS SRV record lookup domain: $KeyManagementServiceLookupDomain"} } -function GetResult($strSLP, $strSLS, $strID) +function GetResult($strSLP, $strApp, $entry) { - try - { - $objPrd = [wmisearcher]"SELECT * FROM $strSLP WHERE ID='$strID'" - $objPrd.Options.Rewindable = $false - $objPrd.Get() | select -Expand Properties -EA 0 | foreach { if (-Not [String]::IsNullOrEmpty($_.Value)) {set $_.Name $_.Value} } - $objPrd.Dispose() - } - catch - { - return - } + $ID = $entry.id + $propPrd | foreach { set $_ (SlGetInfoSku $ID $_) } + . SlGetInfoLicensing $strApp $ID - $winID = ($ApplicationID -EQ $winApp) - $winPR = ($winID -And -Not $LicenseIsAddon) + $winID = ($strApp -EQ $winApp) + $winPR = ($winID -And -Not $entry.ex) $Vista = ($winID -And $NT6 -And -Not $NT7) $NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001) $reapp = ("Windows", "App")[!$winID] @@ -12827,16 +13175,15 @@ function GetResult($strSLP, $strSLS, $strID) if ($Description | Select-String "TIMEBASED_") {$cTblClient = 1; $_mTag = "Timebased"} if ($Description | Select-String "VIRTUAL_MACHINE_ACTIVATION") {$cAvmClient = 1; $_mTag = "Automatic VM"} if ($null -EQ $cKmsClient) { - if ($Description | Select-String "VOLUME_KMS") {$cKmsHost = 1} + if ($Description | Select-String "VOLUME_KMS") {$cKmsServer = 1} } $_gpr = [Math]::Round($GracePeriodRemaining/1440) if ($_gpr -GT 0) { - $_xpr = [DateTime]::Now.addMinutes($GracePeriodRemaining).ToString('yyyy-MM-dd hh:mm:ss tt') + $_xpr = [DateTime]::Now.AddMinutes($GracePeriodRemaining).ToString('yyyy-MM-dd hh:mm:ss tt') } - if ($null -EQ $LicenseStatusReason) {$LicenseStatusReason = -1} - $LicenseReason = '0x{0:X}' -f $LicenseStatusReason + $LicenseReason = '0x{0:X}' -f $hrReason $LicenseMsg = "Time remaining: $GracePeriodRemaining minute(s) ($_gpr day(s))" if ($LicenseStatus -EQ 0) { $LicenseInf = "Unlicensed" @@ -12844,8 +13191,8 @@ function GetResult($strSLP, $strSLS, $strID) } if ($LicenseStatus -EQ 1) { $LicenseInf = "Licensed" - $LicenseMsg = $null if ($GracePeriodRemaining -EQ 0) { + $LicenseMsg = $null $ExpireMsg = "The $prmnt is permanently activated." } else { $LicenseMsg = "$_mTag activation expiration: $GracePeriodRemaining minute(s) ($_gpr day(s))" @@ -12880,24 +13227,54 @@ function GetResult($strSLP, $strSLS, $strID) if ($null -NE $_xpr) {$ExpireMsg = "Extended grace period ends $_xpr"} } - if ($winPR -And $PartialProductKey -And -Not $NT9) { - $dp4 = strGetRegistry "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "DigitalProductId4" - if ($null -NE $dp4) { - $ProductKeyChannel = ([System.Text.Encoding]::Unicode.GetString($dp4, 1016, 128)).Trim([char]$null) + $pkid = $entry.pk + if ($null -NE $pkid) { + $propPkey | foreach { set $_ (SlGetInfoPKey $pkid $_) } + } + + if ($winPR -And $null -NE $PartialProductKey -And -Not $NT8) { + $uxd = SlGetInfoSku $ID 'UXDifferentiator' + $script:primary += @{ + aid = $ID; + ppk = $PartialProductKey; + chn = $Channel; + lst = $LicenseStatus; + lcr = $hrReason; + ged = $GracePeriodRemaining; + evl = $EvaluationEndDate; + dff = $uxd } } - if ($winPR -And $Dlv -And $NT7 -And $null -EQ $RemainingAppReArmCount) { - try + if ($IID -And $null -NE $PartialProductKey) { + $OfflineInstallationId = SlGetInfoIID $ID + } + + if ($Dlv) { + if ($strSLP -EQ $wslp -And $NT8) { - $tmp = [wmisearcher]"SELECT RemainingWindowsReArmCount FROM $strSLS" - $tmp.Options.Rewindable = $false - $tmp.Get() | select -Expand Properties -EA 0 | foreach {set $_.Name $_.Value} - $tmp.Dispose() + $RemainingSkuReArmCount = SlGetInfoSku $ID 'RemainingRearmCount' + $RemainingAppReArmCount = SlGetInfoApp $strApp 'RemainingRearmCount' } - catch + else { + if (($winID -And $NT7) -Or $strSLP -EQ $oslp) + { + $RemainingSLReArmCount = SlGetInfoApp $strApp 'RemainingRearmCount' + } + else + { + $RemainingSLReArmCount = SlGetInfoService 'RearmCount' + } } + if ($null -EQ $TrustedTime) + { + $TrustedTime = SlGetInfoSvcApp $strApp 'TrustedTime' + } + } + + if ($Dlv -Or $All.IsPresent) { + $gPHN = SlCheckInfo $ID "msft:sl/EUL/PHONE/PUBLIC" } $add_on = $Name.IndexOf("add-on for", 5) @@ -12906,73 +13283,56 @@ function GetResult($strSLP, $strSLS, $strID) if ($add_on -EQ -1) {CONOUT "Name: $Name"} else {CONOUT "Name: $($Name.Substring(0, $add_on + 7))"} CONOUT "Description: $Description" CONOUT "Activation ID: $ID" - if ($null -NE $ProductKeyID) {CONOUT "Extended PID: $ProductKeyID"} - if ($null -NE $ProductKeyID2 -And $Dlv) {CONOUT "Product ID: $ProductKeyID2"} + if ($null -NE $DigitalPID) {CONOUT "Extended PID: $DigitalPID"} + if ($null -NE $DigitalPID2 -And $Dlv) {CONOUT "Product ID: $DigitalPID2"} if ($null -NE $OfflineInstallationId -And $IID) {CONOUT "Installation ID: $OfflineInstallationId"} - if ($null -NE $ProductKeyChannel) {CONOUT "Product Key Channel: $ProductKeyChannel"} + if ($null -NE $Channel) {CONOUT "Product Key Channel: $Channel"} if ($null -NE $PartialProductKey) {CONOUT "Partial Product Key: $PartialProductKey"} CONOUT "License Status: $LicenseInf" if ($null -NE $LicenseMsg) {CONOUT "$LicenseMsg"} - if ($LicenseStatus -NE 0 -And $EvaluationEndDate.Substring(0,4) -NE "1601") { - $EED = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($EvaluationEndDate),$null,48).ToString('yyyy-MM-dd hh:mm:ss tt') + if ($LicenseStatus -NE 0 -And $EvaluationEndDate) { + $EED = [DateTime]::FromFileTimeUtc($EvaluationEndDate).ToString('yyyy-MM-dd hh:mm:ss tt') CONOUT "Evaluation End Date: $EED UTC" } + if ($LicenseStatus -NE 1 -And $null -NE $gPHN) { + $gPHN = $gPHN.ToString() + CONOUT "Phone activatable: $gPHN" + } if ($Dlv) { - if ($null -NE $RemainingWindowsReArmCount) { - CONOUT "Remaining Windows rearm count: $RemainingWindowsReArmCount" + if ($null -NE $RemainingSLReArmCount) { + CONOUT "Remaining $reapp rearm count: $RemainingSLReArmCount" } - if ($null -NE $RemainingSkuReArmCount -And $RemainingSkuReArmCount -NE 4294967295) { + if ($null -NE $RemainingSkuReArmCount) { CONOUT "Remaining $reapp rearm count: $RemainingAppReArmCount" CONOUT "Remaining SKU rearm count: $RemainingSkuReArmCount" } - if ($null -NE $TrustedTime -And $LicenseStatus -NE 0) { - $TTD = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($TrustedTime),$null,32).ToString('yyyy-MM-dd hh:mm:ss tt') + if ($LicenseStatus -NE 0 -And $TrustedTime) { + $TTD = [DateTime]::FromFileTime($TrustedTime).ToString('yyyy-MM-dd hh:mm:ss tt') CONOUT "Trusted time: $TTD" } } - if ($LicenseStatus -EQ 0) { + if ($null -EQ $PartialProductKey) { return } - if ($strSLP -EQ $wslp -And $null -NE $PartialProductKey -And $null -NE $ADActivationObjectName -And $VLActivationType -EQ 1) { + if ($strSLP -EQ $wslp -And $NT8 -And $VLActivationType -EQ 1) { DetectAdbaClient } - if ($winID -And $null -NE $cAvmClient -And $null -NE $PartialProductKey) { + if ($winID -And $null -NE $cAvmClient) { DetectAvmClient } $chkSub = ($winPR -And $cSub) - $chkSLS = ($null -NE $PartialProductKey) -And ($null -NE $cKmsClient -Or $null -NE $cKmsHost -Or $chkSub) + $chkSLS = ($null -NE $cKmsClient -Or $null -NE $cKmsServer -Or $chkSub) if (!$chkSLS) { if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} return } - try - { - $objSvc = New-Object PSObject - $wmiSvc = [wmisearcher]"SELECT * FROM $strSLS" - $wmiSvc.Options.Rewindable = $false - $wmiSvc.Get() | select -Expand Properties -EA 0 | foreach { if (-Not [String]::IsNullOrEmpty($_.Value)) {$objSvc | Add-Member 8 $_.Name $_.Value} } - $wmiSvc.Dispose() - if ($null -EQ $IsKeyManagementServiceMachine) {$objSvc.PSObject.Properties | foreach {set $_.Name $_.Value}} - } - catch - { - return - } - - if ($strSLS -EQ $wsls -And $NT9) { - if ([String]::IsNullOrEmpty($DiscoveredKeyManagementServiceMachineIpAddress)) { - $DiscoveredKeyManagementServiceMachineIpAddress = "not available" - } - } - - if ($null -NE $cKmsHost -And $IsKeyManagementServiceMachine -GT 0) { - if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} + if ($null -NE $cKmsServer) { DetectKmsHost } @@ -12980,7 +13340,7 @@ function GetResult($strSLP, $strSLS, $strID) DetectKmsClient } - if ($null -EQ $cKmsHost) { + if ($null -EQ $cKmsServer) { if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} } @@ -12989,6 +13349,16 @@ function GetResult($strSLP, $strSLS, $strID) } } + +function ParseList($strSLP, $strApp, $arrList) +{ + foreach ($entry in $arrList) + { + GetResult $strSLP $strApp $entry + CONOUT "$line3" + & $noAll + } +} #endregion #region vNextDiag @@ -13207,31 +13577,6 @@ 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. #> -function BoolToWStr($bVal) { - ("TRUE", "FALSE")[!$bVal] -} - -function InitializePInvoke { - $Marshal = [System.Runtime.InteropServices.Marshal] - $Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly((Get-Random), 'Run').DefineDynamicModule((Get-Random)) - - $Class = $Module.DefineType('NativeMethods', 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0) - $Class.DefinePInvokeMethod('SLIsWindowsGenuineLocal', 'slc.dll', 'Public, Static', 'Standard', [Int32], @([UInt32].MakeByRefType()), 'Winapi', 'Unicode').SetImplementationFlags('PreserveSig') - $Class.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 22, 1, [Int32], @([String], [UInt32].MakeByRefType()), 1, 3).SetImplementationFlags(128) - $Class.DefinePInvokeMethod('SLGetWindowsInformation', 'slc.dll', 22, 1, [Int32], @([String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) - - if ($DllSubscription) { - $Class.DefinePInvokeMethod('ClipGetSubscriptionStatus', 'Clipc.dll', 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) - $Struct = $Class.DefineNestedType('SubStatus', 'NestedPublic, SequentialLayout, Sealed, BeforeFieldInit', [ValueType], 0) - [void]$Struct.DefineField('dwEnabled', [UInt32], 'Public') - [void]$Struct.DefineField('dwSku', [UInt32], 6) - [void]$Struct.DefineField('dwState', [UInt32], 6) - $SubStatus = $Struct.CreateType() - } - - $Win32 = $Class.CreateType() -} - function InitializeDigitalLicenseCheck { $CAB = [System.Reflection.Emit.CustomAttributeBuilder] @@ -13286,36 +13631,29 @@ function PrintLastActivationHResult { } function PrintLastActivationTime { - $pdwLastTime = 0 + $pqwLastTime = 0 $cbSize = 0 if ($Win32::SLGetWindowsInformation( "Security-SPP-LastWindowsActivationTime", [ref]$null, [ref]$cbSize, - [ref]$pdwLastTime + [ref]$pqwLastTime )) { return $FALSE } - $actTime = $Marshal::ReadInt64($pdwLastTime) + $actTime = $Marshal::ReadInt64($pqwLastTime) if ($actTime -ne 0) { CONOUT (" LastActivationTime={0}" -f [DateTime]::FromFileTimeUtc($actTime).ToString("yyyy/MM/dd:HH:mm:ss")) } - $Marshal::FreeHGlobal($pdwLastTime) + $Marshal::FreeHGlobal($pqwLastTime) return $TRUE } function PrintIsWindowsGenuine { $dwGenuine = 0 - $ppwszGenuineStates = @( - "SL_GEN_STATE_IS_GENUINE", - "SL_GEN_STATE_INVALID_LICENSE", - "SL_GEN_STATE_TAMPERED", - "SL_GEN_STATE_OFFLINE", - "SL_GEN_STATE_LAST" - ) if ($Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine)) { return $FALSE @@ -13412,6 +13750,126 @@ function ClicRun } #endregion +#region clc +function clcGetExpireKrn +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetWindowsInformation( + "Kernel-ExpirationDate", + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData -Or $tData -NE 3) + { + return $null + } + + $year = $Marshal::ReadInt16($bData, 0) + if ($year -EQ 0 -Or $year -EQ 1601) + { + $rData = $null + } + else + { + $rData = '{0}/{1}/{2}:{3}:{4}:{5}' -f $year, $Marshal::ReadInt16($bData, 2), $Marshal::ReadInt16($bData, 4), $Marshal::ReadInt16($bData, 6), $Marshal::ReadInt16($bData, 8), $Marshal::ReadInt16($bData, 10) + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function clcGetExpireSys +{ + $kuser = $Marshal::ReadInt64((New-Object IntPtr(0x7FFE02C8))) + + if ($kuser -EQ 0) + { + return $null + } + + $rData = [DateTime]::FromFileTimeUTC($kuser).ToString('yyyy/MM/dd:HH:mm:ss') + return $rData +} + +function clcGetLicensingState($dwState) +{ + if ($dwState -EQ 5) { + $dwState = 3 + } elseif ($dwState -EQ 3 -Or $dwState -EQ 4 -Or $dwState -EQ 6) { + $dwState = 2 + } elseif ($dwState -GT 6) { + $dwState = 4 + } + + $rData = '{0}' -f $ppwszLicensingStates[$dwState] + return $rData +} + +function clcGetGenuineState($AppId) +{ + $dwGenuine = 0 + + if ($NT7) { + $ret = $Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine) + } else { + $ret = $Win32::SLIsGenuineLocal([ref][Guid]$AppId, [ref]$dwGenuine, 0) + } + + if ($ret) + { + $dwGenuine = 4 + } + + if ($dwGenuine -LT 5) { + $rData = '{0}' -f $ppwszGenuineStates[$dwGenuine] + } else { + $rData = $dwGenuine + } + return $rData +} + +function ClcRun +{ + $prs = $script:primary[0] + if ($null -EQ $prs) { + return + } + + $lState = clcGetLicensingState $prs.lst + $uState = clcGetGenuineState $winApp + $TbbKrn = clcGetExpireKrn + $TbbSys = clcGetExpireSys + if ($null -NE $TbbKrn) { + $ked = $TbbKrn + } elseif ($null -NE $TbbSys) { + $ked = $TbbSys + } + + & $isAll + CONOUT "Client Licensing Check information:" + + CONOUT (" AppId={0}" -f $winApp) + if ($prs.ged) { CONOUT (" GraceEndDate={0}" -f ([DateTime]::UtcNow.AddMinutes($prs.ged).ToString('yyyy/MM/dd:HH:mm:ss'))) } + if ($null -NE $ked) { CONOUT (" KernelTimebombDate={0}" -f $ked) } + CONOUT (" LastConsumptionReason=0x{0:x8}" -f $prs.lcr) + if ($prs.evl) { CONOUT (" LicenseExpirationDate={0}" -f ([DateTime]::FromFileTimeUtc($prs.evl).ToString('yyyy/MM/dd:HH:mm:ss'))) } + CONOUT (" LicenseState={0}" -f $lState) + CONOUT (" PartialProductKey={0}" -f $prs.ppk) + CONOUT (" ProductKeyType={0}" -f $prs.chn) + CONOUT (" SkuId={0}" -f $prs.aid) + CONOUT (" uxDifferentiator={0}" -f $prs.dff) + CONOUT (" IsWindowsGenuine={0}" -f $uState) + + CONOUT "$line3" + & $noAll +} +#endregion + $Host.UI.RawUI.WindowTitle = "Check Activation Status" if ($All.IsPresent) { $B=$Host.UI.RawUI.BufferSize;$B.Height=3000;$Host.UI.RawUI.BufferSize=$B; @@ -13430,14 +13888,38 @@ $osls = "OfficeSoftwareProtectionService" $winApp = "55c92734-d682-4d71-983e-d6ec3f16059f" $o14App = "59a52881-a989-479d-af46-f275c6370663" $o15App = "0ff1ce15-a989-479d-af46-f275c6370663" -$cSub = ($winbuild -GE 19041) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType") +$cSub = ($winbuild -GE 26000) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType") $DllDigital = ($winbuild -GE 14393) -And (Test-Path "$SysPath\EditionUpgradeManagerObj.dll") $DllSubscription = ($winbuild -GE 14393) -And (Test-Path "$SysPath\Clipc.dll") $VLActTypes = @("All", "AD", "KMS", "Token") +$OPKeyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" +$SPKeyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" $SLKeyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" $NSKeyPath = "HKEY_USERS\S-1-5-20\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" +$propPrd = 'Name', 'Description', 'TrustedTime', 'VLActivationType' +$propPkey = 'PartialProductKey', 'Channel', 'DigitalPID', 'DigitalPID2' +$propKMSServer = 'KeyManagementServiceCurrentCount', 'KeyManagementServiceTotalRequests', 'KeyManagementServiceFailedRequests', 'KeyManagementServiceUnlicensedRequests', 'KeyManagementServiceLicensedRequests', 'KeyManagementServiceOOBGraceRequests', 'KeyManagementServiceOOTGraceRequests', 'KeyManagementServiceNonGenuineGraceRequests', 'KeyManagementServiceNotificationRequests' +$propKMSClient = 'CustomerPID', 'KeyManagementServiceName', 'KeyManagementServicePort', 'DiscoveredKeyManagementServiceName', 'DiscoveredKeyManagementServicePort', 'DiscoveredKeyManagementServiceIpAddress', 'VLActivationInterval', 'VLRenewalInterval', 'KeyManagementServiceLookupDomain' +$propKMSVista = 'CustomerPID', 'KeyManagementServiceName', 'VLActivationInterval', 'VLRenewalInterval' +$propADBA = 'ADActivationObjectName', 'ADActivationObjectDN', 'ADActivationCsvlkPID', 'ADActivationCsvlkSkuID' +$propAVMA = 'InheritedActivationId', 'InheritedActivationHostMachineName', 'InheritedActivationHostDigitalPid2', 'InheritedActivationActivationTime' +$primary = @() +$ppwszGenuineStates = @( + "SL_GEN_STATE_IS_GENUINE", + "SL_GEN_STATE_INVALID_LICENSE", + "SL_GEN_STATE_TAMPERED", + "SL_GEN_STATE_OFFLINE", + "SL_GEN_STATE_LAST" +) +$ppwszLicensingStates = @( + "SL_LICENSING_STATUS_UNLICENSED", + "SL_LICENSING_STATUS_LICENSED", + "SL_LICENSING_STATUS_IN_GRACE_PERIOD", + "SL_LICENSING_STATUS_NOTIFICATION", + "SL_LICENSING_STATUS_LAST" +) -'cW1nd0ws', 'c0ff1ce15', 'c0ff1ce14', 'ospp14', 'ospp15' | foreach {set $_ $false} +'cW1nd0ws', 'c0ff1ce15', 'c0ff1ce14', 'ospp14', 'ospp15' | foreach {set $_ @()} $offsvc = "osppsvc" if ($NT7 -Or -Not $NT6) {$winsvc = "sppsvc"} else {$winsvc = "slsvc"} @@ -13445,83 +13927,102 @@ if ($NT7 -Or -Not $NT6) {$winsvc = "sppsvc"} else {$winsvc = "slsvc"} try {gsv $winsvc -EA 1 | Out-Null; $WsppHook = 1} catch {$WsppHook = 0} try {gsv $offsvc -EA 1 | Out-Null; $OsppHook = 1} catch {$OsppHook = 0} -if ($WsppHook -NE 0) { - try {sasv $winsvc -EA 1} catch {} - $cW1nd0ws = DetectID $wslp $winApp - $c0ff1ce15 = DetectID $wslp $o15App - $c0ff1ce14 = DetectID $wslp $o14App +if (Test-Path "$SysPath\sppc.dll") { + $SLdll = 'sppc.dll' +} elseif (Test-Path "$SysPath\slc.dll") { + $SLdll = 'slc.dll' +} else { + $WsppHook = 0 } if ($OsppHook -NE 0) { - try {sasv $offsvc -EA 1} catch {} - $ospp15 = DetectID $oslp $o15App - $ospp14 = DetectID $oslp $o14App + $OLdll = (strGetRegistry $OPKeyPath "Path") + 'osppc.dll' + if (!(Test-Path "$OLdll")) {$OsppHook = 0} } -if ($cW1nd0ws) +if ($WsppHook -NE 0) { + if ($NT6 -And -Not $NT7 -And -Not $Admin) { + if ($null -EQ [Diagnostics.Process]::GetProcessesByName("$winsvc")[0].ProcessName) {$WsppHook = 0; CONOUT "`nError: failed to start $winsvc Service.`n"} + } else { + try {sasv $winsvc -EA 1} catch {$WsppHook = 0; CONOUT "`nError: failed to start $winsvc Service.`n"} + } +} + +if ($WsppHook -NE 0) { + . InitializePInvoke $SLdll $false + $hSLC = 0 + [void]$Win32::SLOpen([ref]$hSLC) + + $cW1nd0ws = SlGetInfoSLID $winApp + $c0ff1ce15 = SlGetInfoSLID $o15App + $c0ff1ce14 = SlGetInfoSLID $o14App +} + +if ($cW1nd0ws.Count -GT 0) { echoWindows - GetID $wslp $winApp | foreach -EA 1 { - GetResult $wslp $wsls $_ - CONOUT "$line3" - & $noAll - } + ParseList $wslp $winApp $cW1nd0ws } elseif ($NT6) { echoWindows - CONOUT "`nError: product key not found." + CONOUT "Error: product key not found.`n" } -if ($winbuild -GE 9200) { - . InitializePInvoke +if ($NT6 -And -Not $NT8) { + ClcRun +} + +if ($NT8) { ClicRun } -if ($c0ff1ce15 -Or $ospp15) { - CheckOhook -} - $doMSG = 1 -if ($c0ff1ce15) +if ($c0ff1ce15.Count -GT 0) { + CheckOhook echoOffice - GetID $wslp $o15App | foreach -EA 1 { - GetResult $wslp $wsls $_ - CONOUT "$line3" - & $noAll - } + ParseList $wslp $o15App $c0ff1ce15 } -if ($c0ff1ce14) +if ($c0ff1ce14.Count -GT 0) { echoOffice - GetID $wslp $o14App | foreach -EA 1 { - GetResult $wslp $wsls $_ - CONOUT "$line3" - & $noAll - } + ParseList $wslp $o14App $c0ff1ce14 } -if ($ospp15) -{ - echoOffice - GetID $oslp $o15App | foreach -EA 1 { - GetResult $oslp $osls $_ - CONOUT "$line3" - & $noAll - } +if ($hSLC) { + [void]$Win32::SLClose($hSLC) } -if ($ospp14) +if ($OsppHook -NE 0) { + try {sasv $offsvc -EA 1} catch {$OsppHook = 0; CONOUT "`nError: failed to start $offsvc Service.`n"} +} + +if ($OsppHook -NE 0) { + . InitializePInvoke "$OLdll" $true + $hSLC = 0 + [void]$Win32::SLOpen([ref]$hSLC) + + $ospp15 = SlGetInfoSLID $o15App + $ospp14 = SlGetInfoSLID $o14App +} + +if ($ospp15.Count -GT 0) { echoOffice - GetID $oslp $o14App | foreach -EA 1 { - GetResult $oslp $osls $_ - CONOUT "$line3" - & $noAll - } + ParseList $oslp $o15App $ospp15 +} + +if ($ospp14.Count -GT 0) +{ + echoOffice + ParseList $oslp $o14App $ospp14 +} + +if ($hSLC) { + [void]$Win32::SLClose($hSLC) } if ($NT7) { diff --git a/MAS/Separate-Files-Version/Check_Activation_Status.cmd b/MAS/Separate-Files-Version/Check_Activation_Status.cmd index f15f36e..fd72a3f 100644 --- a/MAS/Separate-Files-Version/Check_Activation_Status.cmd +++ b/MAS/Separate-Files-Version/Check_Activation_Status.cmd @@ -118,6 +118,7 @@ $IID = $IID.IsPresent -Or $Dlv.IsPresent $NT6 = $winbuild -GE 6000 $NT7 = $winbuild -GE 7600 +$NT8 = $winbuild -GE 9200 $NT9 = $winbuild -GE 9600 $Admin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) @@ -193,55 +194,375 @@ function CheckOhook & $noAll } -#region WMI -function DetectID($strSLP, $strAppId) -{ - $ppk = (" AND PartialProductKey <> NULL)", ")")[$All.IsPresent] - $fltr = "SELECT ID FROM $strSLP WHERE (ApplicationID='$strAppId'" - $clause = $fltr + $ppk - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - return ($sWmi.Get().Count -GT 0) +#region SSSS +function BoolToWStr($bVal) { + ("TRUE", "FALSE")[!$bVal] } -function GetID($strSLP, $strAppId) -{ - $NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001) - $IDs = [Collections.ArrayList]@() - $isAdd = (" AND LicenseDependsOn <> NULL)", ")")[$NT5] - $noAdd = " AND LicenseDependsOn IS NULL)" - $query = "SELECT ID FROM $strSLP WHERE (ApplicationID='$strAppId' AND PartialProductKey" +function InitializePInvoke($LaDll, $bOffice) { + $Marshal = [System.Runtime.InteropServices.Marshal] + $Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly((Get-Random), 'Run').DefineDynamicModule((Get-Random), $False) + $SLApp = $NT7 -Or $bOffice -Or ($LaDll -EQ 'sppc.dll' -And [Diagnostics.FileVersionInfo]::GetVersionInfo("$SysPath\sppc.dll").FilePrivatePart -GE 16501) - if ($All.IsPresent) { - $fltr = $query + " IS NULL" - $clause = $fltr + $isAdd - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {} - if (-Not $NT5) { - $clause = $fltr + $noAdd - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {} + $Win32 = $null + $Class = $Module.DefineType((Get-Random), 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0) + $Class.DefinePInvokeMethod('SLClose', $LaDll, 22, 1, [Int32], @([IntPtr]), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLOpen', $LaDll, 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGenerateOfflineInstallationId', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetSLIDList', $LaDll, 22, 1, [Int32], @([IntPtr], [UInt32], [Guid].MakeByRefType(), [UInt32], [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetLicensingStatusInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [Guid].MakeByRefType(), [IntPtr], [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetPKeyInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetProductSkuInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetServiceInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + if ($SLApp) { + $Class.DefinePInvokeMethod('SLGetApplicationInformation', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + } + if ($bOffice) { + $Win32 = $Class.CreateType() + return + } + if ($NT6) { + $Class.DefinePInvokeMethod('SLGetWindowsInformation', 'slc.dll', 22, 1, [Int32], @([String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 22, 1, [Int32], @([String], [UInt32].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Class.DefinePInvokeMethod('SLIsGenuineLocal', 'slwga.dll', 22, 1, [Int32], @([Guid].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr]), 1, 3).SetImplementationFlags(128) + } + if ($NT7) { + $Class.DefinePInvokeMethod('SLIsWindowsGenuineLocal', 'slc.dll', 'Public, Static', 'Standard', [Int32], @([UInt32].MakeByRefType()), 'Winapi', 'Unicode').SetImplementationFlags('PreserveSig') + } + + if ($DllSubscription) { + $Class.DefinePInvokeMethod('ClipGetSubscriptionStatus', 'Clipc.dll', 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) + $Struct = $Class.DefineNestedType('SubStatus', 'NestedPublic, SequentialLayout, Sealed, BeforeFieldInit', [ValueType], 0) + [void]$Struct.DefineField('dwEnabled', [UInt32], 'Public') + [void]$Struct.DefineField('dwSku', [UInt32], 6) + [void]$Struct.DefineField('dwState', [UInt32], 6) + $SubStatus = $Struct.CreateType() + } + + $Win32 = $Class.CreateType() +} + +function SlGetInfoIID($SkuId) +{ + $bData = 0 + + if ($Win32::SLGenerateOfflineInstallationId( + $hSLC, + [ref][Guid]$SkuId, + [ref]$bData + )) + { + return $null + } + + $rData = $Marshal::PtrToStringUni($bData) + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoSku($SkuId, $Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetProductSkuInformation( + $hSLC, + [ref][Guid]$SkuId, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $null + } + + if ($tData -EQ 1) + { + $rData = $Marshal::PtrToStringUni($bData) + } + elseif ($tData -EQ 4) + { + $rData = $Marshal::ReadInt32($bData) + } + elseif ($tData -EQ 3 -And $cData -EQ 8) + { + $rData = $Marshal::ReadInt64($bData) + } + else + { + $rData = $null + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoService($Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetServiceInformation( + $hSLC, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $null + } + + if ($tData -EQ 1) + { + $rData = $Marshal::PtrToStringUni($bData) + } + elseif ($tData -EQ 4) + { + $rData = $Marshal::ReadInt32($bData) + } + elseif ($tData -EQ 3 -And $cData -EQ 8) + { + $rData = $Marshal::ReadInt64($bData) + } + else + { + $rData = $null + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoApp($AppId, $Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetApplicationInformation( + $hSLC, + [ref][Guid]$AppId, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $null + } + + if ($tData -EQ 1) + { + $rData = $Marshal::PtrToStringUni($bData) + } + elseif ($tData -EQ 4) + { + $rData = $Marshal::ReadInt32($bData) + } + elseif ($tData -EQ 3 -And $cData -EQ 8) + { + $rData = $Marshal::ReadInt64($bData) + } + else + { + $rData = $null + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoSvcApp($strApp, $Value) +{ + if ($SLApp) + { + $rData = SlGetInfoApp $strApp $Value + } + else + { + $rData = SlGetInfoService $Value + } + return $rData +} + +function SlGetInfoPKey($PkeyId, $Value) +{ + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetPKeyInformation( + $hSLC, + [ref][Guid]$PKeyId, + $Value, + [ref]$null, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $null + } + + $rData = $Marshal::PtrToStringUni($bData) + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoLicensing($AppId, $SkuId) +{ + $LicenseStatus = 0 + $GracePeriodRemaining = 0 + $hrReason = 0 + $EvaluationEndDate = 0 + + $cStatus = 0 + $pStatus = 0 + + $ret = $Win32::SLGetLicensingStatusInformation( + $hSLC, + [ref][Guid]$AppId, + [ref][Guid]$SkuId, + 0, + [ref]$cStatus, + [ref]$pStatus + ) + + if ($ret -Or !$cStatus) + { + return + } + + [IntPtr]$ppStatus = [Int64]$pStatus + [Int64]40 * ($cStatus - 1) + $eStatus = $Marshal::ReadInt32($ppStatus, 16) + $GracePeriodRemaining = $Marshal::ReadInt32($ppStatus, 20) + $hrReason = $Marshal::ReadInt32($ppStatus, 28) + $EvaluationEndDate = $Marshal::ReadInt64($ppStatus, 32) + + if ($eStatus -EQ 3) + { + $eStatus = 5 + } + if ($eStatus -EQ 2) + { + if ($hrReason -EQ 0x4004F00D) + { + $eStatus = 3 + } + elseif ($hrReason -EQ 0x4004F065) + { + $eStatus = 4 + } + elseif ($hrReason -EQ 0x4004FC06) + { + $eStatus = 6 } } + $LicenseStatus = $eStatus - $fltr = $query + " <> NULL" - $clause = $fltr + $isAdd - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {} - if (-Not $NT5) { - $clause = $fltr + $noAdd - $sWmi = [wmisearcher]$clause - $sWmi.Options.Rewindable = $false - try {$sWmi.Get() | select -Expand Properties -EA 0 | foreach {$IDs += $_.Value}} catch {} + $Marshal::FreeHGlobal($pStatus) + return +} + +function SlCheckInfo($SkuId, $Value) +{ + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetProductSkuInformation( + $hSLC, + [ref][Guid]$SkuId, + $Value, + [ref]$null, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData) + { + return $false } - return $IDs + if ($Value -EQ "pkeyId") + { + $rData = $Marshal::PtrToStringUni($bData) + } + else + { + $rData = $true + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function SlGetInfoSLID($AppId) +{ + $cReturnIds = 0 + $pReturnIds = 0 + + $ret = $Win32::SLGetSLIDList( + $hSLC, + 0, + [ref][Guid]$AppId, + 1, + [ref]$cReturnIds, + [ref]$pReturnIds + ) + + if ($ret -Or !$cReturnIds) + { + return + } + + $a1List = @() + $a2List = @() + $a3List = @() + $a4List = @() + + foreach ($i in 0..($cReturnIds - 1)) + { + $bytes = New-Object byte[] 16 + $Marshal::Copy([Int64]$pReturnIds + [Int64]16 * $i, $bytes, 0, 16) + $actid = ([Guid]$bytes).Guid + $gPPK = SlCheckInfo $actid "pkeyId" + $gAdd = SlCheckInfo $actid "DependsOn" + if ($All.IsPresent) { + if (!$gPPK -And $gAdd) { $a1List += @{id = $actid; pk = $null; ex = $true} } + if (!$gPPK -And !$gAdd) { $a2List += @{id = $actid; pk = $null; ex = $false} } + } + if ($gPPK -And $gAdd) { $a3List += @{id = $actid; pk = $gPPK; ex = $true} } + if ($gPPK -And !$gAdd) { $a4List += @{id = $actid; pk = $gPPK; ex = $false} } + } + + $Marshal::FreeHGlobal($pReturnIds) + return ($a1List + $a2List + $a3List + $a4List) } function DetectSubscription { + try + { + $objSvc = New-Object PSObject + $wmiSvc = [wmisearcher]"SELECT SubscriptionType, SubscriptionStatus, SubscriptionEdition, SubscriptionExpiry FROM SoftwareLicensingService" + $wmiSvc.Options.Rewindable = $false + $wmiSvc.Get() | select -Expand Properties -EA 0 | foreach { $objSvc | Add-Member 8 $_.Name $_.Value } + $wmiSvc.Dispose() + } + catch + { + return + } + if ($null -EQ $objSvc.SubscriptionType -Or $objSvc.SubscriptionType -EQ 120) { return } @@ -273,161 +594,188 @@ function DetectSubscription { } CONOUT "`nSubscription information:" - CONOUT " Edition: $SubMsgEdition" CONOUT " Type : $SubMsgType" CONOUT " Status : $SubMsgStatus" + CONOUT " Edition: $SubMsgEdition" CONOUT " Expiry : $SubMsgExpiry" } function DetectAdbaClient { + $propADBA | foreach { set $_ (SlGetInfoSku $ID $_) } CONOUT "`nAD Activation client information:" CONOUT " Object Name: $ADActivationObjectName" CONOUT " Domain Name: $ADActivationObjectDN" - CONOUT " CSVLK Extended PID: $ADActivationCsvlkPid" - CONOUT " CSVLK Activation ID: $ADActivationCsvlkSkuId" + CONOUT " CSVLK Extended PID: $ADActivationCsvlkPID" + CONOUT " CSVLK Activation ID: $ADActivationCsvlkSkuID" } function DetectAvmClient { + $propAVMA | foreach { set $_ (SlGetInfoSku $ID $_) } CONOUT "`nAutomatic VM Activation client information:" - if (-Not [String]::IsNullOrEmpty($IAID)) { - CONOUT " Guest IAID: $IAID" + if (-Not [String]::IsNullOrEmpty($InheritedActivationId)) { + CONOUT " Guest IAID: $InheritedActivationId" } else { CONOUT " Guest IAID: Not Available" } - if (-Not [String]::IsNullOrEmpty($AutomaticVMActivationHostMachineName)) { - CONOUT " Host machine name: $AutomaticVMActivationHostMachineName" + if (-Not [String]::IsNullOrEmpty($InheritedActivationHostMachineName)) { + CONOUT " Host machine name: $InheritedActivationHostMachineName" } else { CONOUT " Host machine name: Not Available" } - if ($AutomaticVMActivationLastActivationTime.Substring(0,4) -NE "1601") { - $EED = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($AutomaticVMActivationLastActivationTime),$null,48).ToString('yyyy-MM-dd hh:mm:ss tt') - CONOUT " Activation time: $EED UTC" - } else { - CONOUT " Activation time: Not Available" - } - if (-Not [String]::IsNullOrEmpty($AutomaticVMActivationHostDigitalPid2)) { - CONOUT " Host Digital PID2: $AutomaticVMActivationHostDigitalPid2" + if (-Not [String]::IsNullOrEmpty($InheritedActivationHostDigitalPid2)) { + CONOUT " Host Digital PID2: $InheritedActivationHostDigitalPid2" } else { CONOUT " Host Digital PID2: Not Available" } + if ($InheritedActivationActivationTime) { + $IAAT = [DateTime]::FromFileTime($InheritedActivationActivationTime).ToString('yyyy-MM-dd hh:mm:ss tt') + CONOUT " Activation time: $IAAT" + } else { + CONOUT " Activation time: Not Available" + } } function DetectKmsHost { + $IsKeyManagementService = SlGetInfoSvcApp $strApp 'IsKeyManagementService' + if (-Not $IsKeyManagementService) { + return + } + if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} + if ($Vista -Or $NT5) { - $KeyManagementServiceListeningPort = strGetRegistry $SLKeyPath "KeyManagementServiceListeningPort" - $KeyManagementServiceDnsPublishing = strGetRegistry $SLKeyPath "DisableDnsPublishing" - $KeyManagementServiceLowPriority = strGetRegistry $SLKeyPath "EnableKmsLowPriority" - if (-Not $KeyManagementServiceDnsPublishing) {$KeyManagementServiceDnsPublishing = "TRUE"} - if (-Not $KeyManagementServiceLowPriority) {$KeyManagementServiceLowPriority = "FALSE"} + $regk = $SLKeyPath + } elseif ($strSLP -EQ $oslp) { + $regk = $OPKeyPath } else { - $KeyManagementServiceListeningPort = $objSvc.KeyManagementServiceListeningPort - $KeyManagementServiceDnsPublishing = $objSvc.KeyManagementServiceDnsPublishing - $KeyManagementServiceLowPriority = $objSvc.KeyManagementServiceLowPriority + $regk = $SPKeyPath + } + $KMSListening = strGetRegistry $regk "KeyManagementServiceListeningPort" + $KMSPublishing = strGetRegistry $regk "DisableDnsPublishing" + $KMSPriority = strGetRegistry $regk "EnableKmsLowPriority" + + if (-Not $KMSListening) {$KMSListening = 1688} + if (-Not $KMSPublishing) {$KMSPublishing = "TRUE"} else {$KMSPublishing = BoolToWStr (!$KMSPublishing)} + if (-Not $KMSPriority) {$KMSPriority = "FALSE"} else {$KMSPriority = BoolToWStr $KMSPriority} + + if ($KMSPublishing -EQ "TRUE") {$KMSPublishing = "Enabled"} else {$KMSPublishing = "Disabled"} + if ($KMSPriority -EQ "TRUE") {$KMSPriority = "Low"} else {$KMSPriority = "Normal"} + + if ($SLApp) + { + $propKMSServer | foreach { set $_ (SlGetInfoApp $strApp $_) } + } + else + { + $propKMSServer | foreach { set $_ (SlGetInfoService $_) } } - if (-Not $KeyManagementServiceListeningPort) {$KeyManagementServiceListeningPort = 1688} - if ($KeyManagementServiceDnsPublishing -EQ "TRUE") { - $KeyManagementServiceDnsPublishing = "Enabled" - } else { - $KeyManagementServiceDnsPublishing = "Disabled" - } - if ($KeyManagementServiceLowPriority -EQ "TRUE") { - $KeyManagementServiceLowPriority = "Low" - } else { - $KeyManagementServiceLowPriority = "Normal" - } + $KMSRequests = $KeyManagementServiceTotalRequests + $NoRequests = ($null -EQ $KMSRequests) -Or ($KMSRequests -EQ -1) -Or ($KMSRequests -EQ 4294967295) CONOUT "`nKey Management Service host information:" CONOUT " Current count: $KeyManagementServiceCurrentCount" - CONOUT " Listening on Port: $KeyManagementServiceListeningPort" - CONOUT " DNS publishing: $KeyManagementServiceDnsPublishing" - CONOUT " KMS priority: $KeyManagementServiceLowPriority" - if (-Not [String]::IsNullOrEmpty($KeyManagementServiceTotalRequests)) { - CONOUT "`nKey Management Service cumulative requests received from clients:" - CONOUT " Total: $KeyManagementServiceTotalRequests" - CONOUT " Failed: $KeyManagementServiceFailedRequests" - CONOUT " Unlicensed: $KeyManagementServiceUnlicensedRequests" - CONOUT " Licensed: $KeyManagementServiceLicensedRequests" - CONOUT " Initial grace period: $KeyManagementServiceOOBGraceRequests" - CONOUT " Expired or Hardware out of tolerance: $KeyManagementServiceOOTGraceRequests" - CONOUT " Non-genuine grace period: $KeyManagementServiceNonGenuineGraceRequests" - if ($null -NE $KeyManagementServiceNotificationRequests) {CONOUT " Notification: $KeyManagementServiceNotificationRequests"} + CONOUT " Listening on Port: $KMSListening" + CONOUT " DNS publishing: $KMSPublishing" + CONOUT " KMS priority: $KMSPriority" + if ($NoRequests) { + return } + CONOUT "`nKey Management Service cumulative requests received from clients:" + CONOUT " Total: $KeyManagementServiceTotalRequests" + CONOUT " Failed: $KeyManagementServiceFailedRequests" + CONOUT " Unlicensed: $KeyManagementServiceUnlicensedRequests" + CONOUT " Licensed: $KeyManagementServiceLicensedRequests" + CONOUT " Initial grace period: $KeyManagementServiceOOBGraceRequests" + CONOUT " Expired or Hardware out of tolerance: $KeyManagementServiceOOTGraceRequests" + CONOUT " Non-genuine grace period: $KeyManagementServiceNonGenuineGraceRequests" + if ($null -NE $KeyManagementServiceNotificationRequests) {CONOUT " Notification: $KeyManagementServiceNotificationRequests"} } function DetectKmsClient { - if ($null -NE $VLActivationTypeEnabled) {CONOUT "Configured Activation Type: $($VLActTypes[$VLActivationTypeEnabled])"} + if ($strSLP -EQ $wslp -And $NT8) + { + $VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $ID) "VLActivationType" + if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath + '\' + $strApp) "VLActivationType"} + if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath) "VLActivationType"} + if ($null -EQ $VLType -Or $VLType -GT 3) {$VLType = 0} + } + if ($null -NE $VLType) {CONOUT "Configured Activation Type: $($VLActTypes[$VLType])"} + CONOUT "`r" if ($LicenseStatus -NE 1) { CONOUT "Please activate the product in order to update KMS client information values." return } - if ($Vista) { - $KeyManagementServicePort = strGetRegistry $SLKeyPath "KeyManagementServicePort" - $DiscoveredKeyManagementServiceMachineName = strGetRegistry $NSKeyPath "DiscoveredKeyManagementServiceName" - $DiscoveredKeyManagementServiceMachinePort = strGetRegistry $NSKeyPath "DiscoveredKeyManagementServicePort" + if ($NT7 -Or $strSLP -EQ $oslp) { + $propKMSClient | foreach { set $_ (SlGetInfoSku $ID $_) } + if ($strSLP -EQ $oslp) {$regk = $OPKeyPath} else {$regk = $SPKeyPath} + $KMSCaching = strGetRegistry $regk "DisableKeyManagementServiceHostCaching" + if (-Not $KMSCaching) {$KMSCaching = "TRUE"} else {$KMSCaching = BoolToWStr (!$KMSCaching)} } - if ([String]::IsNullOrEmpty($KeyManagementServiceMachine)) { + "ClientMachineID" | foreach { set $_ (SlGetInfoService $_) } + + if ($Vista) { + $propKMSVista | foreach { set $_ (SlGetInfoService $_) } + $KeyManagementServicePort = strGetRegistry $SLKeyPath "KeyManagementServicePort" + $DiscoveredKeyManagementServiceName = strGetRegistry $NSKeyPath "DiscoveredKeyManagementServiceName" + $DiscoveredKeyManagementServicePort = strGetRegistry $NSKeyPath "DiscoveredKeyManagementServicePort" + } + + if ([String]::IsNullOrEmpty($KeyManagementServiceName)) { $KmsReg = $null } else { if (-Not $KeyManagementServicePort) {$KeyManagementServicePort = 1688} - $KmsReg = "Registered KMS machine name: ${KeyManagementServiceMachine}:${KeyManagementServicePort}" + $KmsReg = "Registered KMS machine name: ${KeyManagementServiceName}:${KeyManagementServicePort}" } - if ([String]::IsNullOrEmpty($DiscoveredKeyManagementServiceMachineName)) { + if ([String]::IsNullOrEmpty($DiscoveredKeyManagementServiceName)) { $KmsDns = "DNS auto-discovery: KMS name not available" if ($Vista -And -Not $Admin) {$KmsDns = "DNS auto-discovery: Run the script as administrator to retrieve info"} } else { - if (-Not $DiscoveredKeyManagementServiceMachinePort) {$DiscoveredKeyManagementServiceMachinePort = 1688} - $KmsDns = "KMS machine name from DNS: ${DiscoveredKeyManagementServiceMachineName}:${DiscoveredKeyManagementServiceMachinePort}" + if (-Not $DiscoveredKeyManagementServicePort) {$DiscoveredKeyManagementServicePort = 1688} + $KmsDns = "KMS machine name from DNS: ${DiscoveredKeyManagementServiceName}:${DiscoveredKeyManagementServicePort}" } - if ($null -NE $objSvc.KeyManagementServiceHostCaching) { - if ($objSvc.KeyManagementServiceHostCaching -EQ "TRUE") { - $KeyManagementServiceHostCaching = "Enabled" - } else { - $KeyManagementServiceHostCaching = "Disabled" + if ($null -NE $KMSCaching) { + if ($KMSCaching -EQ "TRUE") {$KMSCaching = "Enabled"} else {$KMSCaching = "Disabled"} + } + + if ($strSLP -EQ $wslp -And $NT9) { + if ([String]::IsNullOrEmpty($DiscoveredKeyManagementServiceIpAddress)) { + $DiscoveredKeyManagementServiceIpAddress = "not available" } } CONOUT "Key Management Service client information:" - CONOUT " Client Machine ID (CMID): $($objSvc.ClientMachineID)" + CONOUT " Client Machine ID (CMID): $ClientMachineID" if ($null -EQ $KmsReg) { CONOUT " $KmsDns" CONOUT " Registered KMS machine name: KMS name not available" } else { CONOUT " $KmsReg" } - if ($null -NE $DiscoveredKeyManagementServiceMachineIpAddress) {CONOUT " KMS machine IP address: $DiscoveredKeyManagementServiceMachineIpAddress"} - CONOUT " KMS machine extended PID: $KeyManagementServiceProductKeyID" + if ($null -NE $DiscoveredKeyManagementServiceIpAddress) {CONOUT " KMS machine IP address: $DiscoveredKeyManagementServiceIpAddress"} + CONOUT " KMS machine extended PID: $CustomerPID" CONOUT " Activation interval: $VLActivationInterval minutes" CONOUT " Renewal interval: $VLRenewalInterval minutes" - if ($null -NE $KeyManagementServiceHostCaching) {CONOUT " KMS host caching: $KeyManagementServiceHostCaching"} + if ($null -NE $KMSCaching) {CONOUT " KMS host caching: $KMSCaching"} if (-Not [String]::IsNullOrEmpty($KeyManagementServiceLookupDomain)) {CONOUT " KMS SRV record lookup domain: $KeyManagementServiceLookupDomain"} } -function GetResult($strSLP, $strSLS, $strID) +function GetResult($strSLP, $strApp, $entry) { - try - { - $objPrd = [wmisearcher]"SELECT * FROM $strSLP WHERE ID='$strID'" - $objPrd.Options.Rewindable = $false - $objPrd.Get() | select -Expand Properties -EA 0 | foreach { if (-Not [String]::IsNullOrEmpty($_.Value)) {set $_.Name $_.Value} } - $objPrd.Dispose() - } - catch - { - return - } + $ID = $entry.id + $propPrd | foreach { set $_ (SlGetInfoSku $ID $_) } + . SlGetInfoLicensing $strApp $ID - $winID = ($ApplicationID -EQ $winApp) - $winPR = ($winID -And -Not $LicenseIsAddon) + $winID = ($strApp -EQ $winApp) + $winPR = ($winID -And -Not $entry.ex) $Vista = ($winID -And $NT6 -And -Not $NT7) $NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001) $reapp = ("Windows", "App")[!$winID] @@ -437,16 +785,15 @@ function GetResult($strSLP, $strSLS, $strID) if ($Description | Select-String "TIMEBASED_") {$cTblClient = 1; $_mTag = "Timebased"} if ($Description | Select-String "VIRTUAL_MACHINE_ACTIVATION") {$cAvmClient = 1; $_mTag = "Automatic VM"} if ($null -EQ $cKmsClient) { - if ($Description | Select-String "VOLUME_KMS") {$cKmsHost = 1} + if ($Description | Select-String "VOLUME_KMS") {$cKmsServer = 1} } $_gpr = [Math]::Round($GracePeriodRemaining/1440) if ($_gpr -GT 0) { - $_xpr = [DateTime]::Now.addMinutes($GracePeriodRemaining).ToString('yyyy-MM-dd hh:mm:ss tt') + $_xpr = [DateTime]::Now.AddMinutes($GracePeriodRemaining).ToString('yyyy-MM-dd hh:mm:ss tt') } - if ($null -EQ $LicenseStatusReason) {$LicenseStatusReason = -1} - $LicenseReason = '0x{0:X}' -f $LicenseStatusReason + $LicenseReason = '0x{0:X}' -f $hrReason $LicenseMsg = "Time remaining: $GracePeriodRemaining minute(s) ($_gpr day(s))" if ($LicenseStatus -EQ 0) { $LicenseInf = "Unlicensed" @@ -454,8 +801,8 @@ function GetResult($strSLP, $strSLS, $strID) } if ($LicenseStatus -EQ 1) { $LicenseInf = "Licensed" - $LicenseMsg = $null if ($GracePeriodRemaining -EQ 0) { + $LicenseMsg = $null $ExpireMsg = "The $prmnt is permanently activated." } else { $LicenseMsg = "$_mTag activation expiration: $GracePeriodRemaining minute(s) ($_gpr day(s))" @@ -490,24 +837,54 @@ function GetResult($strSLP, $strSLS, $strID) if ($null -NE $_xpr) {$ExpireMsg = "Extended grace period ends $_xpr"} } - if ($winPR -And $PartialProductKey -And -Not $NT9) { - $dp4 = strGetRegistry "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "DigitalProductId4" - if ($null -NE $dp4) { - $ProductKeyChannel = ([System.Text.Encoding]::Unicode.GetString($dp4, 1016, 128)).Trim([char]$null) + $pkid = $entry.pk + if ($null -NE $pkid) { + $propPkey | foreach { set $_ (SlGetInfoPKey $pkid $_) } + } + + if ($winPR -And $null -NE $PartialProductKey -And -Not $NT8) { + $uxd = SlGetInfoSku $ID 'UXDifferentiator' + $script:primary += @{ + aid = $ID; + ppk = $PartialProductKey; + chn = $Channel; + lst = $LicenseStatus; + lcr = $hrReason; + ged = $GracePeriodRemaining; + evl = $EvaluationEndDate; + dff = $uxd } } - if ($winPR -And $Dlv -And $NT7 -And $null -EQ $RemainingAppReArmCount) { - try + if ($IID -And $null -NE $PartialProductKey) { + $OfflineInstallationId = SlGetInfoIID $ID + } + + if ($Dlv) { + if ($strSLP -EQ $wslp -And $NT8) { - $tmp = [wmisearcher]"SELECT RemainingWindowsReArmCount FROM $strSLS" - $tmp.Options.Rewindable = $false - $tmp.Get() | select -Expand Properties -EA 0 | foreach {set $_.Name $_.Value} - $tmp.Dispose() + $RemainingSkuReArmCount = SlGetInfoSku $ID 'RemainingRearmCount' + $RemainingAppReArmCount = SlGetInfoApp $strApp 'RemainingRearmCount' } - catch + else { + if (($winID -And $NT7) -Or $strSLP -EQ $oslp) + { + $RemainingSLReArmCount = SlGetInfoApp $strApp 'RemainingRearmCount' + } + else + { + $RemainingSLReArmCount = SlGetInfoService 'RearmCount' + } } + if ($null -EQ $TrustedTime) + { + $TrustedTime = SlGetInfoSvcApp $strApp 'TrustedTime' + } + } + + if ($Dlv -Or $All.IsPresent) { + $gPHN = SlCheckInfo $ID "msft:sl/EUL/PHONE/PUBLIC" } $add_on = $Name.IndexOf("add-on for", 5) @@ -516,73 +893,56 @@ function GetResult($strSLP, $strSLS, $strID) if ($add_on -EQ -1) {CONOUT "Name: $Name"} else {CONOUT "Name: $($Name.Substring(0, $add_on + 7))"} CONOUT "Description: $Description" CONOUT "Activation ID: $ID" - if ($null -NE $ProductKeyID) {CONOUT "Extended PID: $ProductKeyID"} - if ($null -NE $ProductKeyID2 -And $Dlv) {CONOUT "Product ID: $ProductKeyID2"} + if ($null -NE $DigitalPID) {CONOUT "Extended PID: $DigitalPID"} + if ($null -NE $DigitalPID2 -And $Dlv) {CONOUT "Product ID: $DigitalPID2"} if ($null -NE $OfflineInstallationId -And $IID) {CONOUT "Installation ID: $OfflineInstallationId"} - if ($null -NE $ProductKeyChannel) {CONOUT "Product Key Channel: $ProductKeyChannel"} + if ($null -NE $Channel) {CONOUT "Product Key Channel: $Channel"} if ($null -NE $PartialProductKey) {CONOUT "Partial Product Key: $PartialProductKey"} CONOUT "License Status: $LicenseInf" if ($null -NE $LicenseMsg) {CONOUT "$LicenseMsg"} - if ($LicenseStatus -NE 0 -And $EvaluationEndDate.Substring(0,4) -NE "1601") { - $EED = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($EvaluationEndDate),$null,48).ToString('yyyy-MM-dd hh:mm:ss tt') + if ($LicenseStatus -NE 0 -And $EvaluationEndDate) { + $EED = [DateTime]::FromFileTimeUtc($EvaluationEndDate).ToString('yyyy-MM-dd hh:mm:ss tt') CONOUT "Evaluation End Date: $EED UTC" } + if ($LicenseStatus -NE 1 -And $null -NE $gPHN) { + $gPHN = $gPHN.ToString() + CONOUT "Phone activatable: $gPHN" + } if ($Dlv) { - if ($null -NE $RemainingWindowsReArmCount) { - CONOUT "Remaining Windows rearm count: $RemainingWindowsReArmCount" + if ($null -NE $RemainingSLReArmCount) { + CONOUT "Remaining $reapp rearm count: $RemainingSLReArmCount" } - if ($null -NE $RemainingSkuReArmCount -And $RemainingSkuReArmCount -NE 4294967295) { + if ($null -NE $RemainingSkuReArmCount) { CONOUT "Remaining $reapp rearm count: $RemainingAppReArmCount" CONOUT "Remaining SKU rearm count: $RemainingSkuReArmCount" } - if ($null -NE $TrustedTime -And $LicenseStatus -NE 0) { - $TTD = [DateTime]::Parse([Management.ManagementDateTimeConverter]::ToDateTime($TrustedTime),$null,32).ToString('yyyy-MM-dd hh:mm:ss tt') + if ($LicenseStatus -NE 0 -And $TrustedTime) { + $TTD = [DateTime]::FromFileTime($TrustedTime).ToString('yyyy-MM-dd hh:mm:ss tt') CONOUT "Trusted time: $TTD" } } - if ($LicenseStatus -EQ 0) { + if ($null -EQ $PartialProductKey) { return } - if ($strSLP -EQ $wslp -And $null -NE $PartialProductKey -And $null -NE $ADActivationObjectName -And $VLActivationType -EQ 1) { + if ($strSLP -EQ $wslp -And $NT8 -And $VLActivationType -EQ 1) { DetectAdbaClient } - if ($winID -And $null -NE $cAvmClient -And $null -NE $PartialProductKey) { + if ($winID -And $null -NE $cAvmClient) { DetectAvmClient } $chkSub = ($winPR -And $cSub) - $chkSLS = ($null -NE $PartialProductKey) -And ($null -NE $cKmsClient -Or $null -NE $cKmsHost -Or $chkSub) + $chkSLS = ($null -NE $cKmsClient -Or $null -NE $cKmsServer -Or $chkSub) if (!$chkSLS) { if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} return } - try - { - $objSvc = New-Object PSObject - $wmiSvc = [wmisearcher]"SELECT * FROM $strSLS" - $wmiSvc.Options.Rewindable = $false - $wmiSvc.Get() | select -Expand Properties -EA 0 | foreach { if (-Not [String]::IsNullOrEmpty($_.Value)) {$objSvc | Add-Member 8 $_.Name $_.Value} } - $wmiSvc.Dispose() - if ($null -EQ $IsKeyManagementServiceMachine) {$objSvc.PSObject.Properties | foreach {set $_.Name $_.Value}} - } - catch - { - return - } - - if ($strSLS -EQ $wsls -And $NT9) { - if ([String]::IsNullOrEmpty($DiscoveredKeyManagementServiceMachineIpAddress)) { - $DiscoveredKeyManagementServiceMachineIpAddress = "not available" - } - } - - if ($null -NE $cKmsHost -And $IsKeyManagementServiceMachine -GT 0) { - if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} + if ($null -NE $cKmsServer) { DetectKmsHost } @@ -590,7 +950,7 @@ function GetResult($strSLP, $strSLS, $strID) DetectKmsClient } - if ($null -EQ $cKmsHost) { + if ($null -EQ $cKmsServer) { if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} } @@ -599,6 +959,16 @@ function GetResult($strSLP, $strSLS, $strID) } } + +function ParseList($strSLP, $strApp, $arrList) +{ + foreach ($entry in $arrList) + { + GetResult $strSLP $strApp $entry + CONOUT "$line3" + & $noAll + } +} #endregion #region vNextDiag @@ -817,31 +1187,6 @@ 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. #> -function BoolToWStr($bVal) { - ("TRUE", "FALSE")[!$bVal] -} - -function InitializePInvoke { - $Marshal = [System.Runtime.InteropServices.Marshal] - $Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly((Get-Random), 'Run').DefineDynamicModule((Get-Random)) - - $Class = $Module.DefineType('NativeMethods', 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0) - $Class.DefinePInvokeMethod('SLIsWindowsGenuineLocal', 'slc.dll', 'Public, Static', 'Standard', [Int32], @([UInt32].MakeByRefType()), 'Winapi', 'Unicode').SetImplementationFlags('PreserveSig') - $Class.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 22, 1, [Int32], @([String], [UInt32].MakeByRefType()), 1, 3).SetImplementationFlags(128) - $Class.DefinePInvokeMethod('SLGetWindowsInformation', 'slc.dll', 22, 1, [Int32], @([String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) - - if ($DllSubscription) { - $Class.DefinePInvokeMethod('ClipGetSubscriptionStatus', 'Clipc.dll', 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) - $Struct = $Class.DefineNestedType('SubStatus', 'NestedPublic, SequentialLayout, Sealed, BeforeFieldInit', [ValueType], 0) - [void]$Struct.DefineField('dwEnabled', [UInt32], 'Public') - [void]$Struct.DefineField('dwSku', [UInt32], 6) - [void]$Struct.DefineField('dwState', [UInt32], 6) - $SubStatus = $Struct.CreateType() - } - - $Win32 = $Class.CreateType() -} - function InitializeDigitalLicenseCheck { $CAB = [System.Reflection.Emit.CustomAttributeBuilder] @@ -896,36 +1241,29 @@ function PrintLastActivationHResult { } function PrintLastActivationTime { - $pdwLastTime = 0 + $pqwLastTime = 0 $cbSize = 0 if ($Win32::SLGetWindowsInformation( "Security-SPP-LastWindowsActivationTime", [ref]$null, [ref]$cbSize, - [ref]$pdwLastTime + [ref]$pqwLastTime )) { return $FALSE } - $actTime = $Marshal::ReadInt64($pdwLastTime) + $actTime = $Marshal::ReadInt64($pqwLastTime) if ($actTime -ne 0) { CONOUT (" LastActivationTime={0}" -f [DateTime]::FromFileTimeUtc($actTime).ToString("yyyy/MM/dd:HH:mm:ss")) } - $Marshal::FreeHGlobal($pdwLastTime) + $Marshal::FreeHGlobal($pqwLastTime) return $TRUE } function PrintIsWindowsGenuine { $dwGenuine = 0 - $ppwszGenuineStates = @( - "SL_GEN_STATE_IS_GENUINE", - "SL_GEN_STATE_INVALID_LICENSE", - "SL_GEN_STATE_TAMPERED", - "SL_GEN_STATE_OFFLINE", - "SL_GEN_STATE_LAST" - ) if ($Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine)) { return $FALSE @@ -1022,6 +1360,126 @@ function ClicRun } #endregion +#region clc +function clcGetExpireKrn +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $ret = $Win32::SLGetWindowsInformation( + "Kernel-ExpirationDate", + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + if ($ret -Or !$cData -Or $tData -NE 3) + { + return $null + } + + $year = $Marshal::ReadInt16($bData, 0) + if ($year -EQ 0 -Or $year -EQ 1601) + { + $rData = $null + } + else + { + $rData = '{0}/{1}/{2}:{3}:{4}:{5}' -f $year, $Marshal::ReadInt16($bData, 2), $Marshal::ReadInt16($bData, 4), $Marshal::ReadInt16($bData, 6), $Marshal::ReadInt16($bData, 8), $Marshal::ReadInt16($bData, 10) + } + + $Marshal::FreeHGlobal($bData) + return $rData +} + +function clcGetExpireSys +{ + $kuser = $Marshal::ReadInt64((New-Object IntPtr(0x7FFE02C8))) + + if ($kuser -EQ 0) + { + return $null + } + + $rData = [DateTime]::FromFileTimeUTC($kuser).ToString('yyyy/MM/dd:HH:mm:ss') + return $rData +} + +function clcGetLicensingState($dwState) +{ + if ($dwState -EQ 5) { + $dwState = 3 + } elseif ($dwState -EQ 3 -Or $dwState -EQ 4 -Or $dwState -EQ 6) { + $dwState = 2 + } elseif ($dwState -GT 6) { + $dwState = 4 + } + + $rData = '{0}' -f $ppwszLicensingStates[$dwState] + return $rData +} + +function clcGetGenuineState($AppId) +{ + $dwGenuine = 0 + + if ($NT7) { + $ret = $Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine) + } else { + $ret = $Win32::SLIsGenuineLocal([ref][Guid]$AppId, [ref]$dwGenuine, 0) + } + + if ($ret) + { + $dwGenuine = 4 + } + + if ($dwGenuine -LT 5) { + $rData = '{0}' -f $ppwszGenuineStates[$dwGenuine] + } else { + $rData = $dwGenuine + } + return $rData +} + +function ClcRun +{ + $prs = $script:primary[0] + if ($null -EQ $prs) { + return + } + + $lState = clcGetLicensingState $prs.lst + $uState = clcGetGenuineState $winApp + $TbbKrn = clcGetExpireKrn + $TbbSys = clcGetExpireSys + if ($null -NE $TbbKrn) { + $ked = $TbbKrn + } elseif ($null -NE $TbbSys) { + $ked = $TbbSys + } + + & $isAll + CONOUT "Client Licensing Check information:" + + CONOUT (" AppId={0}" -f $winApp) + if ($prs.ged) { CONOUT (" GraceEndDate={0}" -f ([DateTime]::UtcNow.AddMinutes($prs.ged).ToString('yyyy/MM/dd:HH:mm:ss'))) } + if ($null -NE $ked) { CONOUT (" KernelTimebombDate={0}" -f $ked) } + CONOUT (" LastConsumptionReason=0x{0:x8}" -f $prs.lcr) + if ($prs.evl) { CONOUT (" LicenseExpirationDate={0}" -f ([DateTime]::FromFileTimeUtc($prs.evl).ToString('yyyy/MM/dd:HH:mm:ss'))) } + CONOUT (" LicenseState={0}" -f $lState) + CONOUT (" PartialProductKey={0}" -f $prs.ppk) + CONOUT (" ProductKeyType={0}" -f $prs.chn) + CONOUT (" SkuId={0}" -f $prs.aid) + CONOUT (" uxDifferentiator={0}" -f $prs.dff) + CONOUT (" IsWindowsGenuine={0}" -f $uState) + + CONOUT "$line3" + & $noAll +} +#endregion + $Host.UI.RawUI.WindowTitle = "Check Activation Status" if ($All.IsPresent) { $B=$Host.UI.RawUI.BufferSize;$B.Height=3000;$Host.UI.RawUI.BufferSize=$B; @@ -1040,14 +1498,38 @@ $osls = "OfficeSoftwareProtectionService" $winApp = "55c92734-d682-4d71-983e-d6ec3f16059f" $o14App = "59a52881-a989-479d-af46-f275c6370663" $o15App = "0ff1ce15-a989-479d-af46-f275c6370663" -$cSub = ($winbuild -GE 19041) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType") +$cSub = ($winbuild -GE 26000) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType") $DllDigital = ($winbuild -GE 14393) -And (Test-Path "$SysPath\EditionUpgradeManagerObj.dll") $DllSubscription = ($winbuild -GE 14393) -And (Test-Path "$SysPath\Clipc.dll") $VLActTypes = @("All", "AD", "KMS", "Token") +$OPKeyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" +$SPKeyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" $SLKeyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" $NSKeyPath = "HKEY_USERS\S-1-5-20\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" +$propPrd = 'Name', 'Description', 'TrustedTime', 'VLActivationType' +$propPkey = 'PartialProductKey', 'Channel', 'DigitalPID', 'DigitalPID2' +$propKMSServer = 'KeyManagementServiceCurrentCount', 'KeyManagementServiceTotalRequests', 'KeyManagementServiceFailedRequests', 'KeyManagementServiceUnlicensedRequests', 'KeyManagementServiceLicensedRequests', 'KeyManagementServiceOOBGraceRequests', 'KeyManagementServiceOOTGraceRequests', 'KeyManagementServiceNonGenuineGraceRequests', 'KeyManagementServiceNotificationRequests' +$propKMSClient = 'CustomerPID', 'KeyManagementServiceName', 'KeyManagementServicePort', 'DiscoveredKeyManagementServiceName', 'DiscoveredKeyManagementServicePort', 'DiscoveredKeyManagementServiceIpAddress', 'VLActivationInterval', 'VLRenewalInterval', 'KeyManagementServiceLookupDomain' +$propKMSVista = 'CustomerPID', 'KeyManagementServiceName', 'VLActivationInterval', 'VLRenewalInterval' +$propADBA = 'ADActivationObjectName', 'ADActivationObjectDN', 'ADActivationCsvlkPID', 'ADActivationCsvlkSkuID' +$propAVMA = 'InheritedActivationId', 'InheritedActivationHostMachineName', 'InheritedActivationHostDigitalPid2', 'InheritedActivationActivationTime' +$primary = @() +$ppwszGenuineStates = @( + "SL_GEN_STATE_IS_GENUINE", + "SL_GEN_STATE_INVALID_LICENSE", + "SL_GEN_STATE_TAMPERED", + "SL_GEN_STATE_OFFLINE", + "SL_GEN_STATE_LAST" +) +$ppwszLicensingStates = @( + "SL_LICENSING_STATUS_UNLICENSED", + "SL_LICENSING_STATUS_LICENSED", + "SL_LICENSING_STATUS_IN_GRACE_PERIOD", + "SL_LICENSING_STATUS_NOTIFICATION", + "SL_LICENSING_STATUS_LAST" +) -'cW1nd0ws', 'c0ff1ce15', 'c0ff1ce14', 'ospp14', 'ospp15' | foreach {set $_ $false} +'cW1nd0ws', 'c0ff1ce15', 'c0ff1ce14', 'ospp14', 'ospp15' | foreach {set $_ @()} $offsvc = "osppsvc" if ($NT7 -Or -Not $NT6) {$winsvc = "sppsvc"} else {$winsvc = "slsvc"} @@ -1055,83 +1537,102 @@ if ($NT7 -Or -Not $NT6) {$winsvc = "sppsvc"} else {$winsvc = "slsvc"} try {gsv $winsvc -EA 1 | Out-Null; $WsppHook = 1} catch {$WsppHook = 0} try {gsv $offsvc -EA 1 | Out-Null; $OsppHook = 1} catch {$OsppHook = 0} -if ($WsppHook -NE 0) { - try {sasv $winsvc -EA 1} catch {} - $cW1nd0ws = DetectID $wslp $winApp - $c0ff1ce15 = DetectID $wslp $o15App - $c0ff1ce14 = DetectID $wslp $o14App +if (Test-Path "$SysPath\sppc.dll") { + $SLdll = 'sppc.dll' +} elseif (Test-Path "$SysPath\slc.dll") { + $SLdll = 'slc.dll' +} else { + $WsppHook = 0 } if ($OsppHook -NE 0) { - try {sasv $offsvc -EA 1} catch {} - $ospp15 = DetectID $oslp $o15App - $ospp14 = DetectID $oslp $o14App + $OLdll = (strGetRegistry $OPKeyPath "Path") + 'osppc.dll' + if (!(Test-Path "$OLdll")) {$OsppHook = 0} } -if ($cW1nd0ws) +if ($WsppHook -NE 0) { + if ($NT6 -And -Not $NT7 -And -Not $Admin) { + if ($null -EQ [Diagnostics.Process]::GetProcessesByName("$winsvc")[0].ProcessName) {$WsppHook = 0; CONOUT "`nError: failed to start $winsvc Service.`n"} + } else { + try {sasv $winsvc -EA 1} catch {$WsppHook = 0; CONOUT "`nError: failed to start $winsvc Service.`n"} + } +} + +if ($WsppHook -NE 0) { + . InitializePInvoke $SLdll $false + $hSLC = 0 + [void]$Win32::SLOpen([ref]$hSLC) + + $cW1nd0ws = SlGetInfoSLID $winApp + $c0ff1ce15 = SlGetInfoSLID $o15App + $c0ff1ce14 = SlGetInfoSLID $o14App +} + +if ($cW1nd0ws.Count -GT 0) { echoWindows - GetID $wslp $winApp | foreach -EA 1 { - GetResult $wslp $wsls $_ - CONOUT "$line3" - & $noAll - } + ParseList $wslp $winApp $cW1nd0ws } elseif ($NT6) { echoWindows - CONOUT "`nError: product key not found." + CONOUT "Error: product key not found.`n" } -if ($winbuild -GE 9200) { - . InitializePInvoke +if ($NT6 -And -Not $NT8) { + ClcRun +} + +if ($NT8) { ClicRun } -if ($c0ff1ce15 -Or $ospp15) { - CheckOhook -} - $doMSG = 1 -if ($c0ff1ce15) +if ($c0ff1ce15.Count -GT 0) { + CheckOhook echoOffice - GetID $wslp $o15App | foreach -EA 1 { - GetResult $wslp $wsls $_ - CONOUT "$line3" - & $noAll - } + ParseList $wslp $o15App $c0ff1ce15 } -if ($c0ff1ce14) +if ($c0ff1ce14.Count -GT 0) { echoOffice - GetID $wslp $o14App | foreach -EA 1 { - GetResult $wslp $wsls $_ - CONOUT "$line3" - & $noAll - } + ParseList $wslp $o14App $c0ff1ce14 } -if ($ospp15) -{ - echoOffice - GetID $oslp $o15App | foreach -EA 1 { - GetResult $oslp $osls $_ - CONOUT "$line3" - & $noAll - } +if ($hSLC) { + [void]$Win32::SLClose($hSLC) } -if ($ospp14) +if ($OsppHook -NE 0) { + try {sasv $offsvc -EA 1} catch {$OsppHook = 0; CONOUT "`nError: failed to start $offsvc Service.`n"} +} + +if ($OsppHook -NE 0) { + . InitializePInvoke "$OLdll" $true + $hSLC = 0 + [void]$Win32::SLOpen([ref]$hSLC) + + $ospp15 = SlGetInfoSLID $o15App + $ospp14 = SlGetInfoSLID $o14App +} + +if ($ospp15.Count -GT 0) { echoOffice - GetID $oslp $o14App | foreach -EA 1 { - GetResult $oslp $osls $_ - CONOUT "$line3" - & $noAll - } + ParseList $oslp $o15App $ospp15 +} + +if ($ospp14.Count -GT 0) +{ + echoOffice + ParseList $oslp $o14App $ospp14 +} + +if ($hSLC) { + [void]$Win32::SLClose($hSLC) } if ($NT7) { From 70162c413026ec938f1049b1e4011ac64945e31e Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Wed, 16 Apr 2025 05:30:31 +0530 Subject: [PATCH 20/30] Add support for external LibTSforge.dll if found in BIN folder --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 28 +++++++++++++------ .../Activators/TSforge_Activation.cmd | 28 +++++++++++++------ 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index b5a94e7..7f7bb7a 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -154,6 +154,7 @@ goto dk_done set "_work=%~dp0" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" +set "_workp=%_work:'=''%" set "_batf=%~f0" set "_batp=%_batf:'=''%" @@ -8826,17 +8827,26 @@ namespace LibTSforge.PhysicalStore } '@ $ErrorActionPreference = 'Stop' -$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll") -$cp.CompilerOptions = "/unsafe" -$lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" } +$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll" -$ctemp = "$env:SystemRoot\Temp\" -if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null } -$env:TMP = $ctemp -$env:TEMP = $ctemp +if (Test-Path -Path $binPath) { + Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..." + Add-Type -Path $binPath +} +else { + $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll") + $cp.CompilerOptions = "/unsafe" + $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" } + + $ctemp = "$env:SystemRoot\Temp\" + if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null } + $env:TMP = $ctemp + $env:TEMP = $ctemp + + $cp.GenerateInMemory = $true + Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp +} -$cp.GenerateInMemory = $true -Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp if ($env:_debug -eq '0') { [LibTSforge.Logger]::HideOutput = $true } diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 7da980b..8d79784 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -221,6 +221,7 @@ goto dk_done set "_work=%~dp0" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" +set "_workp=%_work:'=''%" set "_batf=%~f0" set "_batp=%_batf:'=''%" @@ -6709,17 +6710,26 @@ namespace LibTSforge.PhysicalStore } '@ $ErrorActionPreference = 'Stop' -$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll") -$cp.CompilerOptions = "/unsafe" -$lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" } +$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll" -$ctemp = "$env:SystemRoot\Temp\" -if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null } -$env:TMP = $ctemp -$env:TEMP = $ctemp +if (Test-Path -Path $binPath) { + Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..." + Add-Type -Path $binPath +} +else { + $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll") + $cp.CompilerOptions = "/unsafe" + $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" } + + $ctemp = "$env:SystemRoot\Temp\" + if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null } + $env:TMP = $ctemp + $env:TEMP = $ctemp + + $cp.GenerateInMemory = $true + Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp +} -$cp.GenerateInMemory = $true -Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp if ($env:_debug -eq '0') { [LibTSforge.Logger]::HideOutput = $true } From e8bf344f745358e140b75dff677bb745e4a8cafa Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Wed, 16 Apr 2025 06:14:40 +0530 Subject: [PATCH 21/30] Add support for O365 15.0 in TSforge because phone license exist --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 6 +++++- .../Activators/TSforge_Activation.cmd | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 7f7bb7a..c9946e9 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -4832,7 +4832,11 @@ call :dk_color %Gray% "Skipping Because Project/Visio Mode [%%#]" if not defined skipprocess ( -echo %%# | findstr /i "O365" %nul% && ( +set no365= +if "%oVer%"=="15" (echo %%# | findstr /i "O365HomePremRetail" %nul% && set no365=1) +if "%oVer%"=="16" (echo %%# | findstr /i "O365" %nul% && set no365=1) + +if defined no365 ( set _License=MondoRetail set _altoffid=MondoRetail call :ks_osppready diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 8d79784..a4131f8 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1611,7 +1611,11 @@ call :dk_color %Gray% "Skipping Because Project/Visio Mode [%%#]" if not defined skipprocess ( -echo %%# | findstr /i "O365" %nul% && ( +set no365= +if "%oVer%"=="15" (echo %%# | findstr /i "O365HomePremRetail" %nul% && set no365=1) +if "%oVer%"=="16" (echo %%# | findstr /i "O365" %nul% && set no365=1) + +if defined no365 ( set _License=MondoRetail set _altoffid=MondoRetail call :ks_osppready From a1614e128348a8e6953e318cc5f6522a1fa2621d Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Wed, 16 Apr 2025 08:03:58 +0530 Subject: [PATCH 22/30] Convert HomeStudentARM IDs to Mondo because phone license isn't available for them --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 11 +++++++++++ .../Activators/TSforge_Activation.cmd | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index c9946e9..cce246a 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -4781,6 +4781,7 @@ set _prids= set _config= set _version= set _License= +set _oMSI= exit /b ::======================================================================================================================================== @@ -4843,6 +4844,15 @@ call :ks_osppready echo Converting Unsupported O365 Office [%%# To MondoRetail] ) +if not defined _oMSI ( +echo %%# | findstr /i "ARM" %nul% && ( +set _License=MondoRetail +set _altoffid=MondoRetail +call :ks_osppready +echo Converting Unsupported OEM-ARM Office [%%# To MondoRetail] +) +) + set keytype=zero for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':offtsid\:.*';iex ($f[1])" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) @@ -4891,6 +4901,7 @@ exit /b call :ts_reset call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 +set _oMSI=1 set oVer=%1 for /f "skip=2 tokens=2*" %%a in ('"reg query %2\Common\InstallRoot /v Path" %nul6%') do (set "_oRoot=%%b") for /f "skip=2 tokens=2*" %%a in ('"reg query %2\Common\ProductVersion /v LastProduct" %nul6%') do (set "_version=%%b") diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index a4131f8..641f92d 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1500,6 +1500,7 @@ set _prids= set _config= set _version= set _License= +set _oMSI= exit /b ::======================================================================================================================================== @@ -1622,6 +1623,15 @@ call :ks_osppready echo Converting Unsupported O365 Office [%%# To MondoRetail] ) +if not defined _oMSI ( +echo %%# | findstr /i "ARM" %nul% && ( +set _License=MondoRetail +set _altoffid=MondoRetail +call :ks_osppready +echo Converting Unsupported OEM-ARM Office [%%# To MondoRetail] +) +) + set keytype=zero for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':offtsid\:.*';iex ($f[1])" %nul6%') do ( echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) @@ -1670,6 +1680,7 @@ exit /b call :ts_reset call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 +set _oMSI=1 set oVer=%1 for /f "skip=2 tokens=2*" %%a in ('"reg query %2\Common\InstallRoot /v Path" %nul6%') do (set "_oRoot=%%b") for /f "skip=2 tokens=2*" %%a in ('"reg query %2\Common\ProductVersion /v LastProduct" %nul6%') do (set "_version=%%b") From 372eb73a02260cf4bc6fd424bcc6216fa8a15be2 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Thu, 17 Apr 2025 01:47:13 +0530 Subject: [PATCH 23/30] Add updated TSforge code --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 1953 ++++++++++++----- .../Activators/TSforge_Activation.cmd | 1953 ++++++++++++----- 2 files changed, 2844 insertions(+), 1062 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index cce246a..f180db7 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -4951,23 +4951,16 @@ $src = @' // Common.cs namespace LibTSforge { - using Microsoft.Win32; using System; using System.IO; using System.Linq; using System.Runtime.InteropServices; - using System.ServiceProcess; using System.Text; - using LibTSforge.Crypto; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; - using LibTSforge.TokenStore; public enum PSVersion { Vista, Win7, - Win8Early, Win8, WinBlue, WinModern @@ -5038,8 +5031,8 @@ namespace LibTSforge 0x92, 0xA6, 0x56, 0x96 }; - // 2^31 - 1 minutes - public static ulong TimerMax = (ulong)TimeSpan.FromMinutes(2147483647).Ticks; + // 2^31 - 8 minutes + public static readonly ulong TimerMax = (ulong)TimeSpan.FromMinutes(2147483640).Ticks; public static readonly string ZeroCID = new string('0', 48); } @@ -5107,20 +5100,6 @@ namespace LibTSforge } return result; } - - public static T CastToStruct(this byte[] data) where T : struct - { - GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned); - try - { - IntPtr ptr = handle.AddrOfPinnedObject(); - return (T)Marshal.PtrToStructure(ptr, typeof(T)); - } - finally - { - handle.Free(); - } - } } public static class FileStreamExt @@ -5141,6 +5120,12 @@ namespace LibTSforge public static class Utils { + [DllImport("kernel32.dll")] + public static extern uint GetSystemDefaultLCID(); + + [DllImport("kernel32.dll")] + public static extern bool Wow64EnableWow64FsRedirection(bool Wow64FsEnableRedirection); + public static string DecodeString(byte[] data) { return Encoding.Unicode.GetString(data).Trim('\0'); @@ -5151,9 +5136,6 @@ namespace LibTSforge return Encoding.Unicode.GetBytes(str + '\0'); } - [DllImport("kernel32.dll")] - public static extern uint GetSystemDefaultLCID(); - public static uint CRC32(byte[] data) { const uint polynomial = 0x04C11DB7; @@ -5177,157 +5159,6 @@ namespace LibTSforge return ~crc; } - public static void KillSPP() - { - ServiceController sc; - - try - { - sc = new ServiceController("sppsvc"); - - if (sc.Status == ServiceControllerStatus.Stopped) - return; - } - catch (InvalidOperationException ex) - { - throw new InvalidOperationException("Unable to access sppsvc: " + ex.Message); - } - - Logger.WriteLine("Stopping sppsvc..."); - - bool stopped = false; - - for (int i = 0; stopped == false && i < 60; i++) - { - try - { - if (sc.Status != ServiceControllerStatus.StopPending) - sc.Stop(); - - sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromMilliseconds(500)); - } - catch (System.ServiceProcess.TimeoutException) - { - continue; - } - catch (InvalidOperationException) - { - System.Threading.Thread.Sleep(500); - continue; - } - - stopped = true; - } - - if (!stopped) - throw new System.TimeoutException("Failed to stop sppsvc"); - - Logger.WriteLine("sppsvc stopped successfully."); - } - - public static string GetPSPath(PSVersion version) - { - switch (version) - { - case PSVersion.Win7: - return Directory.GetFiles( - Environment.GetFolderPath(Environment.SpecialFolder.System), - "7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-8115-601632D005A0") - .FirstOrDefault() ?? ""; - case PSVersion.Win8Early: - case PSVersion.WinBlue: - case PSVersion.Win8: - case PSVersion.WinModern: - return Path.Combine( - Environment.ExpandEnvironmentVariables( - (string)Registry.GetValue( - @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform", - "TokenStore", - string.Empty - ) - ), - "data.dat" - ); - default: - return ""; - } - } - - public static string GetTokensPath(PSVersion version) - { - switch (version) - { - case PSVersion.Win7: - return Path.Combine( - Environment.ExpandEnvironmentVariables("%WINDIR%"), - @"ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" - ); - case PSVersion.Win8Early: - case PSVersion.WinBlue: - case PSVersion.Win8: - case PSVersion.WinModern: - return Path.Combine( - Environment.ExpandEnvironmentVariables( - (string)Registry.GetValue( - @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform", - "TokenStore", - string.Empty - ) - ), - "tokens.dat" - ); - default: - return ""; - } - } - - public static IPhysicalStore GetStore(PSVersion version, bool production) - { - string psPath; - - try - { - psPath = GetPSPath(version); - } - catch - { - throw new FileNotFoundException("Failed to get path of physical store."); - } - - if (string.IsNullOrEmpty(psPath) || !File.Exists(psPath)) - { - throw new FileNotFoundException(string.Format("Physical store not found at expected path {0}.", psPath)); - } - - if (version == PSVersion.Vista) - { - throw new NotSupportedException("Physical store editing is not supported for Windows Vista."); - } - - return version == PSVersion.Win7 ? new PhysicalStoreWin7(psPath, production) : (IPhysicalStore)new PhysicalStoreModern(psPath, production, version); - } - - public static ITokenStore GetTokenStore(PSVersion version) - { - string tokPath; - - try - { - tokPath = GetTokensPath(version); - } - catch - { - throw new FileNotFoundException("Failed to get path of physical store."); - } - - if (string.IsNullOrEmpty(tokPath) || !File.Exists(tokPath)) - { - throw new FileNotFoundException(string.Format("Token store not found at expected path {0}.", tokPath)); - } - - return new TokenStoreModern(tokPath); - } - public static string GetArchitecture() { string arch = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE", EnvironmentVariableTarget.Machine).ToUpperInvariant(); @@ -5343,65 +5174,7 @@ namespace LibTSforge if (build >= 7600 && build <= 7602) return PSVersion.Win7; if (build == 9200) return PSVersion.Win8; - throw new NotSupportedException("Unable to auto-detect version info, please specify one manually using the /ver argument."); - } - - public static bool DetectCurrentKey() - { - SLApi.RefreshLicenseStatus(); - - using (RegistryKey wpaKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\WPA")) - { - foreach (string subKey in wpaKey.GetSubKeyNames()) - { - if (subKey.StartsWith("8DEC0AF1") && subKey.EndsWith("-1")) - { - return subKey.Contains("P"); - } - } - } - - throw new FileNotFoundException("Failed to autodetect key type, specify physical store key with /prod or /test arguments."); - } - - public static void DumpStore(PSVersion version, bool production, string filePath, string encrFilePath) - { - if (encrFilePath == null) - { - encrFilePath = GetPSPath(version); - } - - if (string.IsNullOrEmpty(encrFilePath) || !File.Exists(encrFilePath)) - { - throw new FileNotFoundException("Store does not exist at expected path '" + encrFilePath + "'."); - } - - KillSPP(); - - using (FileStream fs = File.Open(encrFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) - { - byte[] encrData = fs.ReadAllBytes(); - File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production)); - } - - Logger.WriteLine("Store dumped successfully to '" + filePath + "'."); - } - - public static void LoadStore(PSVersion version, bool production, string filePath) - { - if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath)) - { - throw new FileNotFoundException("Store file '" + filePath + "' does not exist."); - } - - KillSPP(); - - using (IPhysicalStore store = GetStore(version, production)) - { - store.WriteRaw(File.ReadAllBytes(filePath)); - } - - Logger.WriteLine("Loaded store file succesfully."); + throw new NotSupportedException("Unable to auto-detect version info"); } } @@ -5494,8 +5267,8 @@ namespace LibTSforge.SPP public class PKeyConfig { - public Dictionary Products = new Dictionary(); - private List loadedPkeyConfigs = new List(); + public readonly Dictionary Products = new Dictionary(); + private readonly List loadedPkeyConfigs = new List(); public void LoadConfig(Guid actId) { @@ -5556,12 +5329,14 @@ namespace LibTSforge.SPP ranges[refActIdStr] = new List(); } - KeyRange keyRange = new KeyRange(); - keyRange.Start = int.Parse(rangeNode.SelectSingleNode("./p:Start", nsmgr).InnerText); - keyRange.End = int.Parse(rangeNode.SelectSingleNode("./p:End", nsmgr).InnerText); - keyRange.EulaType = rangeNode.SelectSingleNode("./p:EulaType", nsmgr).InnerText; - keyRange.PartNumber = rangeNode.SelectSingleNode("./p:PartNumber", nsmgr).InnerText; - keyRange.Valid = rangeNode.SelectSingleNode("./p:IsValid", nsmgr).InnerText.ToLower() == "true"; + KeyRange keyRange = new KeyRange + { + Start = int.Parse(rangeNode.SelectSingleNode("./p:Start", nsmgr).InnerText), + End = int.Parse(rangeNode.SelectSingleNode("./p:End", nsmgr).InnerText), + EulaType = rangeNode.SelectSingleNode("./p:EulaType", nsmgr).InnerText, + PartNumber = rangeNode.SelectSingleNode("./p:PartNumber", nsmgr).InnerText, + Valid = rangeNode.SelectSingleNode("./p:IsValid", nsmgr).InnerText.ToLower() == "true" + }; ranges[refActIdStr].Add(keyRange); } @@ -5575,15 +5350,17 @@ namespace LibTSforge.SPP if (keyRanges.Count > 0 && !Products.ContainsKey(refActId)) { - ProductConfig productConfig = new ProductConfig(); - productConfig.GroupId = group; - productConfig.Edition = configNode.SelectSingleNode("./p:EditionId", nsmgr).InnerText; - productConfig.Description = configNode.SelectSingleNode("./p:ProductDescription", nsmgr).InnerText; - productConfig.Channel = configNode.SelectSingleNode("./p:ProductKeyType", nsmgr).InnerText; - productConfig.Randomized = configNode.SelectSingleNode("./p:ProductKeyType", nsmgr).InnerText.ToLower() == "true"; - productConfig.Algorithm = algorithms[group]; - productConfig.Ranges = keyRanges; - productConfig.ActivationId = refActId; + ProductConfig productConfig = new ProductConfig + { + GroupId = group, + Edition = configNode.SelectSingleNode("./p:EditionId", nsmgr).InnerText, + Description = configNode.SelectSingleNode("./p:ProductDescription", nsmgr).InnerText, + Channel = configNode.SelectSingleNode("./p:ProductKeyType", nsmgr).InnerText, + Randomized = configNode.SelectSingleNode("./p:ProductKeyType", nsmgr).InnerText.ToLower() == "true", + Algorithm = algorithms[group], + Ranges = keyRanges, + ActivationId = refActId + }; Products[refActId] = productConfig; } @@ -5626,11 +5403,6 @@ namespace LibTSforge.SPP } } } - - public PKeyConfig() - { - - } } } @@ -5641,8 +5413,8 @@ namespace LibTSforge.SPP using System; using System.IO; using System.Linq; - using LibTSforge.Crypto; - using LibTSforge.PhysicalStore; + using Crypto; + using PhysicalStore; public class ProductKey { @@ -5656,11 +5428,11 @@ namespace LibTSforge.SPP public ulong Security; public bool Upgrade; public PKeyAlgorithm Algorithm; - public string EulaType; - public string PartNumber; - public string Edition; - public string Channel; - public Guid ActivationId; + public readonly string EulaType; + public readonly string PartNumber; + public readonly string Edition; + public readonly string Channel; + public readonly Guid ActivationId; private string mpc; private string pid2; @@ -5670,6 +5442,11 @@ namespace LibTSforge.SPP get { return BitConverter.GetBytes(klow).Concat(BitConverter.GetBytes(khigh)).ToArray(); } } + public ProductKey() + { + + } + public ProductKey(int serial, ulong security, bool upgrade, PKeyAlgorithm algorithm, ProductConfig config, KeyRange range) { Group = config.GroupId; @@ -5698,22 +5475,22 @@ namespace LibTSforge.SPP public Guid GetPkeyId() { - VariableBag pkb = new VariableBag(); - pkb.Blocks.AddRange(new CRCBlock[] + VariableBag pkb = new VariableBag(PSVersion.WinModern); + pkb.Blocks.AddRange(new[] { - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingProductKey", ValueAsStr = ToString() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingMiscData", Value = new byte[] { } }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingAlgorithm", @@ -5724,16 +5501,6 @@ namespace LibTSforge.SPP return new Guid(CryptoUtils.SHA256Hash(pkb.Serialize()).Take(16).ToArray()); } - public string GetDefaultMPC() - { - int build = Environment.OSVersion.Version.Build; - string defaultMPC = build >= 10240 ? "03612" : - build >= 9600 ? "06401" : - build >= 9200 ? "05426" : - "55041"; - return defaultMPC; - } - public string GetMPC() { if (mpc != null) @@ -5741,10 +5508,15 @@ namespace LibTSforge.SPP return mpc; } - mpc = GetDefaultMPC(); + int build = Environment.OSVersion.Version.Build; + + mpc = build >= 10240 ? "03612" : + build >= 9600 ? "06401" : + build >= 9200 ? "05426" : + "55041"; // setup.cfg doesn't exist in Windows 8+ - string setupcfg = string.Format("{0}\\oobe\\{1}", Environment.SystemDirectory, "setup.cfg"); + string setupcfg = string.Format(@"{0}\oobe\{1}", Environment.SystemDirectory, "setup.cfg"); if (!File.Exists(setupcfg) || Edition.Contains(";")) { @@ -5882,17 +5654,17 @@ namespace LibTSforge.SPP { if (version == PSVersion.Win7) { - Random rnd = new Random(Group * 1000000000 + Serial); - byte[] data = new byte[8]; - rnd.NextBytes(data); - return data; + ulong shortauth = ((ulong)Group << 41) | (Security << 31) | ((ulong)Serial << 1) | (Upgrade ? (ulong)1 : 0); + return BitConverter.GetBytes(shortauth); } int serialHigh = Serial / 1000000; int serialLow = Serial % 1000000; BinaryWriter writer = new BinaryWriter(new MemoryStream()); - writer.Write(new Guid("B8731595-A2F6-430B-A799-FBFFB81A8D73").ToByteArray()); + string algoId = Algorithm == PKeyAlgorithm.PKEY2005 ? "B8731595-A2F6-430B-A799-FBFFB81A8D73" : "660672EF-7809-4CFD-8D54-41B7FB738988"; + + writer.Write(new Guid(algoId).ToByteArray()); writer.Write(Group); writer.Write(serialHigh); writer.Write(serialLow); @@ -5998,40 +5770,40 @@ namespace LibTSforge.SPP public static readonly Guid WINDOWS_APP_ID = new Guid("55c92734-d682-4d71-983e-d6ec3f16059f"); - [DllImport("sppc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] + [DllImport("slc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] private static extern void SLOpen(out IntPtr hSLC); - [DllImport("sppc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] + [DllImport("slc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] private static extern void SLClose(IntPtr hSLC); [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetWindowsInformationDWORD(string ValueName, ref int Value); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLInstallProofOfPurchase(IntPtr hSLC, string pwszPKeyAlgorithm, string pwszPKeyString, uint cbPKeySpecificData, byte[] pbPKeySpecificData, ref Guid PKeyId); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLUninstallProofOfPurchase(IntPtr hSLC, ref Guid PKeyId); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetPKeyInformation(IntPtr hSLC, ref Guid pPKeyId, string pwszValueName, out SLDATATYPE peDataType, out uint pcbValue, out IntPtr ppbValue); - [DllImport("sppcext.dll", CharSet = CharSet.Unicode)] + [DllImport("slcext.dll", CharSet = CharSet.Unicode)] private static extern uint SLActivateProduct(IntPtr hSLC, ref Guid pProductSkuId, byte[] cbAppSpecificData, byte[] pvAppSpecificData, byte[] pActivationInfo, string pwszProxyServer, ushort wProxyPort); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGenerateOfflineInstallationId(IntPtr hSLC, ref Guid pProductSkuId, ref string ppwszInstallationId); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLDepositOfflineConfirmationId(IntPtr hSLC, ref Guid pProductSkuId, string pwszInstallationId, string pwszConfirmationId); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetSLIDList(IntPtr hSLC, SLIDTYPE eQueryIdType, ref Guid pQueryId, SLIDTYPE eReturnIdType, out uint pnReturnIds, out IntPtr ppReturnIds); - [DllImport("sppc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] + [DllImport("slc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] private static extern void SLGetLicensingStatusInformation(IntPtr hSLC, ref Guid pAppID, IntPtr pProductSkuId, string pwszRightName, out uint pnStatusCount, out IntPtr ppLicensingStatus); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetInstalledProductKeyIds(IntPtr hSLC, ref Guid pProductSkuId, out uint pnProductKeyIds, out IntPtr ppProductKeyIds); [DllImport("slc.dll", CharSet = CharSet.Unicode)] @@ -6040,9 +5812,6 @@ namespace LibTSforge.SPP [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetProductSkuInformation(IntPtr hSLC, ref Guid pProductSkuId, string pwszValueName, out SLDATATYPE peDataType, out uint pcbValue, out IntPtr ppbValue); - [DllImport("slc.dll", CharSet = CharSet.Unicode)] - private static extern uint SLGetProductSkuInformation(IntPtr hSLC, ref Guid pProductSkuId, string pwszValueName, IntPtr peDataType, out uint pcbValue, out IntPtr ppbValue); - [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetLicense(IntPtr hSLC, ref Guid pLicenseFileId, out uint pcbLicenseFile, out IntPtr ppbLicenseFile); @@ -6052,7 +5821,7 @@ namespace LibTSforge.SPP [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLFireEvent(IntPtr hSLC, string pwszEventId, ref Guid pApplicationId); - public class SLContext : IDisposable + private class SLContext : IDisposable { public readonly IntPtr Handle; @@ -6115,11 +5884,10 @@ namespace LibTSforge.SPP { using (SLContext sl = new SLContext()) { - uint status; uint count; IntPtr pProductKeyIds; - status = SLGetInstalledProductKeyIds(sl.Handle, ref actId, out count, out pProductKeyIds); + uint status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_PRODUCT_SKU, ref actId, SLIDTYPE.SL_ID_PKEY, out count, out pProductKeyIds); if (status != 0 || count == 0) { @@ -6143,7 +5911,7 @@ namespace LibTSforge.SPP SLConsumeWindowsRight(0); } - public static bool RefreshTrustedTime(Guid actId) + public static void RefreshTrustedTime(Guid actId) { using (SLContext sl = new SLContext()) { @@ -6151,8 +5919,7 @@ namespace LibTSforge.SPP uint count; IntPtr ppbValue; - uint status = SLGetProductSkuInformation(sl.Handle, ref actId, "TrustedTime", out type, out count, out ppbValue); - return (int)status >= 0 && status != 0xC004F012; + SLGetProductSkuInformation(sl.Handle, ref actId, "TrustedTime", out type, out count, out ppbValue); } } @@ -6168,11 +5935,10 @@ namespace LibTSforge.SPP { using (SLContext sl = new SLContext()) { - uint status; uint count; IntPtr pAppIds; - status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_PRODUCT_SKU, ref actId, SLIDTYPE.SL_ID_APPLICATION, out count, out pAppIds); + uint status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_PRODUCT_SKU, ref actId, SLIDTYPE.SL_ID_APPLICATION, out count, out pAppIds); if (status != 0 || count == 0) { @@ -6200,11 +5966,10 @@ namespace LibTSforge.SPP { using (SLContext sl = new SLContext()) { - uint status; uint count; IntPtr ppReturnLics; - status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_LICENSE, ref licId, SLIDTYPE.SL_ID_LICENSE_FILE, out count, out ppReturnLics); + uint status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_LICENSE, ref licId, SLIDTYPE.SL_ID_LICENSE_FILE, out count, out ppReturnLics); if (status != 0 || count == 0) { @@ -6266,7 +6031,7 @@ namespace LibTSforge.SPP IntPtr ppbValue; uint status = SLGetProductSkuInformation(sl.Handle, ref actId, "msft:sl/EUL/PHONE/PUBLIC", out type, out count, out ppbValue); - return status >= 0 && status != 0xC004F012; + return status != 0xC004F012; } } @@ -6349,11 +6114,11 @@ namespace LibTSforge.SPP } } - public static uint UninstallProductKey(Guid pkeyId) + public static void UninstallProductKey(Guid pkeyId) { using (SLContext sl = new SLContext()) { - return SLUninstallProofOfPurchase(sl.Handle, ref pkeyId); + SLUninstallProofOfPurchase(sl.Handle, ref pkeyId); } } @@ -6371,6 +6136,390 @@ namespace LibTSforge.SPP } +// SPP/SPPUtils.cs +namespace LibTSforge.SPP +{ + using Microsoft.Win32; + using System; + using System.IO; + using System.Linq; + using System.ServiceProcess; + using Crypto; + using PhysicalStore; + using TokenStore; + + public static class SPPUtils + { + public static void KillSPP(PSVersion version) + { + ServiceController sc; + + string svcName = version == PSVersion.Vista ? "slsvc" : "sppsvc"; + + try + { + sc = new ServiceController(svcName); + + if (sc.Status == ServiceControllerStatus.Stopped) + return; + } + catch (InvalidOperationException ex) + { + throw new InvalidOperationException(string.Format("Unable to access {0}: ", svcName) + ex.Message); + } + + Logger.WriteLine(string.Format("Stopping {0}...", svcName)); + + bool stopped = false; + + for (int i = 0; stopped == false && i < 1080; i++) + { + try + { + if (sc.Status != ServiceControllerStatus.StopPending) + sc.Stop(); + + sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromMilliseconds(500)); + } + catch (System.ServiceProcess.TimeoutException) + { + continue; + } + catch (InvalidOperationException ex) + { + Logger.WriteLine("Warning: Stopping sppsvc failed, retrying. Details: " + ex.Message); + System.Threading.Thread.Sleep(500); + continue; + } + + stopped = true; + } + + if (!stopped) + throw new System.TimeoutException(string.Format("Failed to stop {0}", svcName)); + + Logger.WriteLine(string.Format("{0} stopped successfully.", svcName)); + + if (version == PSVersion.Vista && SPSys.IsSpSysRunning()) + { + Logger.WriteLine("Unloading spsys..."); + + int status = SPSys.ControlSpSys(false); + + if (status < 0) + { + throw new IOException("Failed to unload spsys"); + } + + Logger.WriteLine("spsys unloaded successfully."); + } + } + + public static void RestartSPP(PSVersion version) + { + if (version == PSVersion.Vista) + { + ServiceController sc; + + try + { + sc = new ServiceController("slsvc"); + + if (sc.Status == ServiceControllerStatus.Running) + return; + } + catch (InvalidOperationException ex) + { + throw new InvalidOperationException("Unable to access slsvc: " + ex.Message); + } + + Logger.WriteLine("Starting slsvc..."); + + bool started = false; + + for (int i = 0; started == false && i < 360; i++) + { + try + { + if (sc.Status != ServiceControllerStatus.StartPending) + sc.Start(); + + sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromMilliseconds(500)); + } + catch (System.ServiceProcess.TimeoutException) + { + continue; + } + catch (InvalidOperationException ex) + { + Logger.WriteLine("Warning: Starting slsvc failed, retrying. Details: " + ex.Message); + System.Threading.Thread.Sleep(500); + continue; + } + + started = true; + } + + if (!started) + throw new System.TimeoutException("Failed to start slsvc"); + + Logger.WriteLine("slsvc started successfully."); + } + + SLApi.RefreshLicenseStatus(); + } + + public static bool DetectCurrentKey() + { + SLApi.RefreshLicenseStatus(); + + using (RegistryKey wpaKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\WPA")) + { + foreach (string subKey in wpaKey.GetSubKeyNames()) + { + if (subKey.StartsWith("8DEC0AF1")) + { + return subKey.Contains("P"); + } + } + } + + throw new FileNotFoundException("Failed to autodetect key type, specify physical store key with /prod or /test arguments."); + } + + public static string GetPSPath(PSVersion version) + { + switch (version) + { + case PSVersion.Vista: + case PSVersion.Win7: + return Directory.GetFiles( + Environment.GetFolderPath(Environment.SpecialFolder.System), + "7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-8115-601632D005A0") + .FirstOrDefault() ?? ""; + default: + string psDir = Environment.ExpandEnvironmentVariables( + (string)Registry.GetValue( + @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform", + "TokenStore", + "" + ) + ); + string psPath = Path.Combine(psDir, "data.dat"); + + if (string.IsNullOrEmpty(psDir) || !File.Exists(psPath)) + { + string[] psDirs = + { + @"spp\store", + @"spp\store\2.0", + @"spp\store_test", + @"spp\store_test\2.0" + }; + + foreach (string dir in psDirs) + { + psPath = Path.Combine( + Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.System), + dir + ), + "data.dat" + ); + + if (File.Exists(psPath)) return psPath; + } + } + else + { + return psPath; + } + + throw new FileNotFoundException("Failed to locate physical store."); + } + } + + public static string GetTokensPath(PSVersion version) + { + switch (version) + { + case PSVersion.Vista: + return Path.Combine( + Environment.ExpandEnvironmentVariables("%WINDIR%"), + @"ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\tokens.dat" + ); + case PSVersion.Win7: + return Path.Combine( + Environment.ExpandEnvironmentVariables("%WINDIR%"), + @"ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" + ); + default: + string tokDir = Environment.ExpandEnvironmentVariables( + (string)Registry.GetValue( + @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform", + "TokenStore", + "" + ) + ); + string tokPath = Path.Combine(tokDir, "tokens.dat"); + + if (string.IsNullOrEmpty(tokDir) || !File.Exists(tokPath)) + { + string[] tokDirs = + { + @"spp\store", + @"spp\store\2.0", + @"spp\store_test", + @"spp\store_test\2.0" + }; + + foreach (string dir in tokDirs) + { + tokPath = Path.Combine( + Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.System), + dir + ), + "tokens.dat" + ); + + if (File.Exists(tokPath)) return tokPath; + } + } + else + { + return tokPath; + } + + throw new FileNotFoundException("Failed to locate token store."); + } + } + + public static IPhysicalStore GetStore(PSVersion version, bool production) + { + string psPath = GetPSPath(version); + + switch (version) + { + case PSVersion.Vista: + return new PhysicalStoreVista(psPath, production); + case PSVersion.Win7: + return new PhysicalStoreWin7(psPath, production); + default: + return new PhysicalStoreModern(psPath, production, version); + } + } + + public static ITokenStore GetTokenStore(PSVersion version) + { + string tokPath = GetTokensPath(version); + + return new TokenStoreModern(tokPath); + } + + public static void DumpStore(PSVersion version, bool production, string filePath, string encrFilePath) + { + bool manageSpp = false; + + if (encrFilePath == null) + { + encrFilePath = GetPSPath(version); + manageSpp = true; + KillSPP(version); + } + + if (string.IsNullOrEmpty(encrFilePath) || !File.Exists(encrFilePath)) + { + throw new FileNotFoundException("Store does not exist at expected path '" + encrFilePath + "'."); + } + + try + { + using (FileStream fs = File.Open(encrFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) + { + byte[] encrData = fs.ReadAllBytes(); + File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production, version)); + } + Logger.WriteLine("Store dumped successfully to '" + filePath + "'."); + } + finally + { + if (manageSpp) + { + RestartSPP(version); + } + } + } + + public static void LoadStore(PSVersion version, bool production, string filePath) + { + if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath)) + { + throw new FileNotFoundException("Store file '" + filePath + "' does not exist."); + } + + KillSPP(version); + + using (IPhysicalStore store = GetStore(version, production)) + { + store.WriteRaw(File.ReadAllBytes(filePath)); + } + + RestartSPP(version); + + Logger.WriteLine("Loaded store file successfully."); + } + } +} + + +// SPP/SPSys.cs +namespace LibTSforge.SPP +{ + using Microsoft.Win32.SafeHandles; + using System; + using System.Runtime.InteropServices; + + public class SPSys + { + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile); + private static SafeFileHandle CreateFileSafe(string device) + { + return new SafeFileHandle(CreateFile(device, 0xC0000000, 0, IntPtr.Zero, 3, 0, IntPtr.Zero), true); + } + + [return: MarshalAs(UnmanagedType.Bool)] + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern bool DeviceIoControl([In] SafeFileHandle hDevice, [In] uint dwIoControlCode, [In] IntPtr lpInBuffer, [In] int nInBufferSize, [Out] IntPtr lpOutBuffer, [In] int nOutBufferSize, out int lpBytesReturned, [In] IntPtr lpOverlapped); + + public static bool IsSpSysRunning() + { + SafeFileHandle file = CreateFileSafe(@"\\.\SpDevice"); + IntPtr buffer = Marshal.AllocHGlobal(1); + int bytesReturned; + DeviceIoControl(file, 0x80006008, IntPtr.Zero, 0, buffer, 1, out bytesReturned, IntPtr.Zero); + bool running = Marshal.ReadByte(buffer) != 0; + Marshal.FreeHGlobal(buffer); + file.Close(); + return running; + } + + public static int ControlSpSys(bool start) + { + SafeFileHandle file = CreateFileSafe(@"\\.\SpDevice"); + IntPtr buffer = Marshal.AllocHGlobal(4); + int bytesReturned; + DeviceIoControl(file, start ? 0x8000a000 : 0x8000a004, IntPtr.Zero, 0, buffer, 4, out bytesReturned, IntPtr.Zero); + int result = Marshal.ReadInt32(buffer); + Marshal.FreeHGlobal(buffer); + file.Close(); + return result; + } + } +} + + // Crypto/CryptoUtils.cs namespace LibTSforge.Crypto { @@ -6480,10 +6629,21 @@ namespace LibTSforge.Crypto public static bool HMACVerify(byte[] key, byte[] data, byte[] signature) { - HMACSHA1 hmac = new HMACSHA1(key); return Enumerable.SequenceEqual(signature, HMACSign(key, data)); } + public static byte[] SaltSHASum(byte[] salt, byte[] data) + { + SHA1 sha1 = SHA1.Create(); + byte[] sha_data = salt.Concat(data).ToArray(); + return sha1.ComputeHash(sha_data); + } + + public static bool SaltSHAVerify(byte[] salt, byte[] data, byte[] checksum) + { + return Enumerable.SequenceEqual(checksum, SaltSHASum(salt, data)); + } + public static byte[] SHA256Hash(byte[] data) { using (SHA256 sha256 = SHA256.Create()) @@ -6596,7 +6756,7 @@ namespace LibTSforge.Crypto public static class PhysStoreCrypto { - public static byte[] DecryptPhysicalStore(byte[] data, bool production) + public static byte[] DecryptPhysicalStore(byte[] data, bool production, PSVersion version) { byte[] rsaKey = production ? Keys.PRODUCTION : Keys.TEST; BinaryReader br = new BinaryReader(new MemoryStream(data)); @@ -6604,29 +6764,40 @@ namespace LibTSforge.Crypto byte[] aesKeySig = br.ReadBytes(0x80); byte[] encAesKey = br.ReadBytes(0x80); - if (CryptoUtils.RSAVerifySignature(rsaKey, encAesKey, aesKeySig)) + if (!CryptoUtils.RSAVerifySignature(rsaKey, encAesKey, aesKeySig)) { - byte[] aesKey = CryptoUtils.RSADecrypt(rsaKey, encAesKey); - byte[] decData = CryptoUtils.AESDecrypt(br.ReadBytes((int)br.BaseStream.Length - 0x110), aesKey); - byte[] hmacKey = decData.Take(0x10).ToArray(); - byte[] hmacSig = decData.Skip(0x10).Take(0x14).ToArray(); - byte[] psData = decData.Skip(0x28).ToArray(); - - if (!CryptoUtils.HMACVerify(hmacKey, psData, hmacSig)) - { - Logger.WriteLine("Warning: Failed to verify HMAC. Physical store is either corrupt or in Vista format."); - } - - return psData; + throw new Exception("Failed to decrypt physical store."); } - throw new Exception("Failed to decrypt physical store."); + byte[] aesKey = CryptoUtils.RSADecrypt(rsaKey, encAesKey); + byte[] decData = CryptoUtils.AESDecrypt(br.ReadBytes((int)br.BaseStream.Length - 0x110), aesKey); + byte[] hmacKey = decData.Take(0x10).ToArray(); // SHA-1 salt on Vista + byte[] hmacSig = decData.Skip(0x10).Take(0x14).ToArray(); // SHA-1 hash on Vista + byte[] psData = decData.Skip(0x28).ToArray(); + + if (version != PSVersion.Vista) + { + if (!CryptoUtils.HMACVerify(hmacKey, psData, hmacSig)) + { + throw new InvalidDataException("Failed to verify HMAC. Physical store is corrupt."); + } + } + else + { + if (!CryptoUtils.SaltSHAVerify(hmacKey, psData, hmacSig)) + { + throw new InvalidDataException("Failed to verify checksum. Physical store is corrupt."); + } + } + + return psData; } public static byte[] EncryptPhysicalStore(byte[] data, bool production, PSVersion version) { Dictionary versionTable = new Dictionary { + {PSVersion.Vista, 2}, {PSVersion.Win7, 5}, {PSVersion.Win8, 1}, {PSVersion.WinBlue, 2}, @@ -6640,9 +6811,9 @@ namespace LibTSforge.Crypto byte[] encAesKey = CryptoUtils.RSAEncrypt(rsaKey, aesKey); byte[] aesKeySig = CryptoUtils.RSASign(rsaKey, encAesKey); - byte[] hmacSig = CryptoUtils.HMACSign(hmacKey, data); + byte[] hmacSig = version != PSVersion.Vista ? CryptoUtils.HMACSign(hmacKey, data) : CryptoUtils.SaltSHASum(hmacKey, data); - byte[] decData = new byte[] { }; + byte[] decData = { }; decData = decData.Concat(hmacKey).Concat(hmacSig).Concat(BitConverter.GetBytes(0)).Concat(data).ToArray(); byte[] encData = CryptoUtils.AESEncrypt(decData, aesKey); @@ -6665,9 +6836,9 @@ namespace LibTSforge.Modifiers using System; using System.IO; using Microsoft.Win32; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; - using LibTSforge.TokenStore; + using PhysicalStore; + using SPP; + using TokenStore; public static class GenPKeyInstall { @@ -6693,6 +6864,7 @@ namespace LibTSforge.Modifiers public static void InstallGenPKey(PSVersion version, bool production, Guid actId) { + if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008."); if (actId == Guid.Empty) throw new ArgumentException("Activation ID must be specified for generated product key install."); PKeyConfig pkc = new PKeyConfig(); @@ -6719,7 +6891,7 @@ namespace LibTSforge.Modifiers if (pkey.Algorithm == PKeyAlgorithm.PKEY2009) { uint status = SLApi.InstallProductKey(pkey); - Logger.WriteLine(string.Format("Installing generated product key {0} status {1:X}", pkey.ToString(), status)); + Logger.WriteLine(string.Format("Installing generated product key {0} status {1:X}", pkey, status)); if ((int)status < 0) { @@ -6734,57 +6906,57 @@ namespace LibTSforge.Modifiers if (pkey.Channel == "Volume:GVLK" && version == PSVersion.Win7) throw new NotSupportedException("Fake GVLK generation is not supported on Windows 7."); - VariableBag pkb = new VariableBag(); - pkb.Blocks.AddRange(new CRCBlock[] + VariableBag pkb = new VariableBag(version); + pkb.Blocks.AddRange(new[] { - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingProductKey", ValueAsStr = pkey.ToString() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingMPC", ValueAsStr = pkey.GetMPC() }, - new CRCBlock { + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingPid2", ValueAsStr = pkey.GetPid2() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingPid3", Value = pkey.GetPid3() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingPid4", Value = pkey.GetPid4() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyChannelId", ValueAsStr = pkey.Channel }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingEditionId", ValueAsStr = pkey.Edition }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = (version == PSVersion.Win7) ? "SppPkeyShortAuthenticator" : "SppPkeyPhoneActivationData", Value = pkey.GetPhoneData(version) }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingMiscData", @@ -6802,11 +6974,11 @@ namespace LibTSforge.Modifiers SLApi.UninstallAllProductKeys(appId); } - Utils.KillSPP(); + SPPUtils.KillSPP(version); - using (IPhysicalStore ps = Utils.GetStore(version, production)) + using (IPhysicalStore ps = SPPUtils.GetStore(version, production)) { - using (ITokenStore tks = Utils.GetTokenStore(version)) + using (ITokenStore tks = SPPUtils.GetTokenStore(version)) { Logger.WriteLine("Writing to physical store and token store..."); @@ -6830,7 +7002,7 @@ namespace LibTSforge.Modifiers uriMap.Data[pkeyId] = pkey.GetAlgoUri(); tks.SetEntry(uriMapName, "xml", uriMap.Serialize()); - string skuMetaName = actId.ToString() + metSuffix; + string skuMetaName = actId + metSuffix; TokenMeta skuMeta = tks.GetMetaEntry(skuMetaName); foreach (string k in skuMeta.Data.Keys) @@ -6857,7 +7029,7 @@ namespace LibTSforge.Modifiers Data = pkb.Serialize() }); - string cachePath = Utils.GetTokensPath(version).Replace("tokens.dat", @"cache\cache.dat"); + string cachePath = SPPUtils.GetTokensPath(version).Replace("tokens.dat", @"cache\cache.dat"); if (File.Exists(cachePath)) File.Delete(cachePath); } } @@ -6872,19 +7044,19 @@ namespace LibTSforge.Modifiers // Modifiers/GracePeriodReset.cs namespace LibTSforge.Modifiers { - using System; using System.Collections.Generic; using System.Linq; - using LibTSforge.PhysicalStore; + using PhysicalStore; + using SPP; public static class GracePeriodReset { public static void Reset(PSVersion version, bool production) { - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { string value = "msft:sl/timer"; List blocks = store.FindBlocks(value).ToList(); @@ -6895,6 +7067,7 @@ namespace LibTSforge.Modifiers } } + SPPUtils.RestartSPP(version); Logger.WriteLine("Successfully reset all grace and evaluation period timers."); } } @@ -6906,15 +7079,19 @@ namespace LibTSforge.Modifiers { using System.Collections.Generic; using System.Linq; - using LibTSforge.PhysicalStore; - using LibTSforge; + using PhysicalStore; + using SPP; + using System; + public static class KeyChangeLockDelete { public static void Delete(PSVersion version, bool production) { - Utils.KillSPP(); + if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008."); + + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { List values = new List { @@ -6942,12 +7119,12 @@ namespace LibTSforge.Modifiers { using System; using System.IO; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; + using PhysicalStore; + using SPP; public static class KMSHostCharge { - public static void Charge(PSVersion version, Guid actId, bool production) + public static void Charge(PSVersion version, bool production, Guid actId) { if (actId == Guid.Empty) { @@ -6971,76 +7148,113 @@ namespace LibTSforge.Modifiers string key = string.Format("SPPSVC\\{0}", appId); long ldapTimestamp = DateTime.Now.ToFileTime(); + byte[] cmidGuids = { }; + byte[] reqCounts = { }; + byte[] kmsChargeData = { }; + BinaryWriter writer = new BinaryWriter(new MemoryStream()); - for (int i = 0; i < currClients; i++) + if (version == PSVersion.Vista) { - writer.Write(ldapTimestamp - (10 * (i + 1))); - writer.Write(Guid.NewGuid().ToByteArray()); + writer.Write(new byte[44]); + writer.Seek(0, SeekOrigin.Begin); + + writer.Write(totalClients); + writer.Write(43200); + writer.Write(32); + + writer.Seek(20, SeekOrigin.Begin); + writer.Write((byte)currClients); + + writer.Seek(32, SeekOrigin.Begin); + writer.Write((byte)currClients); + + writer.Seek(0, SeekOrigin.End); + + for (int i = 0; i < currClients; i++) + { + writer.Write(Guid.NewGuid().ToByteArray()); + writer.Write(ldapTimestamp - (10 * (i + 1))); + } + + kmsChargeData = writer.GetBytes(); + } + else + { + for (int i = 0; i < currClients; i++) + { + writer.Write(ldapTimestamp - (10 * (i + 1))); + writer.Write(Guid.NewGuid().ToByteArray()); + } + + cmidGuids = writer.GetBytes(); + + writer = new BinaryWriter(new MemoryStream()); + + writer.Write(new byte[40]); + + writer.Seek(4, SeekOrigin.Begin); + writer.Write((byte)currClients); + + writer.Seek(24, SeekOrigin.Begin); + writer.Write((byte)currClients); + + reqCounts = writer.GetBytes(); } - byte[] cmidGuids = writer.GetBytes(); - - writer = new BinaryWriter(new MemoryStream()); - - writer.Write(new byte[40]); - - writer.Seek(4, SeekOrigin.Begin); - writer.Write((byte)currClients); - - writer.Seek(24, SeekOrigin.Begin); - writer.Write((byte)currClients); - byte[] reqCounts = writer.GetBytes(); - - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { - VariableBag kmsCountData = new VariableBag(); - kmsCountData.Blocks.AddRange(new CRCBlock[] + if (version != PSVersion.Vista) { - new CRCBlock + VariableBag kmsCountData = new VariableBag(version); + kmsCountData.Blocks.AddRange(new[] { - DataType = CRCBlockType.BINARY, - KeyAsStr = "SppBindingLicenseData", - Value = hwidBlock - }, - new CRCBlock - { - DataType = CRCBlockType.UINT, - Key = new byte[] { }, - ValueAsInt = (uint)totalClients - }, - new CRCBlock - { - DataType = CRCBlockType.UINT, - Key = new byte[] { }, - ValueAsInt = 1051200000 - }, - new CRCBlock - { - DataType = CRCBlockType.UINT, - Key = new byte[] { }, - ValueAsInt = (uint)currClients - }, - new CRCBlock - { - DataType = CRCBlockType.BINARY, - Key = new byte[] { }, - Value = cmidGuids - }, - new CRCBlock - { - DataType = CRCBlockType.BINARY, - Key = new byte[] { }, - Value = reqCounts - } - }); + new CRCBlockModern + { + DataType = CRCBlockType.BINARY, + KeyAsStr = "SppBindingLicenseData", + Value = hwidBlock + }, + new CRCBlockModern + { + DataType = CRCBlockType.UINT, + Key = new byte[] { }, + ValueAsInt = (uint)totalClients + }, + new CRCBlockModern + { + DataType = CRCBlockType.UINT, + Key = new byte[] { }, + ValueAsInt = 1051200000 + }, + new CRCBlockModern + { + DataType = CRCBlockType.UINT, + Key = new byte[] { }, + ValueAsInt = (uint)currClients + }, + new CRCBlockModern + { + DataType = CRCBlockType.BINARY, + Key = new byte[] { }, + Value = cmidGuids + }, + new CRCBlockModern + { + DataType = CRCBlockType.BINARY, + Key = new byte[] { }, + Value = reqCounts + } + }); - byte[] kmsChargeData = kmsCountData.Serialize(); - string countVal = string.Format("msft:spp/kms/host/2.0/store/counters/{0}", appId); + kmsChargeData = kmsCountData.Serialize(); + } + + string countVal = version == PSVersion.Vista ? "C8F6FFF1-79CE-404C-B150-F97991273DF1" : string.Format("msft:spp/kms/host/2.0/store/counters/{0}", appId); store.DeleteBlock(key, countVal); store.AddBlock(new PSBlock @@ -7054,6 +7268,8 @@ namespace LibTSforge.Modifiers Logger.WriteLine(string.Format("Set charge count to {0} successfully.", currClients)); } + + SPPUtils.RestartSPP(version); } } } @@ -7062,24 +7278,28 @@ namespace LibTSforge.Modifiers // Modifiers/RearmReset.cs namespace LibTSforge.Modifiers { - using System; using System.Collections.Generic; using System.Linq; - using LibTSforge.PhysicalStore; + using PhysicalStore; + using SPP; public static class RearmReset { public static void Reset(PSVersion version, bool production) { - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { List blocks; - if (version == PSVersion.Win7) + if (version == PSVersion.Vista) + { + blocks = store.FindBlocks("740D70D8-6448-4b2f-9063-4A7A463600C5").ToList(); + } + else if (version == PSVersion.Win7) { blocks = store.FindBlocks(0xA0000).ToList(); } @@ -7090,7 +7310,11 @@ namespace LibTSforge.Modifiers foreach (PSBlock block in blocks) { - if (version == PSVersion.Win7) + if (version == PSVersion.Vista) + { + store.DeleteBlock(block.KeyAsStr, block.ValueAsStr); + } + else if (version == PSVersion.Win7) { store.SetBlock(block.KeyAsStr, block.ValueAsInt, new byte[8]); } @@ -7107,38 +7331,110 @@ namespace LibTSforge.Modifiers } +// Modifiers/SetIIDParams.cs +namespace LibTSforge.Modifiers +{ + using PhysicalStore; + using SPP; + using System.IO; + using System; + + public static class SetIIDParams + { + public static void SetParams(PSVersion version, bool production, Guid actId, PKeyAlgorithm algorithm, int group, int serial, ulong security) + { + if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008."); + + Guid appId; + + if (actId == Guid.Empty) + { + appId = SLApi.WINDOWS_APP_ID; + actId = SLApi.GetDefaultActivationID(appId, true); + + if (actId == Guid.Empty) + { + throw new Exception("No applicable activation IDs found."); + } + } + else + { + appId = SLApi.GetAppId(actId); + } + + Guid pkeyId = SLApi.GetInstalledPkeyID(actId); + + SPPUtils.KillSPP(version); + + Logger.WriteLine("Writing TrustedStore data..."); + + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) + { + string key = string.Format("SPPSVC\\{0}\\{1}", appId, actId); + PSBlock keyBlock = store.GetBlock(key, pkeyId.ToString()); + + if (keyBlock == null) + { + throw new InvalidDataException("Failed to get product key data for activation ID " + actId + "."); + } + + VariableBag pkb = new VariableBag(keyBlock.Data, version); + + ProductKey pkey = new ProductKey + { + Group = group, + Serial = serial, + Security = security, + Algorithm = algorithm, + Upgrade = false + }; + + string blockName = version == PSVersion.Win7 ? "SppPkeyShortAuthenticator" : "SppPkeyPhoneActivationData"; + pkb.SetBlock(blockName, pkey.GetPhoneData(version)); + store.SetBlock(key, pkeyId.ToString(), pkb.Serialize()); + } + + Logger.WriteLine("Successfully set IID parameters."); + } + } +} + + // Modifiers/TamperedFlagsDelete.cs namespace LibTSforge.Modifiers { - using System; using System.Linq; - using LibTSforge.PhysicalStore; + using PhysicalStore; + using SPP; public static class TamperedFlagsDelete { public static void DeleteTamperFlags(PSVersion version, bool production) { - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { - if (version != PSVersion.Win7) + if (version == PSVersion.Vista) { - string recreatedFlag = "__##USERSEP-RESERVED##__$$RECREATED-FLAG$$"; - string recoveredFlag = "__##USERSEP-RESERVED##__$$RECOVERED-FLAG$$"; - - DeleteFlag(store, recreatedFlag); - DeleteFlag(store, recoveredFlag); + DeleteFlag(store, "6BE8425B-E3CF-4e86-A6AF-5863E3DCB606"); + } + else if (version == PSVersion.Win7) + { + SetFlag(store, 0xA0001); } else { - SetFlag(store, 0xA0001); + DeleteFlag(store, "__##USERSEP-RESERVED##__$$RECREATED-FLAG$$"); + DeleteFlag(store, "__##USERSEP-RESERVED##__$$RECOVERED-FLAG$$"); } Logger.WriteLine("Successfully cleared the tamper state."); } + + SPPUtils.RestartSPP(version); } private static void DeleteFlag(IPhysicalStore store, string flag) @@ -7158,13 +7454,15 @@ namespace LibTSforge.Modifiers namespace LibTSforge.Modifiers { using System; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; + using PhysicalStore; + using SPP; public static class UniqueIdDelete { public static void DeleteUniqueId(PSVersion version, bool production, Guid actId) { + if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008."); + Guid appId; if (actId == Guid.Empty) @@ -7182,14 +7480,13 @@ namespace LibTSforge.Modifiers appId = SLApi.GetAppId(actId); } - string instId = SLApi.GetInstallationID(actId); Guid pkeyId = SLApi.GetInstalledPkeyID(actId); - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { string key = string.Format("SPPSVC\\{0}\\{1}", appId, actId); PSBlock keyBlock = store.GetBlock(key, pkeyId.ToString()); @@ -7199,7 +7496,7 @@ namespace LibTSforge.Modifiers throw new Exception("No product key found."); } - VariableBag pkb = new VariableBag(keyBlock.Data); + VariableBag pkb = new VariableBag(keyBlock.Data, version); pkb.DeleteBlock("SppPkeyUniqueIdToken"); @@ -7212,18 +7509,143 @@ namespace LibTSforge.Modifiers } +// Activators/AVMA4K.cs +namespace LibTSforge.Activators +{ + using System; + using PhysicalStore; + using SPP; + + public static class AVMA4k + { + public static void Activate(PSVersion version, bool production, Guid actId) + { + if (version != PSVersion.WinModern && version != PSVersion.WinBlue) + { + throw new NotSupportedException("AVMA licenses are not available for this product."); + } + + Guid appId; + if (actId == Guid.Empty) + { + appId = SLApi.WINDOWS_APP_ID; + actId = SLApi.GetDefaultActivationID(appId, false); + + if (actId == Guid.Empty) + { + throw new NotSupportedException("No applicable activation IDs found."); + } + } + else + { + appId = SLApi.GetAppId(actId); + } + + if (SLApi.GetPKeyChannel(SLApi.GetInstalledPkeyID(actId)) != "VT:IA") + { + throw new NotSupportedException("Non-VT:IA product key installed."); + } + + SPPUtils.KillSPP(version); + + Logger.WriteLine("Writing TrustedStore data..."); + + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) + { + string key = string.Format("SPPSVC\\{0}\\{1}", appId, actId); + + long creationTime = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-CREATION-TIME$$").Data, 0); + long tickCount = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-TICKCOUNT-UPTIME$$").Data, 0); + long deltaTime = BitConverter.ToInt64(store.GetBlock(key, "__##USERSEP-RESERVED##__$$UP-TIME-DELTA$$").Data, 0); + + const ulong unknown = 0; + ulong time1 = (ulong)(creationTime + tickCount + deltaTime); + ulong crcBindTime = (ulong)DateTime.UtcNow.ToFileTime(); + ulong timerTime = crcBindTime / 10000; + ulong expiry = Constants.TimerMax / 10000; + + VariableBag avmaBinding = new VariableBag(version); + + avmaBinding.Blocks.AddRange(new[] + { + new CRCBlockModern + { + DataType = CRCBlockType.BINARY, + Key = new byte[] { }, + Value = BitConverter.GetBytes(crcBindTime), + }, + new CRCBlockModern + { + DataType = CRCBlockType.STRING, + Key = new byte[] { }, + ValueAsStr = "AVMA4K", + }, + new CRCBlockModern + { + DataType = CRCBlockType.STRING, + Key = new byte[] { }, + ValueAsStr = "00491-50000-00001-AA666", + } + }); + + byte[] avmaBindingData = avmaBinding.Serialize(); + + Timer avmaTimer = new Timer + { + Unknown = unknown, + Time1 = time1, + Time2 = timerTime, + Expiry = expiry + }; + + string storeVal = string.Format("msft:spp/ia/bind/1.0/store/{0}/{1}", appId, actId); + string timerVal = string.Format("msft:spp/ia/bind/1.0/timer/{0}/{1}", appId, actId); + + store.DeleteBlock(key, storeVal); + store.DeleteBlock(key, timerVal); + + store.AddBlocks(new[] + { + new PSBlock + { + Type = BlockType.NAMED, + Flags = 0x400, + KeyAsStr = key, + ValueAsStr = storeVal, + Data = avmaBindingData, + }, + new PSBlock + { + Type = BlockType.TIMER, + Flags = 0x4, + KeyAsStr = key, + ValueAsStr = timerVal, + Data = avmaTimer.CastToArray() + } + }); + } + + SLApi.RefreshLicenseStatus(); + SLApi.FireStateChangedEvent(appId); + Logger.WriteLine("Activated using AVMA4k successfully."); + } + } +} + + // Activators/ZeroCID.cs namespace LibTSforge.Activators { using System; using System.IO; - using LibTSforge.Crypto; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; + using System.Linq; + using Crypto; + using PhysicalStore; + using SPP; public static class ZeroCID { - public static void Deposit(Guid actId, string instId) + private static void Deposit(Guid actId, string instId) { uint status = SLApi.DepositConfirmationID(actId, instId, Constants.ZeroCID); Logger.WriteLine(string.Format("Depositing fake CID status {0:X}", status)); @@ -7261,16 +7683,16 @@ namespace LibTSforge.Activators string instId = SLApi.GetInstallationID(actId); Guid pkeyId = SLApi.GetInstalledPkeyID(actId); - if (version == PSVersion.Win7) + if (version == PSVersion.Vista || version == PSVersion.Win7) { Deposit(actId, instId); } - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { byte[] hwidBlock = Constants.UniversalHWIDBlock; @@ -7280,7 +7702,11 @@ namespace LibTSforge.Activators byte[] iidHash; - if (version == PSVersion.Win7) + if (version == PSVersion.Vista) + { + iidHash = CryptoUtils.SHA256Hash(Utils.EncodeString(instId)).Take(0x10).ToArray(); + } + else if (version == PSVersion.Win7) { iidHash = CryptoUtils.SHA256Hash(Utils.EncodeString(instId)); } @@ -7297,11 +7723,39 @@ namespace LibTSforge.Activators throw new InvalidDataException("Failed to get product key data for activation ID " + actId + "."); } - VariableBag pkb = new VariableBag(keyBlock.Data); + VariableBag pkb = new VariableBag(keyBlock.Data, version); byte[] pkeyData; - if (version == PSVersion.Win7) + if (version == PSVersion.Vista) + { + pkeyData = pkb.GetBlock("PKeyBasicInfo").Value; + string uniqueId = Utils.DecodeString(pkeyData.Skip(0x120).Take(0x80).ToArray()); + string extPid = Utils.DecodeString(pkeyData.Skip(0x1A0).Take(0x80).ToArray()); + + uint group; + uint.TryParse(extPid.Split('-')[1], out group); + + if (group == 0) + { + throw new FormatException("Extended PID has invalid format."); + } + + ulong shortauth; + + try + { + shortauth = BitConverter.ToUInt64(Convert.FromBase64String(uniqueId.Split('&')[1]), 0); + } + catch + { + throw new FormatException("Key Unique ID has invalid format."); + } + + shortauth |= (ulong)group << 41; + pkeyData = BitConverter.GetBytes(shortauth); + } + else if (version == PSVersion.Win7) { pkeyData = pkb.GetBlock("SppPkeyShortAuthenticator").Value; } @@ -7314,26 +7768,34 @@ namespace LibTSforge.Activators store.SetBlock(key, pkeyId.ToString(), pkb.Serialize()); BinaryWriter writer = new BinaryWriter(new MemoryStream()); - writer.Write(0x20); + writer.Write(iidHash.Length); writer.Write(iidHash); writer.Write(hwidBlock.Length); writer.Write(hwidBlock); byte[] tsHwidData = writer.GetBytes(); writer = new BinaryWriter(new MemoryStream()); - writer.Write(0x20); + writer.Write(iidHash.Length); writer.Write(iidHash); writer.Write(pkeyData.Length); writer.Write(pkeyData); byte[] tsPkeyInfoData = writer.GetBytes(); - store.AddBlocks(new PSBlock[] { + string phoneVersion = version == PSVersion.Vista ? "6.0" : "7.0"; + Guid indexSlid = version == PSVersion.Vista ? actId : pkeyId; + string hwidBlockName = string.Format("msft:Windows/{0}/Phone/Cached/HwidBlock/{1}", phoneVersion, indexSlid); + string pkeyInfoName = string.Format("msft:Windows/{0}/Phone/Cached/PKeyInfo/{1}", phoneVersion, indexSlid); + + store.DeleteBlock(key, hwidBlockName); + store.DeleteBlock(key, pkeyInfoName); + + store.AddBlocks(new[] { new PSBlock { Type = BlockType.NAMED, Flags = 0, KeyAsStr = key, - ValueAsStr = "msft:Windows/7.0/Phone/Cached/HwidBlock/" + pkeyId, + ValueAsStr = hwidBlockName, Data = tsHwidData }, new PSBlock @@ -7341,18 +7803,18 @@ namespace LibTSforge.Activators Type = BlockType.NAMED, Flags = 0, KeyAsStr = key, - ValueAsStr = "msft:Windows/7.0/Phone/Cached/PKeyInfo/" + pkeyId, + ValueAsStr = pkeyInfoName, Data = tsPkeyInfoData } }); } - if (version != PSVersion.Win7) + if (version != PSVersion.Vista && version != PSVersion.Win7) { Deposit(actId, instId); } - SLApi.RefreshLicenseStatus(); + SPPUtils.RestartSPP(version); SLApi.FireStateChangedEvent(appId); Logger.WriteLine("Activated using ZeroCID successfully."); } @@ -7377,7 +7839,7 @@ namespace LibTSforge.TokenStore public class TokenMeta { public string Name; - public Dictionary Data = new Dictionary(); + public readonly Dictionary Data = new Dictionary(); public byte[] Serialize() { @@ -7400,7 +7862,7 @@ namespace LibTSforge.TokenStore return writer.GetBytes(); } - public void Deserialize(byte[] data) + private void Deserialize(byte[] data) { BinaryReader reader = new BinaryReader(new MemoryStream(data)); reader.ReadInt32(); @@ -7457,7 +7919,7 @@ namespace LibTSforge.TokenStore using System.Collections.Generic; using System.IO; using System.Linq; - using LibTSforge.Crypto; + using Crypto; public class TokenStoreModern : ITokenStore { @@ -7471,29 +7933,29 @@ namespace LibTSforge.TokenStore private static readonly byte[] CONTS_FOOTER = Enumerable.Repeat((byte)0xAA, 0x20).ToArray(); private List Entries = new List(); - public FileStream TokensFile; + private readonly FileStream TokensFile; public void Deserialize() { if (TokensFile.Length < BLOCK_SIZE) return; TokensFile.Seek(0x24, SeekOrigin.Begin); - uint nextBlock = 0; + uint nextBlock; BinaryReader reader = new BinaryReader(TokensFile); do { - uint curOffset = reader.ReadUInt32(); + reader.ReadUInt32(); nextBlock = reader.ReadUInt32(); for (int i = 0; i < ENTRIES_PER_BLOCK; i++) { - curOffset = reader.ReadUInt32(); + uint curOffset = reader.ReadUInt32(); bool populated = reader.ReadUInt32() == 1; uint contentOffset = reader.ReadUInt32(); uint contentLength = reader.ReadUInt32(); uint allocLength = reader.ReadUInt32(); - byte[] contentData = new byte[] { }; + byte[] contentData = { }; if (populated) { @@ -7593,11 +8055,10 @@ namespace LibTSforge.TokenStore writer.WritePadding(BLOCK_PAD_SIZE); writer.BaseStream.Seek(curBlockOffset, SeekOrigin.Begin); - byte[] blockHash; byte[] blockData = new byte[BLOCK_SIZE - 0x20]; tokens.Read(blockData, 0, BLOCK_SIZE - 0x20); - blockHash = CryptoUtils.SHA256Hash(blockData); + byte[] blockHash = CryptoUtils.SHA256Hash(blockData); writer.BaseStream.Seek(curBlockOffset + BLOCK_SIZE - 0x20, SeekOrigin.Begin); writer.Write(blockHash); @@ -7728,11 +8189,6 @@ namespace LibTSforge.TokenStore Deserialize(); } - public TokenStoreModern() - { - - } - public void Dispose() { Serialize(); @@ -7763,6 +8219,13 @@ namespace LibTSforge.PhysicalStore public ulong Time2; public ulong Expiry; } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct VistaTimer + { + public ulong Time; + public ulong Expiry; + } } @@ -7867,7 +8330,7 @@ namespace LibTSforge.PhysicalStore using System; using System.Collections.Generic; using System.IO; - using LibTSforge.Crypto; + using Crypto; public class ModernBlock { @@ -7957,7 +8420,7 @@ namespace LibTSforge.PhysicalStore public sealed class PhysicalStoreModern : IPhysicalStore { - private byte[] PreHeaderBytes = new byte[] { }; + private byte[] PreHeaderBytes = { }; private readonly Dictionary> Data = new Dictionary>(); private readonly FileStream TSFile; private readonly PSVersion Version; @@ -8145,46 +8608,50 @@ namespace LibTSforge.PhysicalStore public void DeleteBlock(string key, string value) { - if (Data.ContainsKey(key)) + if (!Data.ContainsKey(key)) { - List blocks = Data[key]; - - foreach (ModernBlock block in blocks) - { - if (block.ValueAsStr == value) - { - blocks.Remove(block); - break; - } - } - - Data[key] = blocks; + return; } + + List blocks = Data[key]; + + foreach (ModernBlock block in blocks) + { + if (block.ValueAsStr == value) + { + blocks.Remove(block); + break; + } + } + + Data[key] = blocks; } public void DeleteBlock(string key, uint value) { - if (Data.ContainsKey(key)) + if (!Data.ContainsKey(key)) { - List blocks = Data[key]; - - foreach (ModernBlock block in blocks) - { - if (block.ValueAsInt == value) - { - blocks.Remove(block); - break; - } - } - - Data[key] = blocks; + return; } + + List blocks = Data[key]; + + foreach (ModernBlock block in blocks) + { + if (block.ValueAsInt == value) + { + blocks.Remove(block); + break; + } + } + + Data[key] = blocks; } public PhysicalStoreModern(string tsPath, bool production, PSVersion version) { TSFile = File.Open(tsPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); - Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSFile.ReadAllBytes(), production)); + Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSFile.ReadAllBytes(), production, version)); TSFile.Seek(0, SeekOrigin.Begin); Version = version; Production = production; @@ -8204,7 +8671,7 @@ namespace LibTSforge.PhysicalStore public byte[] ReadRaw() { - byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSFile.ReadAllBytes(), Production); + byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSFile.ReadAllBytes(), Production, Version); TSFile.Seek(0, SeekOrigin.Begin); return data; } @@ -8275,13 +8742,372 @@ namespace LibTSforge.PhysicalStore } +// PhysicalStore/PhysicalStoreVista.cs +namespace LibTSforge.PhysicalStore +{ + using System; + using System.Collections.Generic; + using System.IO; + using Crypto; + + public class VistaBlock + { + public BlockType Type; + public uint Flags; + public byte[] Value; + public string ValueAsStr + { + get + { + return Utils.DecodeString(Value); + } + set + { + Value = Utils.EncodeString(value); + } + } + public uint ValueAsInt + { + get + { + return BitConverter.ToUInt32(Value, 0); + } + set + { + Value = BitConverter.GetBytes(value); + } + } + public byte[] Data; + public string DataAsStr + { + get + { + return Utils.DecodeString(Data); + } + set + { + Data = Utils.EncodeString(value); + } + } + public uint DataAsInt + { + get + { + return BitConverter.ToUInt32(Data, 0); + } + set + { + Data = BitConverter.GetBytes(value); + } + } + + internal void Encode(BinaryWriter writer) + { + writer.Write((uint)Type); + writer.Write(Flags); + writer.Write(Value.Length); + writer.Write(Data.Length); + writer.Write(Value); + writer.Write(Data); + } + + internal static VistaBlock Decode(BinaryReader reader) + { + uint type = reader.ReadUInt32(); + uint flags = reader.ReadUInt32(); + + int valueLen = reader.ReadInt32(); + int dataLen = reader.ReadInt32(); + + byte[] value = reader.ReadBytes(valueLen); + byte[] data = reader.ReadBytes(dataLen); + return new VistaBlock + { + Type = (BlockType)type, + Flags = flags, + Value = value, + Data = data, + }; + } + } + + public sealed class PhysicalStoreVista : IPhysicalStore + { + private byte[] PreHeaderBytes = { }; + private readonly List Blocks = new List(); + private readonly FileStream TSPrimary; + private readonly FileStream TSSecondary; + private readonly bool Production; + + public byte[] Serialize() + { + BinaryWriter writer = new BinaryWriter(new MemoryStream()); + writer.Write(PreHeaderBytes); + + foreach (VistaBlock block in Blocks) + { + block.Encode(writer); + writer.Align(4); + } + + return writer.GetBytes(); + } + + public void Deserialize(byte[] data) + { + int len = data.Length; + + BinaryReader reader = new BinaryReader(new MemoryStream(data)); + PreHeaderBytes = reader.ReadBytes(8); + + while (reader.BaseStream.Position < len - 0x14) + { + Blocks.Add(VistaBlock.Decode(reader)); + reader.Align(4); + } + } + + public void AddBlock(PSBlock block) + { + Blocks.Add(new VistaBlock + { + Type = block.Type, + Flags = block.Flags, + Value = block.Value, + Data = block.Data + }); + } + + public void AddBlocks(IEnumerable blocks) + { + foreach (PSBlock block in blocks) + { + AddBlock(block); + } + } + + public PSBlock GetBlock(string key, string value) + { + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsStr == value) + { + return new PSBlock + { + Type = block.Type, + Flags = block.Flags, + Key = new byte[0], + Value = block.Value, + Data = block.Data + }; + } + } + + return null; + } + + public PSBlock GetBlock(string key, uint value) + { + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsInt == value) + { + return new PSBlock + { + Type = block.Type, + Flags = block.Flags, + Key = new byte[0], + Value = block.Value, + Data = block.Data + }; + } + } + + return null; + } + + public void SetBlock(string key, string value, byte[] data) + { + for (int i = 0; i < Blocks.Count; i++) + { + VistaBlock block = Blocks[i]; + + if (block.ValueAsStr == value) + { + block.Data = data; + Blocks[i] = block; + break; + } + } + } + + public void SetBlock(string key, uint value, byte[] data) + { + for (int i = 0; i < Blocks.Count; i++) + { + VistaBlock block = Blocks[i]; + + if (block.ValueAsInt == value) + { + block.Data = data; + Blocks[i] = block; + break; + } + } + } + + public void SetBlock(string key, string value, string data) + { + SetBlock(key, value, Utils.EncodeString(data)); + } + + public void SetBlock(string key, string value, uint data) + { + SetBlock(key, value, BitConverter.GetBytes(data)); + } + + public void SetBlock(string key, uint value, string data) + { + SetBlock(key, value, Utils.EncodeString(data)); + } + + public void SetBlock(string key, uint value, uint data) + { + SetBlock(key, value, BitConverter.GetBytes(data)); + } + + public void DeleteBlock(string key, string value) + { + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsStr == value) + { + Blocks.Remove(block); + return; + } + } + } + + public void DeleteBlock(string key, uint value) + { + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsInt == value) + { + Blocks.Remove(block); + return; + } + } + } + + public PhysicalStoreVista(string primaryPath, bool production) + { + TSPrimary = File.Open(primaryPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); + TSSecondary = File.Open(primaryPath.Replace("-0.", "-1."), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); + Production = production; + + Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), production, PSVersion.Vista)); + TSPrimary.Seek(0, SeekOrigin.Begin); + } + + public void Dispose() + { + if (TSPrimary.CanWrite && TSSecondary.CanWrite) + { + byte[] data = PhysStoreCrypto.EncryptPhysicalStore(Serialize(), Production, PSVersion.Vista); + + TSPrimary.SetLength(data.LongLength); + TSSecondary.SetLength(data.LongLength); + + TSPrimary.Seek(0, SeekOrigin.Begin); + TSSecondary.Seek(0, SeekOrigin.Begin); + + TSPrimary.WriteAllBytes(data); + TSSecondary.WriteAllBytes(data); + + TSPrimary.Close(); + TSSecondary.Close(); + } + } + + public byte[] ReadRaw() + { + byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), Production, PSVersion.Vista); + TSPrimary.Seek(0, SeekOrigin.Begin); + return data; + } + + public void WriteRaw(byte[] data) + { + byte[] encrData = PhysStoreCrypto.EncryptPhysicalStore(data, Production, PSVersion.Vista); + + TSPrimary.SetLength(encrData.LongLength); + TSSecondary.SetLength(encrData.LongLength); + + TSPrimary.Seek(0, SeekOrigin.Begin); + TSSecondary.Seek(0, SeekOrigin.Begin); + + TSPrimary.WriteAllBytes(encrData); + TSSecondary.WriteAllBytes(encrData); + + TSPrimary.Close(); + TSSecondary.Close(); + } + + public IEnumerable FindBlocks(string valueSearch) + { + List results = new List(); + + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsStr.Contains(valueSearch)) + { + results.Add(new PSBlock + { + Type = block.Type, + Flags = block.Flags, + Key = new byte[0], + Value = block.Value, + Data = block.Data + }); + } + } + + return results; + } + + public IEnumerable FindBlocks(uint valueSearch) + { + List results = new List(); + + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsInt == valueSearch) + { + results.Add(new PSBlock + { + Type = block.Type, + Flags = block.Flags, + Key = new byte[0], + Value = block.Value, + Data = block.Data + }); + } + } + + return results; + } + } +} + + // PhysicalStore/PhysicalStoreWin7.cs namespace LibTSforge.PhysicalStore { using System; using System.Collections.Generic; using System.IO; - using LibTSforge.Crypto; + using Crypto; public class Win7Block { @@ -8383,7 +9209,7 @@ namespace LibTSforge.PhysicalStore public sealed class PhysicalStoreWin7 : IPhysicalStore { - private byte[] PreHeaderBytes = new byte[] { }; + private byte[] PreHeaderBytes = { }; private readonly List Blocks = new List(); private readonly FileStream TSPrimary; private readonly FileStream TSSecondary; @@ -8557,7 +9383,7 @@ namespace LibTSforge.PhysicalStore TSSecondary = File.Open(primaryPath.Replace("-0.", "-1."), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); Production = production; - Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), production)); + Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), production, PSVersion.Win7)); TSPrimary.Seek(0, SeekOrigin.Begin); } @@ -8583,7 +9409,7 @@ namespace LibTSforge.PhysicalStore public byte[] ReadRaw() { - byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), Production); + byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), Production, PSVersion.Win7); TSPrimary.Seek(0, SeekOrigin.Begin); return data; } @@ -8666,7 +9492,7 @@ namespace LibTSforge.PhysicalStore BINARY = 1 << 2 } - public class CRCBlock + public abstract class CRCBlock { public CRCBlockType DataType; public byte[] Key; @@ -8705,7 +9531,57 @@ namespace LibTSforge.PhysicalStore } } - public void Encode(BinaryWriter writer) + public abstract void Encode(BinaryWriter writer); + public abstract void Decode(BinaryReader reader); + public abstract uint CRC(); + } + + public class CRCBlockVista : CRCBlock + { + public override void Encode(BinaryWriter writer) + { + uint crc = CRC(); + writer.Write((uint)DataType); + writer.Write(0); + writer.Write(Key.Length); + writer.Write(Value.Length); + writer.Write(crc); + + writer.Write(Key); + + writer.Write(Value); + } + + public override void Decode(BinaryReader reader) + { + uint type = reader.ReadUInt32(); + reader.ReadUInt32(); + uint lenName = reader.ReadUInt32(); + uint lenVal = reader.ReadUInt32(); + uint crc = reader.ReadUInt32(); + + byte[] key = reader.ReadBytes((int)lenName); + byte[] value = reader.ReadBytes((int)lenVal); + + DataType = (CRCBlockType)type; + Key = key; + Value = value; + + if (CRC() != crc) + { + throw new InvalidDataException("Invalid CRC in variable bag."); + } + } + + public override uint CRC() + { + return Utils.CRC32(Value); + } + } + + public class CRCBlockModern : CRCBlock + { + public override void Encode(BinaryWriter writer) { uint crc = CRC(); writer.Write(crc); @@ -8720,7 +9596,7 @@ namespace LibTSforge.PhysicalStore writer.Align(8); } - public static CRCBlock Decode(BinaryReader reader) + public override void Decode(BinaryReader reader) { uint crc = reader.ReadUInt32(); uint type = reader.ReadUInt32(); @@ -8733,22 +9609,17 @@ namespace LibTSforge.PhysicalStore byte[] value = reader.ReadBytes((int)lenVal); reader.Align(8); - CRCBlock block = new CRCBlock - { - DataType = (CRCBlockType)type, - Key = key, - Value = value, - }; + DataType = (CRCBlockType)type; + Key = key; + Value = value; - if (block.CRC() != crc) + if (CRC() != crc) { throw new InvalidDataException("Invalid CRC in variable bag."); } - - return block; } - public uint CRC() + public override uint CRC() { BinaryWriter wtemp = new BinaryWriter(new MemoryStream()); wtemp.Write(0); @@ -8764,8 +9635,9 @@ namespace LibTSforge.PhysicalStore public class VariableBag { public List Blocks = new List(); + private readonly PSVersion Version; - public void Deserialize(byte[] data) + private void Deserialize(byte[] data) { int len = data.Length; @@ -8773,7 +9645,19 @@ namespace LibTSforge.PhysicalStore while (reader.BaseStream.Position < len - 0x10) { - Blocks.Add(CRCBlock.Decode(reader)); + CRCBlock block; + + if (Version == PSVersion.Vista) + { + block = new CRCBlockVista(); + } + else + { + block = new CRCBlockModern(); + } + + block.Decode(reader); + Blocks.Add(block); } } @@ -8783,7 +9667,13 @@ namespace LibTSforge.PhysicalStore foreach (CRCBlock block in Blocks) { - block.Encode(writer); + if (Version == PSVersion.Vista) + { + ((CRCBlockVista)block).Encode(writer); + } else + { + ((CRCBlockModern)block).Encode(writer); + } } return writer.GetBytes(); @@ -8829,14 +9719,15 @@ namespace LibTSforge.PhysicalStore } } - public VariableBag(byte[] data) + public VariableBag(byte[] data, PSVersion version) { + Version = version; Deserialize(data); } - public VariableBag() + public VariableBag(PSVersion version) { - + Version = version; } } } @@ -8866,7 +9757,7 @@ if ($env:_debug -eq '0') { [LibTSforge.Logger]::HideOutput = $true } $ver = [LibTSforge.Utils]::DetectVersion() -$prod = [LibTSforge.Utils]::DetectCurrentKey() +$prod = [LibTSforge.SPP.SPPUtils]::DetectCurrentKey() $tsactids = @($args) function Get-WmiInfo { @@ -8918,7 +9809,7 @@ if ($env:resetstuff -eq $null) { $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" if ($licenseStatus -eq 1) { if ($prodDes -match 'KMS' -and $prodDes -notmatch 'CLIENT') { - [LibTSforge.Modifiers.KMSHostCharge]::Charge($ver, $tsactid, $prod) + [LibTSforge.Modifiers.KMSHostCharge]::Charge($ver, $prod, $tsactid) Write-Host "[$prodName] CSVLK is permanently activated with ZeroCID." -ForegroundColor White -BackgroundColor DarkGreen Write-Host "[$prodName] CSVLK is charged with 25 clients for 30 days." -ForegroundColor White -BackgroundColor DarkGreen } diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 641f92d..350ae2a 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -2834,23 +2834,16 @@ $src = @' // Common.cs namespace LibTSforge { - using Microsoft.Win32; using System; using System.IO; using System.Linq; using System.Runtime.InteropServices; - using System.ServiceProcess; using System.Text; - using LibTSforge.Crypto; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; - using LibTSforge.TokenStore; public enum PSVersion { Vista, Win7, - Win8Early, Win8, WinBlue, WinModern @@ -2921,8 +2914,8 @@ namespace LibTSforge 0x92, 0xA6, 0x56, 0x96 }; - // 2^31 - 1 minutes - public static ulong TimerMax = (ulong)TimeSpan.FromMinutes(2147483647).Ticks; + // 2^31 - 8 minutes + public static readonly ulong TimerMax = (ulong)TimeSpan.FromMinutes(2147483640).Ticks; public static readonly string ZeroCID = new string('0', 48); } @@ -2990,20 +2983,6 @@ namespace LibTSforge } return result; } - - public static T CastToStruct(this byte[] data) where T : struct - { - GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned); - try - { - IntPtr ptr = handle.AddrOfPinnedObject(); - return (T)Marshal.PtrToStructure(ptr, typeof(T)); - } - finally - { - handle.Free(); - } - } } public static class FileStreamExt @@ -3024,6 +3003,12 @@ namespace LibTSforge public static class Utils { + [DllImport("kernel32.dll")] + public static extern uint GetSystemDefaultLCID(); + + [DllImport("kernel32.dll")] + public static extern bool Wow64EnableWow64FsRedirection(bool Wow64FsEnableRedirection); + public static string DecodeString(byte[] data) { return Encoding.Unicode.GetString(data).Trim('\0'); @@ -3034,9 +3019,6 @@ namespace LibTSforge return Encoding.Unicode.GetBytes(str + '\0'); } - [DllImport("kernel32.dll")] - public static extern uint GetSystemDefaultLCID(); - public static uint CRC32(byte[] data) { const uint polynomial = 0x04C11DB7; @@ -3060,157 +3042,6 @@ namespace LibTSforge return ~crc; } - public static void KillSPP() - { - ServiceController sc; - - try - { - sc = new ServiceController("sppsvc"); - - if (sc.Status == ServiceControllerStatus.Stopped) - return; - } - catch (InvalidOperationException ex) - { - throw new InvalidOperationException("Unable to access sppsvc: " + ex.Message); - } - - Logger.WriteLine("Stopping sppsvc..."); - - bool stopped = false; - - for (int i = 0; stopped == false && i < 60; i++) - { - try - { - if (sc.Status != ServiceControllerStatus.StopPending) - sc.Stop(); - - sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromMilliseconds(500)); - } - catch (System.ServiceProcess.TimeoutException) - { - continue; - } - catch (InvalidOperationException) - { - System.Threading.Thread.Sleep(500); - continue; - } - - stopped = true; - } - - if (!stopped) - throw new System.TimeoutException("Failed to stop sppsvc"); - - Logger.WriteLine("sppsvc stopped successfully."); - } - - public static string GetPSPath(PSVersion version) - { - switch (version) - { - case PSVersion.Win7: - return Directory.GetFiles( - Environment.GetFolderPath(Environment.SpecialFolder.System), - "7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-8115-601632D005A0") - .FirstOrDefault() ?? ""; - case PSVersion.Win8Early: - case PSVersion.WinBlue: - case PSVersion.Win8: - case PSVersion.WinModern: - return Path.Combine( - Environment.ExpandEnvironmentVariables( - (string)Registry.GetValue( - @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform", - "TokenStore", - string.Empty - ) - ), - "data.dat" - ); - default: - return ""; - } - } - - public static string GetTokensPath(PSVersion version) - { - switch (version) - { - case PSVersion.Win7: - return Path.Combine( - Environment.ExpandEnvironmentVariables("%WINDIR%"), - @"ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" - ); - case PSVersion.Win8Early: - case PSVersion.WinBlue: - case PSVersion.Win8: - case PSVersion.WinModern: - return Path.Combine( - Environment.ExpandEnvironmentVariables( - (string)Registry.GetValue( - @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform", - "TokenStore", - string.Empty - ) - ), - "tokens.dat" - ); - default: - return ""; - } - } - - public static IPhysicalStore GetStore(PSVersion version, bool production) - { - string psPath; - - try - { - psPath = GetPSPath(version); - } - catch - { - throw new FileNotFoundException("Failed to get path of physical store."); - } - - if (string.IsNullOrEmpty(psPath) || !File.Exists(psPath)) - { - throw new FileNotFoundException(string.Format("Physical store not found at expected path {0}.", psPath)); - } - - if (version == PSVersion.Vista) - { - throw new NotSupportedException("Physical store editing is not supported for Windows Vista."); - } - - return version == PSVersion.Win7 ? new PhysicalStoreWin7(psPath, production) : (IPhysicalStore)new PhysicalStoreModern(psPath, production, version); - } - - public static ITokenStore GetTokenStore(PSVersion version) - { - string tokPath; - - try - { - tokPath = GetTokensPath(version); - } - catch - { - throw new FileNotFoundException("Failed to get path of physical store."); - } - - if (string.IsNullOrEmpty(tokPath) || !File.Exists(tokPath)) - { - throw new FileNotFoundException(string.Format("Token store not found at expected path {0}.", tokPath)); - } - - return new TokenStoreModern(tokPath); - } - public static string GetArchitecture() { string arch = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE", EnvironmentVariableTarget.Machine).ToUpperInvariant(); @@ -3226,65 +3057,7 @@ namespace LibTSforge if (build >= 7600 && build <= 7602) return PSVersion.Win7; if (build == 9200) return PSVersion.Win8; - throw new NotSupportedException("Unable to auto-detect version info, please specify one manually using the /ver argument."); - } - - public static bool DetectCurrentKey() - { - SLApi.RefreshLicenseStatus(); - - using (RegistryKey wpaKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\WPA")) - { - foreach (string subKey in wpaKey.GetSubKeyNames()) - { - if (subKey.StartsWith("8DEC0AF1") && subKey.EndsWith("-1")) - { - return subKey.Contains("P"); - } - } - } - - throw new FileNotFoundException("Failed to autodetect key type, specify physical store key with /prod or /test arguments."); - } - - public static void DumpStore(PSVersion version, bool production, string filePath, string encrFilePath) - { - if (encrFilePath == null) - { - encrFilePath = GetPSPath(version); - } - - if (string.IsNullOrEmpty(encrFilePath) || !File.Exists(encrFilePath)) - { - throw new FileNotFoundException("Store does not exist at expected path '" + encrFilePath + "'."); - } - - KillSPP(); - - using (FileStream fs = File.Open(encrFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) - { - byte[] encrData = fs.ReadAllBytes(); - File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production)); - } - - Logger.WriteLine("Store dumped successfully to '" + filePath + "'."); - } - - public static void LoadStore(PSVersion version, bool production, string filePath) - { - if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath)) - { - throw new FileNotFoundException("Store file '" + filePath + "' does not exist."); - } - - KillSPP(); - - using (IPhysicalStore store = GetStore(version, production)) - { - store.WriteRaw(File.ReadAllBytes(filePath)); - } - - Logger.WriteLine("Loaded store file succesfully."); + throw new NotSupportedException("Unable to auto-detect version info"); } } @@ -3377,8 +3150,8 @@ namespace LibTSforge.SPP public class PKeyConfig { - public Dictionary Products = new Dictionary(); - private List loadedPkeyConfigs = new List(); + public readonly Dictionary Products = new Dictionary(); + private readonly List loadedPkeyConfigs = new List(); public void LoadConfig(Guid actId) { @@ -3439,12 +3212,14 @@ namespace LibTSforge.SPP ranges[refActIdStr] = new List(); } - KeyRange keyRange = new KeyRange(); - keyRange.Start = int.Parse(rangeNode.SelectSingleNode("./p:Start", nsmgr).InnerText); - keyRange.End = int.Parse(rangeNode.SelectSingleNode("./p:End", nsmgr).InnerText); - keyRange.EulaType = rangeNode.SelectSingleNode("./p:EulaType", nsmgr).InnerText; - keyRange.PartNumber = rangeNode.SelectSingleNode("./p:PartNumber", nsmgr).InnerText; - keyRange.Valid = rangeNode.SelectSingleNode("./p:IsValid", nsmgr).InnerText.ToLower() == "true"; + KeyRange keyRange = new KeyRange + { + Start = int.Parse(rangeNode.SelectSingleNode("./p:Start", nsmgr).InnerText), + End = int.Parse(rangeNode.SelectSingleNode("./p:End", nsmgr).InnerText), + EulaType = rangeNode.SelectSingleNode("./p:EulaType", nsmgr).InnerText, + PartNumber = rangeNode.SelectSingleNode("./p:PartNumber", nsmgr).InnerText, + Valid = rangeNode.SelectSingleNode("./p:IsValid", nsmgr).InnerText.ToLower() == "true" + }; ranges[refActIdStr].Add(keyRange); } @@ -3458,15 +3233,17 @@ namespace LibTSforge.SPP if (keyRanges.Count > 0 && !Products.ContainsKey(refActId)) { - ProductConfig productConfig = new ProductConfig(); - productConfig.GroupId = group; - productConfig.Edition = configNode.SelectSingleNode("./p:EditionId", nsmgr).InnerText; - productConfig.Description = configNode.SelectSingleNode("./p:ProductDescription", nsmgr).InnerText; - productConfig.Channel = configNode.SelectSingleNode("./p:ProductKeyType", nsmgr).InnerText; - productConfig.Randomized = configNode.SelectSingleNode("./p:ProductKeyType", nsmgr).InnerText.ToLower() == "true"; - productConfig.Algorithm = algorithms[group]; - productConfig.Ranges = keyRanges; - productConfig.ActivationId = refActId; + ProductConfig productConfig = new ProductConfig + { + GroupId = group, + Edition = configNode.SelectSingleNode("./p:EditionId", nsmgr).InnerText, + Description = configNode.SelectSingleNode("./p:ProductDescription", nsmgr).InnerText, + Channel = configNode.SelectSingleNode("./p:ProductKeyType", nsmgr).InnerText, + Randomized = configNode.SelectSingleNode("./p:ProductKeyType", nsmgr).InnerText.ToLower() == "true", + Algorithm = algorithms[group], + Ranges = keyRanges, + ActivationId = refActId + }; Products[refActId] = productConfig; } @@ -3509,11 +3286,6 @@ namespace LibTSforge.SPP } } } - - public PKeyConfig() - { - - } } } @@ -3524,8 +3296,8 @@ namespace LibTSforge.SPP using System; using System.IO; using System.Linq; - using LibTSforge.Crypto; - using LibTSforge.PhysicalStore; + using Crypto; + using PhysicalStore; public class ProductKey { @@ -3539,11 +3311,11 @@ namespace LibTSforge.SPP public ulong Security; public bool Upgrade; public PKeyAlgorithm Algorithm; - public string EulaType; - public string PartNumber; - public string Edition; - public string Channel; - public Guid ActivationId; + public readonly string EulaType; + public readonly string PartNumber; + public readonly string Edition; + public readonly string Channel; + public readonly Guid ActivationId; private string mpc; private string pid2; @@ -3553,6 +3325,11 @@ namespace LibTSforge.SPP get { return BitConverter.GetBytes(klow).Concat(BitConverter.GetBytes(khigh)).ToArray(); } } + public ProductKey() + { + + } + public ProductKey(int serial, ulong security, bool upgrade, PKeyAlgorithm algorithm, ProductConfig config, KeyRange range) { Group = config.GroupId; @@ -3581,22 +3358,22 @@ namespace LibTSforge.SPP public Guid GetPkeyId() { - VariableBag pkb = new VariableBag(); - pkb.Blocks.AddRange(new CRCBlock[] + VariableBag pkb = new VariableBag(PSVersion.WinModern); + pkb.Blocks.AddRange(new[] { - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingProductKey", ValueAsStr = ToString() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingMiscData", Value = new byte[] { } }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingAlgorithm", @@ -3607,16 +3384,6 @@ namespace LibTSforge.SPP return new Guid(CryptoUtils.SHA256Hash(pkb.Serialize()).Take(16).ToArray()); } - public string GetDefaultMPC() - { - int build = Environment.OSVersion.Version.Build; - string defaultMPC = build >= 10240 ? "03612" : - build >= 9600 ? "06401" : - build >= 9200 ? "05426" : - "55041"; - return defaultMPC; - } - public string GetMPC() { if (mpc != null) @@ -3624,10 +3391,15 @@ namespace LibTSforge.SPP return mpc; } - mpc = GetDefaultMPC(); + int build = Environment.OSVersion.Version.Build; + + mpc = build >= 10240 ? "03612" : + build >= 9600 ? "06401" : + build >= 9200 ? "05426" : + "55041"; // setup.cfg doesn't exist in Windows 8+ - string setupcfg = string.Format("{0}\\oobe\\{1}", Environment.SystemDirectory, "setup.cfg"); + string setupcfg = string.Format(@"{0}\oobe\{1}", Environment.SystemDirectory, "setup.cfg"); if (!File.Exists(setupcfg) || Edition.Contains(";")) { @@ -3765,17 +3537,17 @@ namespace LibTSforge.SPP { if (version == PSVersion.Win7) { - Random rnd = new Random(Group * 1000000000 + Serial); - byte[] data = new byte[8]; - rnd.NextBytes(data); - return data; + ulong shortauth = ((ulong)Group << 41) | (Security << 31) | ((ulong)Serial << 1) | (Upgrade ? (ulong)1 : 0); + return BitConverter.GetBytes(shortauth); } int serialHigh = Serial / 1000000; int serialLow = Serial % 1000000; BinaryWriter writer = new BinaryWriter(new MemoryStream()); - writer.Write(new Guid("B8731595-A2F6-430B-A799-FBFFB81A8D73").ToByteArray()); + string algoId = Algorithm == PKeyAlgorithm.PKEY2005 ? "B8731595-A2F6-430B-A799-FBFFB81A8D73" : "660672EF-7809-4CFD-8D54-41B7FB738988"; + + writer.Write(new Guid(algoId).ToByteArray()); writer.Write(Group); writer.Write(serialHigh); writer.Write(serialLow); @@ -3881,40 +3653,40 @@ namespace LibTSforge.SPP public static readonly Guid WINDOWS_APP_ID = new Guid("55c92734-d682-4d71-983e-d6ec3f16059f"); - [DllImport("sppc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] + [DllImport("slc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] private static extern void SLOpen(out IntPtr hSLC); - [DllImport("sppc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] + [DllImport("slc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] private static extern void SLClose(IntPtr hSLC); [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetWindowsInformationDWORD(string ValueName, ref int Value); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLInstallProofOfPurchase(IntPtr hSLC, string pwszPKeyAlgorithm, string pwszPKeyString, uint cbPKeySpecificData, byte[] pbPKeySpecificData, ref Guid PKeyId); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLUninstallProofOfPurchase(IntPtr hSLC, ref Guid PKeyId); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetPKeyInformation(IntPtr hSLC, ref Guid pPKeyId, string pwszValueName, out SLDATATYPE peDataType, out uint pcbValue, out IntPtr ppbValue); - [DllImport("sppcext.dll", CharSet = CharSet.Unicode)] + [DllImport("slcext.dll", CharSet = CharSet.Unicode)] private static extern uint SLActivateProduct(IntPtr hSLC, ref Guid pProductSkuId, byte[] cbAppSpecificData, byte[] pvAppSpecificData, byte[] pActivationInfo, string pwszProxyServer, ushort wProxyPort); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGenerateOfflineInstallationId(IntPtr hSLC, ref Guid pProductSkuId, ref string ppwszInstallationId); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLDepositOfflineConfirmationId(IntPtr hSLC, ref Guid pProductSkuId, string pwszInstallationId, string pwszConfirmationId); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetSLIDList(IntPtr hSLC, SLIDTYPE eQueryIdType, ref Guid pQueryId, SLIDTYPE eReturnIdType, out uint pnReturnIds, out IntPtr ppReturnIds); - [DllImport("sppc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] + [DllImport("slc.dll", CharSet = CharSet.Unicode, PreserveSig = false)] private static extern void SLGetLicensingStatusInformation(IntPtr hSLC, ref Guid pAppID, IntPtr pProductSkuId, string pwszRightName, out uint pnStatusCount, out IntPtr ppLicensingStatus); - [DllImport("sppc.dll", CharSet = CharSet.Unicode)] + [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetInstalledProductKeyIds(IntPtr hSLC, ref Guid pProductSkuId, out uint pnProductKeyIds, out IntPtr ppProductKeyIds); [DllImport("slc.dll", CharSet = CharSet.Unicode)] @@ -3923,9 +3695,6 @@ namespace LibTSforge.SPP [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetProductSkuInformation(IntPtr hSLC, ref Guid pProductSkuId, string pwszValueName, out SLDATATYPE peDataType, out uint pcbValue, out IntPtr ppbValue); - [DllImport("slc.dll", CharSet = CharSet.Unicode)] - private static extern uint SLGetProductSkuInformation(IntPtr hSLC, ref Guid pProductSkuId, string pwszValueName, IntPtr peDataType, out uint pcbValue, out IntPtr ppbValue); - [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLGetLicense(IntPtr hSLC, ref Guid pLicenseFileId, out uint pcbLicenseFile, out IntPtr ppbLicenseFile); @@ -3935,7 +3704,7 @@ namespace LibTSforge.SPP [DllImport("slc.dll", CharSet = CharSet.Unicode)] private static extern uint SLFireEvent(IntPtr hSLC, string pwszEventId, ref Guid pApplicationId); - public class SLContext : IDisposable + private class SLContext : IDisposable { public readonly IntPtr Handle; @@ -3998,11 +3767,10 @@ namespace LibTSforge.SPP { using (SLContext sl = new SLContext()) { - uint status; uint count; IntPtr pProductKeyIds; - status = SLGetInstalledProductKeyIds(sl.Handle, ref actId, out count, out pProductKeyIds); + uint status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_PRODUCT_SKU, ref actId, SLIDTYPE.SL_ID_PKEY, out count, out pProductKeyIds); if (status != 0 || count == 0) { @@ -4026,7 +3794,7 @@ namespace LibTSforge.SPP SLConsumeWindowsRight(0); } - public static bool RefreshTrustedTime(Guid actId) + public static void RefreshTrustedTime(Guid actId) { using (SLContext sl = new SLContext()) { @@ -4034,8 +3802,7 @@ namespace LibTSforge.SPP uint count; IntPtr ppbValue; - uint status = SLGetProductSkuInformation(sl.Handle, ref actId, "TrustedTime", out type, out count, out ppbValue); - return (int)status >= 0 && status != 0xC004F012; + SLGetProductSkuInformation(sl.Handle, ref actId, "TrustedTime", out type, out count, out ppbValue); } } @@ -4051,11 +3818,10 @@ namespace LibTSforge.SPP { using (SLContext sl = new SLContext()) { - uint status; uint count; IntPtr pAppIds; - status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_PRODUCT_SKU, ref actId, SLIDTYPE.SL_ID_APPLICATION, out count, out pAppIds); + uint status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_PRODUCT_SKU, ref actId, SLIDTYPE.SL_ID_APPLICATION, out count, out pAppIds); if (status != 0 || count == 0) { @@ -4083,11 +3849,10 @@ namespace LibTSforge.SPP { using (SLContext sl = new SLContext()) { - uint status; uint count; IntPtr ppReturnLics; - status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_LICENSE, ref licId, SLIDTYPE.SL_ID_LICENSE_FILE, out count, out ppReturnLics); + uint status = SLGetSLIDList(sl.Handle, SLIDTYPE.SL_ID_LICENSE, ref licId, SLIDTYPE.SL_ID_LICENSE_FILE, out count, out ppReturnLics); if (status != 0 || count == 0) { @@ -4149,7 +3914,7 @@ namespace LibTSforge.SPP IntPtr ppbValue; uint status = SLGetProductSkuInformation(sl.Handle, ref actId, "msft:sl/EUL/PHONE/PUBLIC", out type, out count, out ppbValue); - return status >= 0 && status != 0xC004F012; + return status != 0xC004F012; } } @@ -4232,11 +3997,11 @@ namespace LibTSforge.SPP } } - public static uint UninstallProductKey(Guid pkeyId) + public static void UninstallProductKey(Guid pkeyId) { using (SLContext sl = new SLContext()) { - return SLUninstallProofOfPurchase(sl.Handle, ref pkeyId); + SLUninstallProofOfPurchase(sl.Handle, ref pkeyId); } } @@ -4254,6 +4019,390 @@ namespace LibTSforge.SPP } +// SPP/SPPUtils.cs +namespace LibTSforge.SPP +{ + using Microsoft.Win32; + using System; + using System.IO; + using System.Linq; + using System.ServiceProcess; + using Crypto; + using PhysicalStore; + using TokenStore; + + public static class SPPUtils + { + public static void KillSPP(PSVersion version) + { + ServiceController sc; + + string svcName = version == PSVersion.Vista ? "slsvc" : "sppsvc"; + + try + { + sc = new ServiceController(svcName); + + if (sc.Status == ServiceControllerStatus.Stopped) + return; + } + catch (InvalidOperationException ex) + { + throw new InvalidOperationException(string.Format("Unable to access {0}: ", svcName) + ex.Message); + } + + Logger.WriteLine(string.Format("Stopping {0}...", svcName)); + + bool stopped = false; + + for (int i = 0; stopped == false && i < 1080; i++) + { + try + { + if (sc.Status != ServiceControllerStatus.StopPending) + sc.Stop(); + + sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromMilliseconds(500)); + } + catch (System.ServiceProcess.TimeoutException) + { + continue; + } + catch (InvalidOperationException ex) + { + Logger.WriteLine("Warning: Stopping sppsvc failed, retrying. Details: " + ex.Message); + System.Threading.Thread.Sleep(500); + continue; + } + + stopped = true; + } + + if (!stopped) + throw new System.TimeoutException(string.Format("Failed to stop {0}", svcName)); + + Logger.WriteLine(string.Format("{0} stopped successfully.", svcName)); + + if (version == PSVersion.Vista && SPSys.IsSpSysRunning()) + { + Logger.WriteLine("Unloading spsys..."); + + int status = SPSys.ControlSpSys(false); + + if (status < 0) + { + throw new IOException("Failed to unload spsys"); + } + + Logger.WriteLine("spsys unloaded successfully."); + } + } + + public static void RestartSPP(PSVersion version) + { + if (version == PSVersion.Vista) + { + ServiceController sc; + + try + { + sc = new ServiceController("slsvc"); + + if (sc.Status == ServiceControllerStatus.Running) + return; + } + catch (InvalidOperationException ex) + { + throw new InvalidOperationException("Unable to access slsvc: " + ex.Message); + } + + Logger.WriteLine("Starting slsvc..."); + + bool started = false; + + for (int i = 0; started == false && i < 360; i++) + { + try + { + if (sc.Status != ServiceControllerStatus.StartPending) + sc.Start(); + + sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromMilliseconds(500)); + } + catch (System.ServiceProcess.TimeoutException) + { + continue; + } + catch (InvalidOperationException ex) + { + Logger.WriteLine("Warning: Starting slsvc failed, retrying. Details: " + ex.Message); + System.Threading.Thread.Sleep(500); + continue; + } + + started = true; + } + + if (!started) + throw new System.TimeoutException("Failed to start slsvc"); + + Logger.WriteLine("slsvc started successfully."); + } + + SLApi.RefreshLicenseStatus(); + } + + public static bool DetectCurrentKey() + { + SLApi.RefreshLicenseStatus(); + + using (RegistryKey wpaKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\WPA")) + { + foreach (string subKey in wpaKey.GetSubKeyNames()) + { + if (subKey.StartsWith("8DEC0AF1")) + { + return subKey.Contains("P"); + } + } + } + + throw new FileNotFoundException("Failed to autodetect key type, specify physical store key with /prod or /test arguments."); + } + + public static string GetPSPath(PSVersion version) + { + switch (version) + { + case PSVersion.Vista: + case PSVersion.Win7: + return Directory.GetFiles( + Environment.GetFolderPath(Environment.SpecialFolder.System), + "7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-8115-601632D005A0") + .FirstOrDefault() ?? ""; + default: + string psDir = Environment.ExpandEnvironmentVariables( + (string)Registry.GetValue( + @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform", + "TokenStore", + "" + ) + ); + string psPath = Path.Combine(psDir, "data.dat"); + + if (string.IsNullOrEmpty(psDir) || !File.Exists(psPath)) + { + string[] psDirs = + { + @"spp\store", + @"spp\store\2.0", + @"spp\store_test", + @"spp\store_test\2.0" + }; + + foreach (string dir in psDirs) + { + psPath = Path.Combine( + Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.System), + dir + ), + "data.dat" + ); + + if (File.Exists(psPath)) return psPath; + } + } + else + { + return psPath; + } + + throw new FileNotFoundException("Failed to locate physical store."); + } + } + + public static string GetTokensPath(PSVersion version) + { + switch (version) + { + case PSVersion.Vista: + return Path.Combine( + Environment.ExpandEnvironmentVariables("%WINDIR%"), + @"ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\tokens.dat" + ); + case PSVersion.Win7: + return Path.Combine( + Environment.ExpandEnvironmentVariables("%WINDIR%"), + @"ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" + ); + default: + string tokDir = Environment.ExpandEnvironmentVariables( + (string)Registry.GetValue( + @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform", + "TokenStore", + "" + ) + ); + string tokPath = Path.Combine(tokDir, "tokens.dat"); + + if (string.IsNullOrEmpty(tokDir) || !File.Exists(tokPath)) + { + string[] tokDirs = + { + @"spp\store", + @"spp\store\2.0", + @"spp\store_test", + @"spp\store_test\2.0" + }; + + foreach (string dir in tokDirs) + { + tokPath = Path.Combine( + Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.System), + dir + ), + "tokens.dat" + ); + + if (File.Exists(tokPath)) return tokPath; + } + } + else + { + return tokPath; + } + + throw new FileNotFoundException("Failed to locate token store."); + } + } + + public static IPhysicalStore GetStore(PSVersion version, bool production) + { + string psPath = GetPSPath(version); + + switch (version) + { + case PSVersion.Vista: + return new PhysicalStoreVista(psPath, production); + case PSVersion.Win7: + return new PhysicalStoreWin7(psPath, production); + default: + return new PhysicalStoreModern(psPath, production, version); + } + } + + public static ITokenStore GetTokenStore(PSVersion version) + { + string tokPath = GetTokensPath(version); + + return new TokenStoreModern(tokPath); + } + + public static void DumpStore(PSVersion version, bool production, string filePath, string encrFilePath) + { + bool manageSpp = false; + + if (encrFilePath == null) + { + encrFilePath = GetPSPath(version); + manageSpp = true; + KillSPP(version); + } + + if (string.IsNullOrEmpty(encrFilePath) || !File.Exists(encrFilePath)) + { + throw new FileNotFoundException("Store does not exist at expected path '" + encrFilePath + "'."); + } + + try + { + using (FileStream fs = File.Open(encrFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) + { + byte[] encrData = fs.ReadAllBytes(); + File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production, version)); + } + Logger.WriteLine("Store dumped successfully to '" + filePath + "'."); + } + finally + { + if (manageSpp) + { + RestartSPP(version); + } + } + } + + public static void LoadStore(PSVersion version, bool production, string filePath) + { + if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath)) + { + throw new FileNotFoundException("Store file '" + filePath + "' does not exist."); + } + + KillSPP(version); + + using (IPhysicalStore store = GetStore(version, production)) + { + store.WriteRaw(File.ReadAllBytes(filePath)); + } + + RestartSPP(version); + + Logger.WriteLine("Loaded store file successfully."); + } + } +} + + +// SPP/SPSys.cs +namespace LibTSforge.SPP +{ + using Microsoft.Win32.SafeHandles; + using System; + using System.Runtime.InteropServices; + + public class SPSys + { + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile); + private static SafeFileHandle CreateFileSafe(string device) + { + return new SafeFileHandle(CreateFile(device, 0xC0000000, 0, IntPtr.Zero, 3, 0, IntPtr.Zero), true); + } + + [return: MarshalAs(UnmanagedType.Bool)] + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern bool DeviceIoControl([In] SafeFileHandle hDevice, [In] uint dwIoControlCode, [In] IntPtr lpInBuffer, [In] int nInBufferSize, [Out] IntPtr lpOutBuffer, [In] int nOutBufferSize, out int lpBytesReturned, [In] IntPtr lpOverlapped); + + public static bool IsSpSysRunning() + { + SafeFileHandle file = CreateFileSafe(@"\\.\SpDevice"); + IntPtr buffer = Marshal.AllocHGlobal(1); + int bytesReturned; + DeviceIoControl(file, 0x80006008, IntPtr.Zero, 0, buffer, 1, out bytesReturned, IntPtr.Zero); + bool running = Marshal.ReadByte(buffer) != 0; + Marshal.FreeHGlobal(buffer); + file.Close(); + return running; + } + + public static int ControlSpSys(bool start) + { + SafeFileHandle file = CreateFileSafe(@"\\.\SpDevice"); + IntPtr buffer = Marshal.AllocHGlobal(4); + int bytesReturned; + DeviceIoControl(file, start ? 0x8000a000 : 0x8000a004, IntPtr.Zero, 0, buffer, 4, out bytesReturned, IntPtr.Zero); + int result = Marshal.ReadInt32(buffer); + Marshal.FreeHGlobal(buffer); + file.Close(); + return result; + } + } +} + + // Crypto/CryptoUtils.cs namespace LibTSforge.Crypto { @@ -4363,10 +4512,21 @@ namespace LibTSforge.Crypto public static bool HMACVerify(byte[] key, byte[] data, byte[] signature) { - HMACSHA1 hmac = new HMACSHA1(key); return Enumerable.SequenceEqual(signature, HMACSign(key, data)); } + public static byte[] SaltSHASum(byte[] salt, byte[] data) + { + SHA1 sha1 = SHA1.Create(); + byte[] sha_data = salt.Concat(data).ToArray(); + return sha1.ComputeHash(sha_data); + } + + public static bool SaltSHAVerify(byte[] salt, byte[] data, byte[] checksum) + { + return Enumerable.SequenceEqual(checksum, SaltSHASum(salt, data)); + } + public static byte[] SHA256Hash(byte[] data) { using (SHA256 sha256 = SHA256.Create()) @@ -4479,7 +4639,7 @@ namespace LibTSforge.Crypto public static class PhysStoreCrypto { - public static byte[] DecryptPhysicalStore(byte[] data, bool production) + public static byte[] DecryptPhysicalStore(byte[] data, bool production, PSVersion version) { byte[] rsaKey = production ? Keys.PRODUCTION : Keys.TEST; BinaryReader br = new BinaryReader(new MemoryStream(data)); @@ -4487,29 +4647,40 @@ namespace LibTSforge.Crypto byte[] aesKeySig = br.ReadBytes(0x80); byte[] encAesKey = br.ReadBytes(0x80); - if (CryptoUtils.RSAVerifySignature(rsaKey, encAesKey, aesKeySig)) + if (!CryptoUtils.RSAVerifySignature(rsaKey, encAesKey, aesKeySig)) { - byte[] aesKey = CryptoUtils.RSADecrypt(rsaKey, encAesKey); - byte[] decData = CryptoUtils.AESDecrypt(br.ReadBytes((int)br.BaseStream.Length - 0x110), aesKey); - byte[] hmacKey = decData.Take(0x10).ToArray(); - byte[] hmacSig = decData.Skip(0x10).Take(0x14).ToArray(); - byte[] psData = decData.Skip(0x28).ToArray(); - - if (!CryptoUtils.HMACVerify(hmacKey, psData, hmacSig)) - { - Logger.WriteLine("Warning: Failed to verify HMAC. Physical store is either corrupt or in Vista format."); - } - - return psData; + throw new Exception("Failed to decrypt physical store."); } - throw new Exception("Failed to decrypt physical store."); + byte[] aesKey = CryptoUtils.RSADecrypt(rsaKey, encAesKey); + byte[] decData = CryptoUtils.AESDecrypt(br.ReadBytes((int)br.BaseStream.Length - 0x110), aesKey); + byte[] hmacKey = decData.Take(0x10).ToArray(); // SHA-1 salt on Vista + byte[] hmacSig = decData.Skip(0x10).Take(0x14).ToArray(); // SHA-1 hash on Vista + byte[] psData = decData.Skip(0x28).ToArray(); + + if (version != PSVersion.Vista) + { + if (!CryptoUtils.HMACVerify(hmacKey, psData, hmacSig)) + { + throw new InvalidDataException("Failed to verify HMAC. Physical store is corrupt."); + } + } + else + { + if (!CryptoUtils.SaltSHAVerify(hmacKey, psData, hmacSig)) + { + throw new InvalidDataException("Failed to verify checksum. Physical store is corrupt."); + } + } + + return psData; } public static byte[] EncryptPhysicalStore(byte[] data, bool production, PSVersion version) { Dictionary versionTable = new Dictionary { + {PSVersion.Vista, 2}, {PSVersion.Win7, 5}, {PSVersion.Win8, 1}, {PSVersion.WinBlue, 2}, @@ -4523,9 +4694,9 @@ namespace LibTSforge.Crypto byte[] encAesKey = CryptoUtils.RSAEncrypt(rsaKey, aesKey); byte[] aesKeySig = CryptoUtils.RSASign(rsaKey, encAesKey); - byte[] hmacSig = CryptoUtils.HMACSign(hmacKey, data); + byte[] hmacSig = version != PSVersion.Vista ? CryptoUtils.HMACSign(hmacKey, data) : CryptoUtils.SaltSHASum(hmacKey, data); - byte[] decData = new byte[] { }; + byte[] decData = { }; decData = decData.Concat(hmacKey).Concat(hmacSig).Concat(BitConverter.GetBytes(0)).Concat(data).ToArray(); byte[] encData = CryptoUtils.AESEncrypt(decData, aesKey); @@ -4548,9 +4719,9 @@ namespace LibTSforge.Modifiers using System; using System.IO; using Microsoft.Win32; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; - using LibTSforge.TokenStore; + using PhysicalStore; + using SPP; + using TokenStore; public static class GenPKeyInstall { @@ -4576,6 +4747,7 @@ namespace LibTSforge.Modifiers public static void InstallGenPKey(PSVersion version, bool production, Guid actId) { + if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008."); if (actId == Guid.Empty) throw new ArgumentException("Activation ID must be specified for generated product key install."); PKeyConfig pkc = new PKeyConfig(); @@ -4602,7 +4774,7 @@ namespace LibTSforge.Modifiers if (pkey.Algorithm == PKeyAlgorithm.PKEY2009) { uint status = SLApi.InstallProductKey(pkey); - Logger.WriteLine(string.Format("Installing generated product key {0} status {1:X}", pkey.ToString(), status)); + Logger.WriteLine(string.Format("Installing generated product key {0} status {1:X}", pkey, status)); if ((int)status < 0) { @@ -4617,57 +4789,57 @@ namespace LibTSforge.Modifiers if (pkey.Channel == "Volume:GVLK" && version == PSVersion.Win7) throw new NotSupportedException("Fake GVLK generation is not supported on Windows 7."); - VariableBag pkb = new VariableBag(); - pkb.Blocks.AddRange(new CRCBlock[] + VariableBag pkb = new VariableBag(version); + pkb.Blocks.AddRange(new[] { - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingProductKey", ValueAsStr = pkey.ToString() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingMPC", ValueAsStr = pkey.GetMPC() }, - new CRCBlock { + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingPid2", ValueAsStr = pkey.GetPid2() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingPid3", Value = pkey.GetPid3() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingPid4", Value = pkey.GetPid4() }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyChannelId", ValueAsStr = pkey.Channel }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.STRING, KeyAsStr = "SppPkeyBindingEditionId", ValueAsStr = pkey.Edition }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = (version == PSVersion.Win7) ? "SppPkeyShortAuthenticator" : "SppPkeyPhoneActivationData", Value = pkey.GetPhoneData(version) }, - new CRCBlock + new CRCBlockModern { DataType = CRCBlockType.BINARY, KeyAsStr = "SppPkeyBindingMiscData", @@ -4685,11 +4857,11 @@ namespace LibTSforge.Modifiers SLApi.UninstallAllProductKeys(appId); } - Utils.KillSPP(); + SPPUtils.KillSPP(version); - using (IPhysicalStore ps = Utils.GetStore(version, production)) + using (IPhysicalStore ps = SPPUtils.GetStore(version, production)) { - using (ITokenStore tks = Utils.GetTokenStore(version)) + using (ITokenStore tks = SPPUtils.GetTokenStore(version)) { Logger.WriteLine("Writing to physical store and token store..."); @@ -4713,7 +4885,7 @@ namespace LibTSforge.Modifiers uriMap.Data[pkeyId] = pkey.GetAlgoUri(); tks.SetEntry(uriMapName, "xml", uriMap.Serialize()); - string skuMetaName = actId.ToString() + metSuffix; + string skuMetaName = actId + metSuffix; TokenMeta skuMeta = tks.GetMetaEntry(skuMetaName); foreach (string k in skuMeta.Data.Keys) @@ -4740,7 +4912,7 @@ namespace LibTSforge.Modifiers Data = pkb.Serialize() }); - string cachePath = Utils.GetTokensPath(version).Replace("tokens.dat", @"cache\cache.dat"); + string cachePath = SPPUtils.GetTokensPath(version).Replace("tokens.dat", @"cache\cache.dat"); if (File.Exists(cachePath)) File.Delete(cachePath); } } @@ -4755,19 +4927,19 @@ namespace LibTSforge.Modifiers // Modifiers/GracePeriodReset.cs namespace LibTSforge.Modifiers { - using System; using System.Collections.Generic; using System.Linq; - using LibTSforge.PhysicalStore; + using PhysicalStore; + using SPP; public static class GracePeriodReset { public static void Reset(PSVersion version, bool production) { - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { string value = "msft:sl/timer"; List blocks = store.FindBlocks(value).ToList(); @@ -4778,6 +4950,7 @@ namespace LibTSforge.Modifiers } } + SPPUtils.RestartSPP(version); Logger.WriteLine("Successfully reset all grace and evaluation period timers."); } } @@ -4789,15 +4962,19 @@ namespace LibTSforge.Modifiers { using System.Collections.Generic; using System.Linq; - using LibTSforge.PhysicalStore; - using LibTSforge; + using PhysicalStore; + using SPP; + using System; + public static class KeyChangeLockDelete { public static void Delete(PSVersion version, bool production) { - Utils.KillSPP(); + if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008."); + + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { List values = new List { @@ -4825,12 +5002,12 @@ namespace LibTSforge.Modifiers { using System; using System.IO; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; + using PhysicalStore; + using SPP; public static class KMSHostCharge { - public static void Charge(PSVersion version, Guid actId, bool production) + public static void Charge(PSVersion version, bool production, Guid actId) { if (actId == Guid.Empty) { @@ -4854,76 +5031,113 @@ namespace LibTSforge.Modifiers string key = string.Format("SPPSVC\\{0}", appId); long ldapTimestamp = DateTime.Now.ToFileTime(); + byte[] cmidGuids = { }; + byte[] reqCounts = { }; + byte[] kmsChargeData = { }; + BinaryWriter writer = new BinaryWriter(new MemoryStream()); - for (int i = 0; i < currClients; i++) + if (version == PSVersion.Vista) { - writer.Write(ldapTimestamp - (10 * (i + 1))); - writer.Write(Guid.NewGuid().ToByteArray()); + writer.Write(new byte[44]); + writer.Seek(0, SeekOrigin.Begin); + + writer.Write(totalClients); + writer.Write(43200); + writer.Write(32); + + writer.Seek(20, SeekOrigin.Begin); + writer.Write((byte)currClients); + + writer.Seek(32, SeekOrigin.Begin); + writer.Write((byte)currClients); + + writer.Seek(0, SeekOrigin.End); + + for (int i = 0; i < currClients; i++) + { + writer.Write(Guid.NewGuid().ToByteArray()); + writer.Write(ldapTimestamp - (10 * (i + 1))); + } + + kmsChargeData = writer.GetBytes(); + } + else + { + for (int i = 0; i < currClients; i++) + { + writer.Write(ldapTimestamp - (10 * (i + 1))); + writer.Write(Guid.NewGuid().ToByteArray()); + } + + cmidGuids = writer.GetBytes(); + + writer = new BinaryWriter(new MemoryStream()); + + writer.Write(new byte[40]); + + writer.Seek(4, SeekOrigin.Begin); + writer.Write((byte)currClients); + + writer.Seek(24, SeekOrigin.Begin); + writer.Write((byte)currClients); + + reqCounts = writer.GetBytes(); } - byte[] cmidGuids = writer.GetBytes(); - - writer = new BinaryWriter(new MemoryStream()); - - writer.Write(new byte[40]); - - writer.Seek(4, SeekOrigin.Begin); - writer.Write((byte)currClients); - - writer.Seek(24, SeekOrigin.Begin); - writer.Write((byte)currClients); - byte[] reqCounts = writer.GetBytes(); - - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { - VariableBag kmsCountData = new VariableBag(); - kmsCountData.Blocks.AddRange(new CRCBlock[] + if (version != PSVersion.Vista) { - new CRCBlock + VariableBag kmsCountData = new VariableBag(version); + kmsCountData.Blocks.AddRange(new[] { - DataType = CRCBlockType.BINARY, - KeyAsStr = "SppBindingLicenseData", - Value = hwidBlock - }, - new CRCBlock - { - DataType = CRCBlockType.UINT, - Key = new byte[] { }, - ValueAsInt = (uint)totalClients - }, - new CRCBlock - { - DataType = CRCBlockType.UINT, - Key = new byte[] { }, - ValueAsInt = 1051200000 - }, - new CRCBlock - { - DataType = CRCBlockType.UINT, - Key = new byte[] { }, - ValueAsInt = (uint)currClients - }, - new CRCBlock - { - DataType = CRCBlockType.BINARY, - Key = new byte[] { }, - Value = cmidGuids - }, - new CRCBlock - { - DataType = CRCBlockType.BINARY, - Key = new byte[] { }, - Value = reqCounts - } - }); + new CRCBlockModern + { + DataType = CRCBlockType.BINARY, + KeyAsStr = "SppBindingLicenseData", + Value = hwidBlock + }, + new CRCBlockModern + { + DataType = CRCBlockType.UINT, + Key = new byte[] { }, + ValueAsInt = (uint)totalClients + }, + new CRCBlockModern + { + DataType = CRCBlockType.UINT, + Key = new byte[] { }, + ValueAsInt = 1051200000 + }, + new CRCBlockModern + { + DataType = CRCBlockType.UINT, + Key = new byte[] { }, + ValueAsInt = (uint)currClients + }, + new CRCBlockModern + { + DataType = CRCBlockType.BINARY, + Key = new byte[] { }, + Value = cmidGuids + }, + new CRCBlockModern + { + DataType = CRCBlockType.BINARY, + Key = new byte[] { }, + Value = reqCounts + } + }); - byte[] kmsChargeData = kmsCountData.Serialize(); - string countVal = string.Format("msft:spp/kms/host/2.0/store/counters/{0}", appId); + kmsChargeData = kmsCountData.Serialize(); + } + + string countVal = version == PSVersion.Vista ? "C8F6FFF1-79CE-404C-B150-F97991273DF1" : string.Format("msft:spp/kms/host/2.0/store/counters/{0}", appId); store.DeleteBlock(key, countVal); store.AddBlock(new PSBlock @@ -4937,6 +5151,8 @@ namespace LibTSforge.Modifiers Logger.WriteLine(string.Format("Set charge count to {0} successfully.", currClients)); } + + SPPUtils.RestartSPP(version); } } } @@ -4945,24 +5161,28 @@ namespace LibTSforge.Modifiers // Modifiers/RearmReset.cs namespace LibTSforge.Modifiers { - using System; using System.Collections.Generic; using System.Linq; - using LibTSforge.PhysicalStore; + using PhysicalStore; + using SPP; public static class RearmReset { public static void Reset(PSVersion version, bool production) { - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { List blocks; - if (version == PSVersion.Win7) + if (version == PSVersion.Vista) + { + blocks = store.FindBlocks("740D70D8-6448-4b2f-9063-4A7A463600C5").ToList(); + } + else if (version == PSVersion.Win7) { blocks = store.FindBlocks(0xA0000).ToList(); } @@ -4973,7 +5193,11 @@ namespace LibTSforge.Modifiers foreach (PSBlock block in blocks) { - if (version == PSVersion.Win7) + if (version == PSVersion.Vista) + { + store.DeleteBlock(block.KeyAsStr, block.ValueAsStr); + } + else if (version == PSVersion.Win7) { store.SetBlock(block.KeyAsStr, block.ValueAsInt, new byte[8]); } @@ -4990,38 +5214,110 @@ namespace LibTSforge.Modifiers } +// Modifiers/SetIIDParams.cs +namespace LibTSforge.Modifiers +{ + using PhysicalStore; + using SPP; + using System.IO; + using System; + + public static class SetIIDParams + { + public static void SetParams(PSVersion version, bool production, Guid actId, PKeyAlgorithm algorithm, int group, int serial, ulong security) + { + if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008."); + + Guid appId; + + if (actId == Guid.Empty) + { + appId = SLApi.WINDOWS_APP_ID; + actId = SLApi.GetDefaultActivationID(appId, true); + + if (actId == Guid.Empty) + { + throw new Exception("No applicable activation IDs found."); + } + } + else + { + appId = SLApi.GetAppId(actId); + } + + Guid pkeyId = SLApi.GetInstalledPkeyID(actId); + + SPPUtils.KillSPP(version); + + Logger.WriteLine("Writing TrustedStore data..."); + + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) + { + string key = string.Format("SPPSVC\\{0}\\{1}", appId, actId); + PSBlock keyBlock = store.GetBlock(key, pkeyId.ToString()); + + if (keyBlock == null) + { + throw new InvalidDataException("Failed to get product key data for activation ID " + actId + "."); + } + + VariableBag pkb = new VariableBag(keyBlock.Data, version); + + ProductKey pkey = new ProductKey + { + Group = group, + Serial = serial, + Security = security, + Algorithm = algorithm, + Upgrade = false + }; + + string blockName = version == PSVersion.Win7 ? "SppPkeyShortAuthenticator" : "SppPkeyPhoneActivationData"; + pkb.SetBlock(blockName, pkey.GetPhoneData(version)); + store.SetBlock(key, pkeyId.ToString(), pkb.Serialize()); + } + + Logger.WriteLine("Successfully set IID parameters."); + } + } +} + + // Modifiers/TamperedFlagsDelete.cs namespace LibTSforge.Modifiers { - using System; using System.Linq; - using LibTSforge.PhysicalStore; + using PhysicalStore; + using SPP; public static class TamperedFlagsDelete { public static void DeleteTamperFlags(PSVersion version, bool production) { - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { - if (version != PSVersion.Win7) + if (version == PSVersion.Vista) { - string recreatedFlag = "__##USERSEP-RESERVED##__$$RECREATED-FLAG$$"; - string recoveredFlag = "__##USERSEP-RESERVED##__$$RECOVERED-FLAG$$"; - - DeleteFlag(store, recreatedFlag); - DeleteFlag(store, recoveredFlag); + DeleteFlag(store, "6BE8425B-E3CF-4e86-A6AF-5863E3DCB606"); + } + else if (version == PSVersion.Win7) + { + SetFlag(store, 0xA0001); } else { - SetFlag(store, 0xA0001); + DeleteFlag(store, "__##USERSEP-RESERVED##__$$RECREATED-FLAG$$"); + DeleteFlag(store, "__##USERSEP-RESERVED##__$$RECOVERED-FLAG$$"); } Logger.WriteLine("Successfully cleared the tamper state."); } + + SPPUtils.RestartSPP(version); } private static void DeleteFlag(IPhysicalStore store, string flag) @@ -5041,13 +5337,15 @@ namespace LibTSforge.Modifiers namespace LibTSforge.Modifiers { using System; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; + using PhysicalStore; + using SPP; public static class UniqueIdDelete { public static void DeleteUniqueId(PSVersion version, bool production, Guid actId) { + if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008."); + Guid appId; if (actId == Guid.Empty) @@ -5065,14 +5363,13 @@ namespace LibTSforge.Modifiers appId = SLApi.GetAppId(actId); } - string instId = SLApi.GetInstallationID(actId); Guid pkeyId = SLApi.GetInstalledPkeyID(actId); - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { string key = string.Format("SPPSVC\\{0}\\{1}", appId, actId); PSBlock keyBlock = store.GetBlock(key, pkeyId.ToString()); @@ -5082,7 +5379,7 @@ namespace LibTSforge.Modifiers throw new Exception("No product key found."); } - VariableBag pkb = new VariableBag(keyBlock.Data); + VariableBag pkb = new VariableBag(keyBlock.Data, version); pkb.DeleteBlock("SppPkeyUniqueIdToken"); @@ -5095,18 +5392,143 @@ namespace LibTSforge.Modifiers } +// Activators/AVMA4K.cs +namespace LibTSforge.Activators +{ + using System; + using PhysicalStore; + using SPP; + + public static class AVMA4k + { + public static void Activate(PSVersion version, bool production, Guid actId) + { + if (version != PSVersion.WinModern && version != PSVersion.WinBlue) + { + throw new NotSupportedException("AVMA licenses are not available for this product."); + } + + Guid appId; + if (actId == Guid.Empty) + { + appId = SLApi.WINDOWS_APP_ID; + actId = SLApi.GetDefaultActivationID(appId, false); + + if (actId == Guid.Empty) + { + throw new NotSupportedException("No applicable activation IDs found."); + } + } + else + { + appId = SLApi.GetAppId(actId); + } + + if (SLApi.GetPKeyChannel(SLApi.GetInstalledPkeyID(actId)) != "VT:IA") + { + throw new NotSupportedException("Non-VT:IA product key installed."); + } + + SPPUtils.KillSPP(version); + + Logger.WriteLine("Writing TrustedStore data..."); + + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) + { + string key = string.Format("SPPSVC\\{0}\\{1}", appId, actId); + + long creationTime = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-CREATION-TIME$$").Data, 0); + long tickCount = BitConverter.ToInt64(store.GetBlock("__##USERSEP##\\$$_RESERVED_$$\\NAMESPACE__", "__##USERSEP-RESERVED##__$$GLOBAL-TICKCOUNT-UPTIME$$").Data, 0); + long deltaTime = BitConverter.ToInt64(store.GetBlock(key, "__##USERSEP-RESERVED##__$$UP-TIME-DELTA$$").Data, 0); + + const ulong unknown = 0; + ulong time1 = (ulong)(creationTime + tickCount + deltaTime); + ulong crcBindTime = (ulong)DateTime.UtcNow.ToFileTime(); + ulong timerTime = crcBindTime / 10000; + ulong expiry = Constants.TimerMax / 10000; + + VariableBag avmaBinding = new VariableBag(version); + + avmaBinding.Blocks.AddRange(new[] + { + new CRCBlockModern + { + DataType = CRCBlockType.BINARY, + Key = new byte[] { }, + Value = BitConverter.GetBytes(crcBindTime), + }, + new CRCBlockModern + { + DataType = CRCBlockType.STRING, + Key = new byte[] { }, + ValueAsStr = "AVMA4K", + }, + new CRCBlockModern + { + DataType = CRCBlockType.STRING, + Key = new byte[] { }, + ValueAsStr = "00491-50000-00001-AA666", + } + }); + + byte[] avmaBindingData = avmaBinding.Serialize(); + + Timer avmaTimer = new Timer + { + Unknown = unknown, + Time1 = time1, + Time2 = timerTime, + Expiry = expiry + }; + + string storeVal = string.Format("msft:spp/ia/bind/1.0/store/{0}/{1}", appId, actId); + string timerVal = string.Format("msft:spp/ia/bind/1.0/timer/{0}/{1}", appId, actId); + + store.DeleteBlock(key, storeVal); + store.DeleteBlock(key, timerVal); + + store.AddBlocks(new[] + { + new PSBlock + { + Type = BlockType.NAMED, + Flags = 0x400, + KeyAsStr = key, + ValueAsStr = storeVal, + Data = avmaBindingData, + }, + new PSBlock + { + Type = BlockType.TIMER, + Flags = 0x4, + KeyAsStr = key, + ValueAsStr = timerVal, + Data = avmaTimer.CastToArray() + } + }); + } + + SLApi.RefreshLicenseStatus(); + SLApi.FireStateChangedEvent(appId); + Logger.WriteLine("Activated using AVMA4k successfully."); + } + } +} + + // Activators/ZeroCID.cs namespace LibTSforge.Activators { using System; using System.IO; - using LibTSforge.Crypto; - using LibTSforge.PhysicalStore; - using LibTSforge.SPP; + using System.Linq; + using Crypto; + using PhysicalStore; + using SPP; public static class ZeroCID { - public static void Deposit(Guid actId, string instId) + private static void Deposit(Guid actId, string instId) { uint status = SLApi.DepositConfirmationID(actId, instId, Constants.ZeroCID); Logger.WriteLine(string.Format("Depositing fake CID status {0:X}", status)); @@ -5144,16 +5566,16 @@ namespace LibTSforge.Activators string instId = SLApi.GetInstallationID(actId); Guid pkeyId = SLApi.GetInstalledPkeyID(actId); - if (version == PSVersion.Win7) + if (version == PSVersion.Vista || version == PSVersion.Win7) { Deposit(actId, instId); } - Utils.KillSPP(); + SPPUtils.KillSPP(version); Logger.WriteLine("Writing TrustedStore data..."); - using (IPhysicalStore store = Utils.GetStore(version, production)) + using (IPhysicalStore store = SPPUtils.GetStore(version, production)) { byte[] hwidBlock = Constants.UniversalHWIDBlock; @@ -5163,7 +5585,11 @@ namespace LibTSforge.Activators byte[] iidHash; - if (version == PSVersion.Win7) + if (version == PSVersion.Vista) + { + iidHash = CryptoUtils.SHA256Hash(Utils.EncodeString(instId)).Take(0x10).ToArray(); + } + else if (version == PSVersion.Win7) { iidHash = CryptoUtils.SHA256Hash(Utils.EncodeString(instId)); } @@ -5180,11 +5606,39 @@ namespace LibTSforge.Activators throw new InvalidDataException("Failed to get product key data for activation ID " + actId + "."); } - VariableBag pkb = new VariableBag(keyBlock.Data); + VariableBag pkb = new VariableBag(keyBlock.Data, version); byte[] pkeyData; - if (version == PSVersion.Win7) + if (version == PSVersion.Vista) + { + pkeyData = pkb.GetBlock("PKeyBasicInfo").Value; + string uniqueId = Utils.DecodeString(pkeyData.Skip(0x120).Take(0x80).ToArray()); + string extPid = Utils.DecodeString(pkeyData.Skip(0x1A0).Take(0x80).ToArray()); + + uint group; + uint.TryParse(extPid.Split('-')[1], out group); + + if (group == 0) + { + throw new FormatException("Extended PID has invalid format."); + } + + ulong shortauth; + + try + { + shortauth = BitConverter.ToUInt64(Convert.FromBase64String(uniqueId.Split('&')[1]), 0); + } + catch + { + throw new FormatException("Key Unique ID has invalid format."); + } + + shortauth |= (ulong)group << 41; + pkeyData = BitConverter.GetBytes(shortauth); + } + else if (version == PSVersion.Win7) { pkeyData = pkb.GetBlock("SppPkeyShortAuthenticator").Value; } @@ -5197,26 +5651,34 @@ namespace LibTSforge.Activators store.SetBlock(key, pkeyId.ToString(), pkb.Serialize()); BinaryWriter writer = new BinaryWriter(new MemoryStream()); - writer.Write(0x20); + writer.Write(iidHash.Length); writer.Write(iidHash); writer.Write(hwidBlock.Length); writer.Write(hwidBlock); byte[] tsHwidData = writer.GetBytes(); writer = new BinaryWriter(new MemoryStream()); - writer.Write(0x20); + writer.Write(iidHash.Length); writer.Write(iidHash); writer.Write(pkeyData.Length); writer.Write(pkeyData); byte[] tsPkeyInfoData = writer.GetBytes(); - store.AddBlocks(new PSBlock[] { + string phoneVersion = version == PSVersion.Vista ? "6.0" : "7.0"; + Guid indexSlid = version == PSVersion.Vista ? actId : pkeyId; + string hwidBlockName = string.Format("msft:Windows/{0}/Phone/Cached/HwidBlock/{1}", phoneVersion, indexSlid); + string pkeyInfoName = string.Format("msft:Windows/{0}/Phone/Cached/PKeyInfo/{1}", phoneVersion, indexSlid); + + store.DeleteBlock(key, hwidBlockName); + store.DeleteBlock(key, pkeyInfoName); + + store.AddBlocks(new[] { new PSBlock { Type = BlockType.NAMED, Flags = 0, KeyAsStr = key, - ValueAsStr = "msft:Windows/7.0/Phone/Cached/HwidBlock/" + pkeyId, + ValueAsStr = hwidBlockName, Data = tsHwidData }, new PSBlock @@ -5224,18 +5686,18 @@ namespace LibTSforge.Activators Type = BlockType.NAMED, Flags = 0, KeyAsStr = key, - ValueAsStr = "msft:Windows/7.0/Phone/Cached/PKeyInfo/" + pkeyId, + ValueAsStr = pkeyInfoName, Data = tsPkeyInfoData } }); } - if (version != PSVersion.Win7) + if (version != PSVersion.Vista && version != PSVersion.Win7) { Deposit(actId, instId); } - SLApi.RefreshLicenseStatus(); + SPPUtils.RestartSPP(version); SLApi.FireStateChangedEvent(appId); Logger.WriteLine("Activated using ZeroCID successfully."); } @@ -5260,7 +5722,7 @@ namespace LibTSforge.TokenStore public class TokenMeta { public string Name; - public Dictionary Data = new Dictionary(); + public readonly Dictionary Data = new Dictionary(); public byte[] Serialize() { @@ -5283,7 +5745,7 @@ namespace LibTSforge.TokenStore return writer.GetBytes(); } - public void Deserialize(byte[] data) + private void Deserialize(byte[] data) { BinaryReader reader = new BinaryReader(new MemoryStream(data)); reader.ReadInt32(); @@ -5340,7 +5802,7 @@ namespace LibTSforge.TokenStore using System.Collections.Generic; using System.IO; using System.Linq; - using LibTSforge.Crypto; + using Crypto; public class TokenStoreModern : ITokenStore { @@ -5354,29 +5816,29 @@ namespace LibTSforge.TokenStore private static readonly byte[] CONTS_FOOTER = Enumerable.Repeat((byte)0xAA, 0x20).ToArray(); private List Entries = new List(); - public FileStream TokensFile; + private readonly FileStream TokensFile; public void Deserialize() { if (TokensFile.Length < BLOCK_SIZE) return; TokensFile.Seek(0x24, SeekOrigin.Begin); - uint nextBlock = 0; + uint nextBlock; BinaryReader reader = new BinaryReader(TokensFile); do { - uint curOffset = reader.ReadUInt32(); + reader.ReadUInt32(); nextBlock = reader.ReadUInt32(); for (int i = 0; i < ENTRIES_PER_BLOCK; i++) { - curOffset = reader.ReadUInt32(); + uint curOffset = reader.ReadUInt32(); bool populated = reader.ReadUInt32() == 1; uint contentOffset = reader.ReadUInt32(); uint contentLength = reader.ReadUInt32(); uint allocLength = reader.ReadUInt32(); - byte[] contentData = new byte[] { }; + byte[] contentData = { }; if (populated) { @@ -5476,11 +5938,10 @@ namespace LibTSforge.TokenStore writer.WritePadding(BLOCK_PAD_SIZE); writer.BaseStream.Seek(curBlockOffset, SeekOrigin.Begin); - byte[] blockHash; byte[] blockData = new byte[BLOCK_SIZE - 0x20]; tokens.Read(blockData, 0, BLOCK_SIZE - 0x20); - blockHash = CryptoUtils.SHA256Hash(blockData); + byte[] blockHash = CryptoUtils.SHA256Hash(blockData); writer.BaseStream.Seek(curBlockOffset + BLOCK_SIZE - 0x20, SeekOrigin.Begin); writer.Write(blockHash); @@ -5611,11 +6072,6 @@ namespace LibTSforge.TokenStore Deserialize(); } - public TokenStoreModern() - { - - } - public void Dispose() { Serialize(); @@ -5646,6 +6102,13 @@ namespace LibTSforge.PhysicalStore public ulong Time2; public ulong Expiry; } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct VistaTimer + { + public ulong Time; + public ulong Expiry; + } } @@ -5750,7 +6213,7 @@ namespace LibTSforge.PhysicalStore using System; using System.Collections.Generic; using System.IO; - using LibTSforge.Crypto; + using Crypto; public class ModernBlock { @@ -5840,7 +6303,7 @@ namespace LibTSforge.PhysicalStore public sealed class PhysicalStoreModern : IPhysicalStore { - private byte[] PreHeaderBytes = new byte[] { }; + private byte[] PreHeaderBytes = { }; private readonly Dictionary> Data = new Dictionary>(); private readonly FileStream TSFile; private readonly PSVersion Version; @@ -6028,46 +6491,50 @@ namespace LibTSforge.PhysicalStore public void DeleteBlock(string key, string value) { - if (Data.ContainsKey(key)) + if (!Data.ContainsKey(key)) { - List blocks = Data[key]; - - foreach (ModernBlock block in blocks) - { - if (block.ValueAsStr == value) - { - blocks.Remove(block); - break; - } - } - - Data[key] = blocks; + return; } + + List blocks = Data[key]; + + foreach (ModernBlock block in blocks) + { + if (block.ValueAsStr == value) + { + blocks.Remove(block); + break; + } + } + + Data[key] = blocks; } public void DeleteBlock(string key, uint value) { - if (Data.ContainsKey(key)) + if (!Data.ContainsKey(key)) { - List blocks = Data[key]; - - foreach (ModernBlock block in blocks) - { - if (block.ValueAsInt == value) - { - blocks.Remove(block); - break; - } - } - - Data[key] = blocks; + return; } + + List blocks = Data[key]; + + foreach (ModernBlock block in blocks) + { + if (block.ValueAsInt == value) + { + blocks.Remove(block); + break; + } + } + + Data[key] = blocks; } public PhysicalStoreModern(string tsPath, bool production, PSVersion version) { TSFile = File.Open(tsPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); - Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSFile.ReadAllBytes(), production)); + Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSFile.ReadAllBytes(), production, version)); TSFile.Seek(0, SeekOrigin.Begin); Version = version; Production = production; @@ -6087,7 +6554,7 @@ namespace LibTSforge.PhysicalStore public byte[] ReadRaw() { - byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSFile.ReadAllBytes(), Production); + byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSFile.ReadAllBytes(), Production, Version); TSFile.Seek(0, SeekOrigin.Begin); return data; } @@ -6158,13 +6625,372 @@ namespace LibTSforge.PhysicalStore } +// PhysicalStore/PhysicalStoreVista.cs +namespace LibTSforge.PhysicalStore +{ + using System; + using System.Collections.Generic; + using System.IO; + using Crypto; + + public class VistaBlock + { + public BlockType Type; + public uint Flags; + public byte[] Value; + public string ValueAsStr + { + get + { + return Utils.DecodeString(Value); + } + set + { + Value = Utils.EncodeString(value); + } + } + public uint ValueAsInt + { + get + { + return BitConverter.ToUInt32(Value, 0); + } + set + { + Value = BitConverter.GetBytes(value); + } + } + public byte[] Data; + public string DataAsStr + { + get + { + return Utils.DecodeString(Data); + } + set + { + Data = Utils.EncodeString(value); + } + } + public uint DataAsInt + { + get + { + return BitConverter.ToUInt32(Data, 0); + } + set + { + Data = BitConverter.GetBytes(value); + } + } + + internal void Encode(BinaryWriter writer) + { + writer.Write((uint)Type); + writer.Write(Flags); + writer.Write(Value.Length); + writer.Write(Data.Length); + writer.Write(Value); + writer.Write(Data); + } + + internal static VistaBlock Decode(BinaryReader reader) + { + uint type = reader.ReadUInt32(); + uint flags = reader.ReadUInt32(); + + int valueLen = reader.ReadInt32(); + int dataLen = reader.ReadInt32(); + + byte[] value = reader.ReadBytes(valueLen); + byte[] data = reader.ReadBytes(dataLen); + return new VistaBlock + { + Type = (BlockType)type, + Flags = flags, + Value = value, + Data = data, + }; + } + } + + public sealed class PhysicalStoreVista : IPhysicalStore + { + private byte[] PreHeaderBytes = { }; + private readonly List Blocks = new List(); + private readonly FileStream TSPrimary; + private readonly FileStream TSSecondary; + private readonly bool Production; + + public byte[] Serialize() + { + BinaryWriter writer = new BinaryWriter(new MemoryStream()); + writer.Write(PreHeaderBytes); + + foreach (VistaBlock block in Blocks) + { + block.Encode(writer); + writer.Align(4); + } + + return writer.GetBytes(); + } + + public void Deserialize(byte[] data) + { + int len = data.Length; + + BinaryReader reader = new BinaryReader(new MemoryStream(data)); + PreHeaderBytes = reader.ReadBytes(8); + + while (reader.BaseStream.Position < len - 0x14) + { + Blocks.Add(VistaBlock.Decode(reader)); + reader.Align(4); + } + } + + public void AddBlock(PSBlock block) + { + Blocks.Add(new VistaBlock + { + Type = block.Type, + Flags = block.Flags, + Value = block.Value, + Data = block.Data + }); + } + + public void AddBlocks(IEnumerable blocks) + { + foreach (PSBlock block in blocks) + { + AddBlock(block); + } + } + + public PSBlock GetBlock(string key, string value) + { + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsStr == value) + { + return new PSBlock + { + Type = block.Type, + Flags = block.Flags, + Key = new byte[0], + Value = block.Value, + Data = block.Data + }; + } + } + + return null; + } + + public PSBlock GetBlock(string key, uint value) + { + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsInt == value) + { + return new PSBlock + { + Type = block.Type, + Flags = block.Flags, + Key = new byte[0], + Value = block.Value, + Data = block.Data + }; + } + } + + return null; + } + + public void SetBlock(string key, string value, byte[] data) + { + for (int i = 0; i < Blocks.Count; i++) + { + VistaBlock block = Blocks[i]; + + if (block.ValueAsStr == value) + { + block.Data = data; + Blocks[i] = block; + break; + } + } + } + + public void SetBlock(string key, uint value, byte[] data) + { + for (int i = 0; i < Blocks.Count; i++) + { + VistaBlock block = Blocks[i]; + + if (block.ValueAsInt == value) + { + block.Data = data; + Blocks[i] = block; + break; + } + } + } + + public void SetBlock(string key, string value, string data) + { + SetBlock(key, value, Utils.EncodeString(data)); + } + + public void SetBlock(string key, string value, uint data) + { + SetBlock(key, value, BitConverter.GetBytes(data)); + } + + public void SetBlock(string key, uint value, string data) + { + SetBlock(key, value, Utils.EncodeString(data)); + } + + public void SetBlock(string key, uint value, uint data) + { + SetBlock(key, value, BitConverter.GetBytes(data)); + } + + public void DeleteBlock(string key, string value) + { + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsStr == value) + { + Blocks.Remove(block); + return; + } + } + } + + public void DeleteBlock(string key, uint value) + { + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsInt == value) + { + Blocks.Remove(block); + return; + } + } + } + + public PhysicalStoreVista(string primaryPath, bool production) + { + TSPrimary = File.Open(primaryPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); + TSSecondary = File.Open(primaryPath.Replace("-0.", "-1."), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); + Production = production; + + Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), production, PSVersion.Vista)); + TSPrimary.Seek(0, SeekOrigin.Begin); + } + + public void Dispose() + { + if (TSPrimary.CanWrite && TSSecondary.CanWrite) + { + byte[] data = PhysStoreCrypto.EncryptPhysicalStore(Serialize(), Production, PSVersion.Vista); + + TSPrimary.SetLength(data.LongLength); + TSSecondary.SetLength(data.LongLength); + + TSPrimary.Seek(0, SeekOrigin.Begin); + TSSecondary.Seek(0, SeekOrigin.Begin); + + TSPrimary.WriteAllBytes(data); + TSSecondary.WriteAllBytes(data); + + TSPrimary.Close(); + TSSecondary.Close(); + } + } + + public byte[] ReadRaw() + { + byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), Production, PSVersion.Vista); + TSPrimary.Seek(0, SeekOrigin.Begin); + return data; + } + + public void WriteRaw(byte[] data) + { + byte[] encrData = PhysStoreCrypto.EncryptPhysicalStore(data, Production, PSVersion.Vista); + + TSPrimary.SetLength(encrData.LongLength); + TSSecondary.SetLength(encrData.LongLength); + + TSPrimary.Seek(0, SeekOrigin.Begin); + TSSecondary.Seek(0, SeekOrigin.Begin); + + TSPrimary.WriteAllBytes(encrData); + TSSecondary.WriteAllBytes(encrData); + + TSPrimary.Close(); + TSSecondary.Close(); + } + + public IEnumerable FindBlocks(string valueSearch) + { + List results = new List(); + + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsStr.Contains(valueSearch)) + { + results.Add(new PSBlock + { + Type = block.Type, + Flags = block.Flags, + Key = new byte[0], + Value = block.Value, + Data = block.Data + }); + } + } + + return results; + } + + public IEnumerable FindBlocks(uint valueSearch) + { + List results = new List(); + + foreach (VistaBlock block in Blocks) + { + if (block.ValueAsInt == valueSearch) + { + results.Add(new PSBlock + { + Type = block.Type, + Flags = block.Flags, + Key = new byte[0], + Value = block.Value, + Data = block.Data + }); + } + } + + return results; + } + } +} + + // PhysicalStore/PhysicalStoreWin7.cs namespace LibTSforge.PhysicalStore { using System; using System.Collections.Generic; using System.IO; - using LibTSforge.Crypto; + using Crypto; public class Win7Block { @@ -6266,7 +7092,7 @@ namespace LibTSforge.PhysicalStore public sealed class PhysicalStoreWin7 : IPhysicalStore { - private byte[] PreHeaderBytes = new byte[] { }; + private byte[] PreHeaderBytes = { }; private readonly List Blocks = new List(); private readonly FileStream TSPrimary; private readonly FileStream TSSecondary; @@ -6440,7 +7266,7 @@ namespace LibTSforge.PhysicalStore TSSecondary = File.Open(primaryPath.Replace("-0.", "-1."), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); Production = production; - Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), production)); + Deserialize(PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), production, PSVersion.Win7)); TSPrimary.Seek(0, SeekOrigin.Begin); } @@ -6466,7 +7292,7 @@ namespace LibTSforge.PhysicalStore public byte[] ReadRaw() { - byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), Production); + byte[] data = PhysStoreCrypto.DecryptPhysicalStore(TSPrimary.ReadAllBytes(), Production, PSVersion.Win7); TSPrimary.Seek(0, SeekOrigin.Begin); return data; } @@ -6549,7 +7375,7 @@ namespace LibTSforge.PhysicalStore BINARY = 1 << 2 } - public class CRCBlock + public abstract class CRCBlock { public CRCBlockType DataType; public byte[] Key; @@ -6588,7 +7414,57 @@ namespace LibTSforge.PhysicalStore } } - public void Encode(BinaryWriter writer) + public abstract void Encode(BinaryWriter writer); + public abstract void Decode(BinaryReader reader); + public abstract uint CRC(); + } + + public class CRCBlockVista : CRCBlock + { + public override void Encode(BinaryWriter writer) + { + uint crc = CRC(); + writer.Write((uint)DataType); + writer.Write(0); + writer.Write(Key.Length); + writer.Write(Value.Length); + writer.Write(crc); + + writer.Write(Key); + + writer.Write(Value); + } + + public override void Decode(BinaryReader reader) + { + uint type = reader.ReadUInt32(); + reader.ReadUInt32(); + uint lenName = reader.ReadUInt32(); + uint lenVal = reader.ReadUInt32(); + uint crc = reader.ReadUInt32(); + + byte[] key = reader.ReadBytes((int)lenName); + byte[] value = reader.ReadBytes((int)lenVal); + + DataType = (CRCBlockType)type; + Key = key; + Value = value; + + if (CRC() != crc) + { + throw new InvalidDataException("Invalid CRC in variable bag."); + } + } + + public override uint CRC() + { + return Utils.CRC32(Value); + } + } + + public class CRCBlockModern : CRCBlock + { + public override void Encode(BinaryWriter writer) { uint crc = CRC(); writer.Write(crc); @@ -6603,7 +7479,7 @@ namespace LibTSforge.PhysicalStore writer.Align(8); } - public static CRCBlock Decode(BinaryReader reader) + public override void Decode(BinaryReader reader) { uint crc = reader.ReadUInt32(); uint type = reader.ReadUInt32(); @@ -6616,22 +7492,17 @@ namespace LibTSforge.PhysicalStore byte[] value = reader.ReadBytes((int)lenVal); reader.Align(8); - CRCBlock block = new CRCBlock - { - DataType = (CRCBlockType)type, - Key = key, - Value = value, - }; + DataType = (CRCBlockType)type; + Key = key; + Value = value; - if (block.CRC() != crc) + if (CRC() != crc) { throw new InvalidDataException("Invalid CRC in variable bag."); } - - return block; } - public uint CRC() + public override uint CRC() { BinaryWriter wtemp = new BinaryWriter(new MemoryStream()); wtemp.Write(0); @@ -6647,8 +7518,9 @@ namespace LibTSforge.PhysicalStore public class VariableBag { public List Blocks = new List(); + private readonly PSVersion Version; - public void Deserialize(byte[] data) + private void Deserialize(byte[] data) { int len = data.Length; @@ -6656,7 +7528,19 @@ namespace LibTSforge.PhysicalStore while (reader.BaseStream.Position < len - 0x10) { - Blocks.Add(CRCBlock.Decode(reader)); + CRCBlock block; + + if (Version == PSVersion.Vista) + { + block = new CRCBlockVista(); + } + else + { + block = new CRCBlockModern(); + } + + block.Decode(reader); + Blocks.Add(block); } } @@ -6666,7 +7550,13 @@ namespace LibTSforge.PhysicalStore foreach (CRCBlock block in Blocks) { - block.Encode(writer); + if (Version == PSVersion.Vista) + { + ((CRCBlockVista)block).Encode(writer); + } else + { + ((CRCBlockModern)block).Encode(writer); + } } return writer.GetBytes(); @@ -6712,14 +7602,15 @@ namespace LibTSforge.PhysicalStore } } - public VariableBag(byte[] data) + public VariableBag(byte[] data, PSVersion version) { + Version = version; Deserialize(data); } - public VariableBag() + public VariableBag(PSVersion version) { - + Version = version; } } } @@ -6749,7 +7640,7 @@ if ($env:_debug -eq '0') { [LibTSforge.Logger]::HideOutput = $true } $ver = [LibTSforge.Utils]::DetectVersion() -$prod = [LibTSforge.Utils]::DetectCurrentKey() +$prod = [LibTSforge.SPP.SPPUtils]::DetectCurrentKey() $tsactids = @($args) function Get-WmiInfo { @@ -6801,7 +7692,7 @@ if ($env:resetstuff -eq $null) { $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" if ($licenseStatus -eq 1) { if ($prodDes -match 'KMS' -and $prodDes -notmatch 'CLIENT') { - [LibTSforge.Modifiers.KMSHostCharge]::Charge($ver, $tsactid, $prod) + [LibTSforge.Modifiers.KMSHostCharge]::Charge($ver, $prod, $tsactid) Write-Host "[$prodName] CSVLK is permanently activated with ZeroCID." -ForegroundColor White -BackgroundColor DarkGreen Write-Host "[$prodName] CSVLK is charged with 25 clients for 30 days." -ForegroundColor White -BackgroundColor DarkGreen } From 172fd7b1c521e84d721653e4c57bec2e321493ad Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Thu, 17 Apr 2025 03:11:21 +0530 Subject: [PATCH 24/30] Fix crash issue when scripts are running under a path with special characters --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 7 +++---- MAS/Separate-Files-Version/Activators/HWID_Activation.cmd | 2 +- MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd | 2 +- .../Activators/Ohook_Activation_AIO.cmd | 2 +- .../Activators/Online_KMS_Activation.cmd | 2 +- .../Activators/TSforge_Activation.cmd | 7 +++---- MAS/Separate-Files-Version/Change_Office_Edition.cmd | 2 +- MAS/Separate-Files-Version/Change_Windows_Edition.cmd | 2 +- MAS/Separate-Files-Version/Extract_OEM_Folder.cmd | 2 +- MAS/Separate-Files-Version/Troubleshoot.cmd | 2 +- 10 files changed, 14 insertions(+), 16 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index f180db7..4eb0dce 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -154,7 +154,6 @@ goto dk_done set "_work=%~dp0" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" -set "_workp=%_work:'=''%" set "_batf=%~f0" set "_batp=%_batf:'=''%" @@ -197,7 +196,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -9733,9 +9732,9 @@ namespace LibTSforge.PhysicalStore } '@ $ErrorActionPreference = 'Stop' -$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll" +$binPath = "$env:_work\BIN\LibTSforge.dll" -if (Test-Path -Path $binPath) { +if (Test-Path -LiteralPath $binPath) { Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..." Add-Type -Path $binPath } diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 8f65bbd..bb694f4 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -235,7 +235,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index bcac266..206ac83 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -238,7 +238,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 04b78db..6de8e0c 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -228,7 +228,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index d8759e2..9f4bed2 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -257,7 +257,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 350ae2a..ebc1399 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -221,7 +221,6 @@ goto dk_done set "_work=%~dp0" if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%" -set "_workp=%_work:'=''%" set "_batf=%~f0" set "_batp=%_batf:'=''%" @@ -264,7 +263,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% @@ -7616,9 +7615,9 @@ namespace LibTSforge.PhysicalStore } '@ $ErrorActionPreference = 'Stop' -$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll" +$binPath = "$env:_work\BIN\LibTSforge.dll" -if (Test-Path -Path $binPath) { +if (Test-Path -LiteralPath $binPath) { Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..." Add-Type -Path $binPath } diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 264a58e..708689b 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -188,7 +188,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 37b02c1..594f857 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -193,7 +193,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index df142d4..34ba8d0 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -187,7 +187,7 @@ goto done2 ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index 483f6da..487b496 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -188,7 +188,7 @@ goto dk_done ::pstst $ExecutionContext.SessionState.LanguageMode :pstst -for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($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';iex ($f[1])}" %nul6%') do (set tstresult=%%a) if /i not "%tstresult%"=="FullLanguage" ( %eline% From 98ef9db3ceffd5fdb49e3a4433be4a76a9a986ca Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sun, 20 Apr 2025 19:35:53 +0530 Subject: [PATCH 25/30] Add TSforge and Online KMS support for Vista/Server2008 --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 529 +++++++++++++++--- .../Activators/HWID_Activation.cmd | 64 ++- .../Activators/KMS38_Activation.cmd | 64 ++- .../Activators/Ohook_Activation_AIO.cmd | 55 +- .../Activators/Online_KMS_Activation.cmd | 249 +++++++-- .../Activators/TSforge_Activation.cmd | 321 +++++++++-- .../Change_Office_Edition.cmd | 26 +- .../Change_Windows_Edition.cmd | 26 +- .../Check_Activation_Status.cmd | 5 +- .../Extract_OEM_Folder.cmd | 39 +- MAS/Separate-Files-Version/Troubleshoot.cmd | 114 ++-- 11 files changed, 1211 insertions(+), 281 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 4eb0dce..fd2f429 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -141,10 +141,27 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble goto dk_done ) -if %winbuild% LSS 7600 ( +if %winbuild% LSS 6001 ( %nceline% echo Unsupported OS version detected [%winbuild%]. -echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents. +echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents. +if %winbuild% EQU 6000 ( +echo: +echo Windows Vista RTM is not supported because Powershell cannot be installed. +echo Upgrade to Windows Vista SP1 or SP2. +) +goto dk_done +) + +if not exist %ps% ( +%nceline% +echo PowerShell is not installed in your system. +if %winbuild% LSS 7600 ( +echo Install PowerShell using the following URL. +echo: +echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +) goto dk_done ) @@ -1077,10 +1094,16 @@ goto :dk_done :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) @@ -1287,6 +1310,8 @@ exit /b :dk_reeval +if %winbuild% LSS 7600 exit /b + :: This key is left by the system in rearm process and sppsvc sometimes fails to delete it, it causes issues in working of the Scheduled Tasks of SPP set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState" @@ -1332,13 +1357,13 @@ function InstallLicenseArr($Str) { ForEach ($x in $a) {InstallLicenseFile "$x"} } function InstallLicenseDir($Loc) { - dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"} + Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName} } function ReinstallLicenses() { - $Oem = "$env:SysPath\oem" - $Spp = "$env:SysPath\spp\tokens" - InstallLicenseDir "$Spp" - If (Test-Path $Oem) {InstallLicenseDir "$Oem"} + $Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens") + foreach ($Path in $Paths) { + if (Test-Path $Path) { InstallLicenseDir "$Path" } + } } :xrm: @@ -1356,16 +1381,16 @@ exit /b :dk_sppissue -sc start sppsvc %nul% +sc start %_slser% %nul% set spperror=%errorlevel% if %spperror% NEQ 1056 if %spperror% NEQ 0 ( %eline% -echo sc start sppsvc [Error Code: %spperror%] +echo sc start %_slser% [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -1383,6 +1408,10 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) +if %winbuild% LSS 7600 ( +set "winos=!winos:VistaT=Vista!" +set "winos=!winos:Serverr=Server!" +) if not defined winsub exit /b @@ -1429,11 +1458,11 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" -sc start sppsvc %nul% +sc start %_slser% %nul% echo "%errorlevel%" | findstr "577 225" %nul% && ( set "results=%results%[Likely File Infector]" ) || ( -if not exist %SysPath%\sppsvc.exe 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%"=="" ( @@ -1513,6 +1542,7 @@ for %%# in (%serv_ste%) do ( if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%) if /i %%#==wlidsvc sc config %%# start= demand %nul% if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%) +if /i %%#==SLsvc sc config %%# start= auto %nul% if /i %%#==KeyIso sc config %%# start= demand %nul% if /i %%#==LicenseManager sc config %%# start= demand %nul% if /i %%#==Winmgmt sc config %%# start= auto %nul% @@ -1642,7 +1672,7 @@ if %osedition%==0 ( call :dk_color %Red% "Checking Edition Name [Not Found In Registry]" ) else ( -if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( +if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( set skunotfound=1 call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]" ) @@ -1724,7 +1754,7 @@ call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %m ) -for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( +for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#")) ) if defined _sppint ( @@ -1738,14 +1768,14 @@ echo Checking SPP In IFEO [%_sppint%] ) -for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( +if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul% call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null" ) -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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" @@ -1755,21 +1785,22 @@ set showfix=1 set tokenstore= +if %winbuild% GEQ 7600 ( for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b" if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform" -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" ( set toerr=1 set error=1 set showfix=1 -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!]" set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) - +) :: This code creates token folder only if it's missing and sets default permission for it -if not defined toerr if not exist "%tokenstore%\" ( +if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" ( mkdir "%tokenstore%" %nul% if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';" if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';" @@ -1790,7 +1821,7 @@ set showfix=1 if not defined notwinact ( call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( -%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($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\:.*';iex ($f[1]); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" @@ -1805,7 +1836,7 @@ call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]" ) -if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( +if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( set error=1 call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]" ) @@ -1940,8 +1971,10 @@ $wpaKey.Close() if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 ) exit /b @@ -1949,8 +1982,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 ) exit /b @@ -3669,6 +3704,18 @@ if /i "%%A"=="/Z-Reset" (set _resall=1) if not defined tsids set _actman=0 for %%A in (%_actwin% %_actesu% %_actoff% %_actprojvis% %_actwinesuoff% %_actwinhost% %_actoffhost% %_actappx% %_actman% %_resall%) do (if "%%A"=="1" set _unattended=1) +if %winbuild% LSS 7600 ( +reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" /v Install %nul2% | find /i "0x1" %nul1% || ( +%eline% +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 +start https://www.microsoft.com/download/details.aspx?id=25150 +goto dk_done +) +) + ::======================================================================================================================================== :ts_menu @@ -3696,7 +3743,11 @@ echo [A] Activate - Windows %KS% Host echo [B] Activate - Office %KS% Host echo [C] Activate - Windows 8/8.1 APPX Sideloading echo [D] Activate - Manually Select Products +if defined _vis ( +echo [E] Reset - Rearm/Timers +) else ( echo [E] Reset - Rearm/Timers/Tamper/Lock +) echo _______________________________________________ echo: echo [6] Remove TSforge Activation @@ -3742,9 +3793,9 @@ echo: echo Initializing... call :dk_chkmal -if not exist %SysPath%\sppsvc.exe ( +if not exist %SysPath%\%_slexe% ( %eline% -echo [%SysPath%\sppsvc.exe] file is missing, aborting... +echo [%SysPath%\%_slexe%] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -3767,10 +3818,10 @@ goto dk_done if %winbuild% LSS 9200 if exist "%SysPath%\wlms\wlms.exe" ( sc query wlms | find /i "RUNNING" %nul% && ( -sc stop sppsvc %nul% +sc stop %_slser% %nul% if !errorlevel! EQU 1051 ( %eline% -echo Evaluation WLMS service is running, sppsvc 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: set fixes=%fixes% %mas%troubleshoot @@ -3803,7 +3854,7 @@ call :dk_showosinfo echo Initiating Diagnostic Tests... -set "_serv=sppsvc Winmgmt" +set "_serv=%_slser% Winmgmt" :: Software Protection :: Windows Management Instrumentation @@ -3852,6 +3903,8 @@ call :dk_color %Gray% "Checking OS Activation [Windows is alrea goto :ts_esu ) +if defined _vis goto :ts_winvista + set tempid= set keytype=zero for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( @@ -3874,6 +3927,86 @@ goto :ts_esu ::======================================================================================================================================== +:ts_winvista + +:: Process Windows Vista + +:: 1st column = Activation ID +:: 2nd column = Generic key +:: 3rd column = Key channel +:: 4th column = Edition ID +:: Separator = _ + +:: Keys aren't available for these editions, but since these editions aren't publicly available, it doesn't matter +:: a797d61e-1475-470b-86c8-f737a72c188d StarterN +:: 5e9f548a-c8a9-44e6-a6c2-3f8d0a7a99dd ServerComputeClusterV + +set f= +set key= +set tempid= +if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f + +for %%# in ( +:: WindowsVista +9de9abe2-d01d-4538-af84-4498bdbc2ba3_4D2XH-PRBMM-8Q22B-K8BM3-MR%f%W4W_____Retail_Business +db442be4-81ed-4ab3-9d66-2417e8a5c81c_76884-QXFY2-6Q2WX-2QTQ8-QX%f%X44_____Retail_BusinessN +b51791c2-b562-4b73-97b0-735a0e4429a6_YQPQV-RW8R3-XMPFG-RXG9R-JG%f%TVF_____Retail_Enterprise +58c37517-42f8-4723-bb44-30b05791ff2a_Q7J9R-G63R4-BFMHF-FWM9R-RW%f%DMV_____Retail_EnterpriseN +95c6e80a-0ff8-4bd0-95f2-c4a39b79d09e_RCG7P-TX42D-HM8FM-TCFCW-3V%f%4VD_____Retail_HomeBasic +d0333dad-c14e-46f2-b62a-8b47a1b9768b_HY2VV-XC6FF-MD6WV-FPYBQ-GF%f%JBT_____Retail_HomeBasicN +9e042223-03bf-49ae-808f-ff37f128d40d_X9HTF-MKJQQ-XK376-TJ7T4-76%f%PKF_____Retail_HomePremium +92d8977c-d506-4e63-b500-6d39283b6cd5_KJ6TP-PF9W2-23T3Q-XTV7M-PX%f%DT2_____Retail_HomePremiumN +89e51a3c-76c0-4beb-a650-53d34c8f8186_X9PYV-YBQRV-9BXWV-TQDMK-QD%f%WK4_____Retail_Starter +30fab9cc-8614-4339-989f-7ce61fb7a5c4_VMCB9-FDRV6-6CDQM-RV23K-RP%f%8F7_____Retail_Ultimate +1eefed20-8ac0-478c-8774-70cd44782ea1_CVX38-P27B4-2X8BT-RXD4J-V7%f%CKX_____Retail_UltimateN +:: WindowsServer2008 +c9ad502b-ef48-41d1-a2a0-38a38e82fed0_24FV9-H7JW8-C8Q6X-BQKMK-K9%f%77J_____Retail_ServerComputeCluster +866e924e-c2a3-4872-aca1-6b48c13962d5_6QBHY-DXTPJ-T9W3P-DTJXX-4V%f%QMB_____Retail_ServerDatacenter +d020c729-07f0-4f8f-87ce-bf803275c786_83TWG-TD3TC-HRDP2-K93FJ-Y3%f%4YC_OEM:NONSLP_ServerDatacenterV +32b40e5e-0c6d-4c6f-ab12-a031933fd2c6_MRB7H-QJRHG-FXTBR-B2Q2M-8W%f%MTJ_____Retail_ServerEnterprise +256cc990-1692-4ea8-965c-2d423d5dd24e_H4VB6-QPRWH-VDCYM-996P8-MH%f%KFY_OEM:NONSLP_ServerEnterpriseIA64 +1ba5e036-e386-42c4-b7eb-16bdb4fa1945_H8H7M-HDPQT-PJHQF-M7B83-9C%f%VGV_____Retail_ServerEnterpriseV +8df04457-07c8-4301-bce9-d61eb76cb2d6_RGBMC-PQBVF-94Q9K-HD63B-VY%f%6MP_____Retail_ServerHomePremium +5bd23b19-aa71-4a5b-8b68-c8801c2baff6_6C8KR-MD3QK-9GWFW-44CY2-W9%f%CBM_____Retail_ServerHomeStandard +b86c7736-91ff-4de9-bfa9-b32b8a09acac_7XRBY-6MP2K-VQPT8-F37JV-YY%f%Q83_____Retail_ServerMediumBusinessManagement +d3f5642f-081d-40b2-a4b9-efd3054d4584_6PDTD-JK48J-662TF-8J2QV-R4%f%CRB_____Retail_ServerMediumBusinessMessaging +c6936a36-69f3-4994-9857-3069c7b9ec7a_D694V-CMWKH-PY92X-PFQKQ-JC%f%B69_____Retail_ServerMediumBusinessSecurity +cc4c2cf8-ef29-4d8e-b168-2b65a3db3309_MRDK3-YYQF3-88BQJ-D6FJG-69%f%YJY_____Retail_ServerSBSPremium +b3827b27-bd38-4284-98af-e4f4d1c051a0_2KB23-GJRBD-W3T9C-6CH2W-39%f%B7V_____Retail_ServerSBSPrime +5dad0eff-3f6f-4310-8844-422f9dc7c84b_H4XDD-B27GY-667P6-XWVV7-GY%f%G8J_____Retail_ServerSBSStandard +603504f9-109f-49f0-9271-8c66f7878f58_8YVM4-YQBDH-7WDQM-R27WR-WV%f%CWG_____Retail_ServerStandard +65ab7338-9ad0-43fe-af1b-190b577495e2_H9MW3-6V7GK-94P9G-7FTPJ-VK%f%CKF_____Retail_ServerStandardV +2be204da-24a0-4943-b66c-81e8464acd7e_2264C-TD9T8-P8HPW-CC9GH-MH%f%M2V_____Retail_ServerStorageEnterprise +60207eba-8b4a-486c-a013-023b4b742c2f_RCYMT-YX342-8T6YY-XYHYC-3D%f%D7X_____Retail_ServerStorageExpress +368856e9-43f7-4601-8358-e561f36c7dd8_FKFT2-WXYY9-WBPY7-6YMY4-X4%f%8JF_____Retail_ServerStorageStandard +4bf433fa-ab04-4c6c-b55b-00170e14b8cd_8X9J7-HCJ7J-3WDJT-QM7D8-46%f%4YH_____Retail_ServerStorageWorkgroup +a77a6806-f59e-4953-97d7-229317b8e6a6_BGT39-9FYH7-X2CYD-T628F-QP%f%QPW_____Retail_ServerWeb +f92f836d-4d3e-4e90-a08f-2d612d65e716_HPH76-FHFPP-DRW9D-7W2V4-HW%f%GKT_____Retail_ServerWinSB +3059a9fd-b068-4f0d-acaf-66324dca67ac_2V8G6-KRXYR-MMGXJ-6RWM3-GX%f%CCG_____Retail_ServerWinSBV +) do ( +for /f "tokens=1-4 delims=_" %%A in ("%%#") do if %tsedition%==%%D if not defined key ( +echo "%allapps%" | find /i "%%A" %nul1% && ( +set key=%%B +set tempid=%%A +) +) +) + +if not defined key ( +set error=1 +call :dk_color %Red% "Checking Activation ID [%tsedition% SKU-%osSKU% not found in the system]" +call :dk_color %Blue% "%_fixmsg%" +goto :ts_esu +) + +echo Checking Activation ID [%tempid%] [%tsedition%] + +call :ts_inskey "[%key%]" +if not defined error set tsids=%tsids% %tempid% +goto :ts_esu + +::======================================================================================================================================== + :ts_wineval call :dk_color %Gray% "Checking OS Edition [%tsedition%] [Evaluation edition found]" @@ -3990,19 +4123,7 @@ goto :ts_esu echo Resetting Rearm / GracePeriod [Successful] ) -%psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% -set keyerror=%errorlevel% -cmd /c exit /b %keyerror% -if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" - -if %keyerror% EQU 0 ( -call :dk_refresh -echo Installing Activable Evaluation Key [%key%] [Successful] -) else ( -set error=1 -call :dk_color %Red% "Installing Activable Evaluation Key [%key%] [Failed] %keyerror%" -call :dk_color %Blue% "%_fixmsg%" -) +call :ts_inskey "[%key%]" ::======================================================================================================================================== @@ -4038,7 +4159,7 @@ REM Windows7EmbeddedPOSReady7 4f1f646c-1e66-4908-acc7-d1606229b29e_POS-ESU-Year3[1-3y]_-Embedded[POS]- REM Windows7EmbeddedStandard 6aaf1c7d-527f-4ed5-b908-9fc039dfc654_WES-ESU-Year3[1-3y]_-Embedded[Standard]- -REM WindowsServer2008R2 +REM WindowsServer2008/WindowsServer2008R2 8e7bfb1e-acc1-4f56-abae-b80fce56cd4b_Server-ESU-PA[1-6y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-ServerEnterprise-ServerEnterpriseCore-ServerEnterpriseV-ServerEnterpriseVCore- REM Windows8.1 4afc620f-12a4-48ad-8015-2aebfbd6e47c_Client-ESU-Year3[1-3y]_-Enterprise-EnterpriseN-Professional-ProfessionalN- @@ -4072,6 +4193,13 @@ set esuexistbutnosup=1 ) ) +if defined esuexistsup if defined _vis ( +set key=9FPV7-MWGT8-7XPDF-JC23W-WT7TW +REM This is a non-generic blocked MAK key for Server-ESU-PA +call :ts_inskey "[!key!]" +goto :ts_off +) + if defined esuexistsup ( echo "%tsids%" | find /i "4220f546-f522-46df-8202-4d07afd26454" %nul1% && ( echo "%tsids%" | find /i "7e94be23-b161-4956-a682-146ab291774c" %nul1% || ( @@ -4094,7 +4222,8 @@ goto :ts_off ) set esuavail= -if %winbuild% LEQ 7602 if not defined isThinpc 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% GTR 7602 if %winbuild% LSS 10240 if 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 @@ -4116,7 +4245,7 @@ if not %_actoff%==1 goto :ts_act if %winbuild% LSS 9200 ( echo: call :dk_color %Gray% "Checking Supported Office [TSforge for Office is supported on Windows 8 and later versions]" -call :dk_color %Blue% "On Windows 7 build, use Online %KS% activation option for Office instead." +call :dk_color %Blue% "On Windows Vista / 7, use Online %KS% activation option for Office instead." goto :ts_act ) @@ -4389,7 +4518,7 @@ echo: if %winbuild% GEQ 10586 ( call :dk_color %Gray% "With %KS% Host license, system may randomly change Windows Edition later. It is a Windows issue and can be safely ignored." ) -call :dk_color %Gray% "%KS% Host [Not to be confused with %KS% Client] license causes the sppsvc service to run continuously." +call :dk_color %Gray% "%KS% Host [Not to be confused with %KS% Client] license causes the %_slser% service to run continuously." call :dk_color %Blue% "Only use this activation when necessary, you can revert to normal activation from the previous menu." if %_unattended%==0 ( @@ -4403,6 +4532,8 @@ set _arr= set tempid= set keytype=kmshost +if defined _vis goto :ts_whost_vista + :: Install current edition csvlk license so that correct edition can reflect for csvlk if %winbuild% GEQ 10586 ( @@ -4434,6 +4565,53 @@ goto :ts_act ::======================================================================================================================================== +:ts_whost_vista + +:: Process Windows K-M-S host for Vista + +:: 1st column = Activation ID +:: 2nd column = CSVLK key +:: 3rd column = Edition IDs +:: Separator = _ + +set f= +set key= +set tempid= +if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f + +for %%# in ( +:: WindowsVista +212a64dc-43b1-4d3d-a30c-2fc69d2095c6_TWVG3-9Q4P8-W9XJF-Y76FJ-DW%f%Q4R_-Business-BusinessN-Enterprise-EnterpriseN- +:: WindowsServer2008 +c90d1b4e-8aa8-439e-8b9e-b6d6b6a6d975_BHC4Q-6D7B7-QMVH7-4MKQH-Y9%f%VK7_-ServerComputeCluster-ServerDatacenter-ServerDatacenterV-ServerEnterprise-ServerEnterpriseIA64-ServerEnterpriseV-ServerStandard-ServerStandardV-ServerWeb- +56df4151-1f9f-41bf-acaa-2941c071872b_PVGKG-2R7XQ-7WTFD-FXTJR-DQ%f%BQ3_-ServerComputeCluster-ServerEnterprise-ServerEnterpriseV-ServerStandard-ServerStandardV-ServerWeb- +c448fa06-49d1-44ec-82bb-0085545c3b51_KH4PC-KJFX6-XFVHQ-GDK2G-JC%f%JY9_-ServerComputeCluster-ServerWeb- +) do ( +for /f "tokens=1-3 delims=_" %%A in ("%%#") do if not defined key ( +echo "%allapps%" | find /i "%%A" %nul1% && ( +echo "%%C" | find /i "-%tsedition%-" %nul1% && ( +set key=%%B +set tempid=%%A +) +) +) +) + +if defined key ( +echo Checking Activation ID [%tempid%] [%tsedition%] +) else ( +call :dk_color %Red% "Checking Activation ID [Not Found] [%tsedition%] [%osSKU%]" +call :dk_color %Blue% "%KS% Host license is not found on your system. It is available for the below editions." +call :dk_color %Blue% "Business, BusinessN, Enterprise, EnterpriseN, and Server editions, etc." +goto :ts_act +) + +call :ts_inskey "[%key%]" +if not defined error set tsids=%tsids% %tempid% +goto :ts_act + +::======================================================================================================================================== + :ts_ohost :: Process Office K-M-S host @@ -4441,6 +4619,12 @@ goto :ts_act echo: echo Processing Office %KS% Host... +if defined _vis ( +echo: +call :dk_color %Blue% "Windows Vista and Server 2008 do not support the installation of Office KMS Host." +goto :ts_act +) + set ohostexist= call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 set ohostids=%allapps% @@ -4523,7 +4707,11 @@ goto :ts_act :ts_resetall echo: +if defined _vis ( +echo Processing Reset of Rearm / Timers... +) else ( echo Processing Reset of Rearm / Timers / Tamper / Lock... +) echo: set resetstuff=1 @@ -4572,6 +4760,10 @@ goto :dk_done for /f "delims=" %%a in ('%psc% "$ids = Get-WmiObject -Query 'SELECT ID FROM SoftwareLicensingProduct' | Select-Object -ExpandProperty ID; $ids" %nul6%') do call set "allactids= %%a !allactids! " +if defined _vis ( +echo: +call :dk_color %Blue% "On Windows Vista and Server 2008, you must manually install the key before activating it." +) echo: call :dk_color %Gray% "Enter / Paste the Activation ID shown in first column in the opened text file, or just press Enter to return:" echo Add space after each Activation ID if you are adding multiple: @@ -4702,7 +4894,7 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble if defined tsids ( echo: -echo Installing Forged Product Key Data... +if not defined _vis Installing Forged Product Key Data... echo Depositing Zero Confirmation ID... echo: %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" @@ -4940,7 +5132,28 @@ exit /b :ts_checkwinperm -%psc% "Get-WmiObject -Query 'SELECT Name, Description FROM SoftwareLicensingProduct WHERE LicenseStatus=''1'' AND GracePeriodRemaining=''0'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Where-Object { $_.Description -notmatch 'KMS_' } | Select-Object -Property Name" %nul2% | findstr /i "Windows" %nul1% && set _perm=1||set _perm= +%psc% "Get-WmiObject -Query 'SELECT Name, Description FROM SoftwareLicensingProduct WHERE LicenseStatus=''1'' AND GracePeriodRemaining=''0'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Where-Object { $_.Description -notmatch 'KMS' } | Select-Object -Property Name" %nul2% | findstr /i "Windows" %nul1% && set _perm=1||set _perm= +exit /b + +:: Install Key + +:ts_inskey + +if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey="%key%" %nul% +if %_wmic% EQU 0 %psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% +set keyerror=%errorlevel% +cmd /c exit /b %keyerror% +if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" + +if %keyerror% EQU 0 ( +if %sps%==SoftwareLicensingService call :dk_refresh +echo Installing Product Key %~1 [Successful] +) else ( +set error=1 +call :dk_color %Red% "Installing Product Key %~1 [Failed] %keyerror%" +call :dk_color %Blue% "%_fixmsg%" +) + exit /b ::======================================================================================================================================== @@ -9787,7 +10000,7 @@ function slGetSkuInfo($SkuId) { } } -if ($env:resetstuff -eq $null) { +if (-not $env:resetstuff) { foreach ($tsactid in $tsactids) { try { $prodDes = Get-WmiInfo -tsactid $tsactid -property "Description" @@ -9796,7 +10009,9 @@ if ($env:resetstuff -eq $null) { $nameParts = $prodName -split ',', 2 $prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null } } + if (-not $env:_vis) { [LibTSforge.Modifiers.GenPKeyInstall]::InstallGenPKey($ver, $prod, $tsactid) + } if ($prodName -match 'Office' -and -not (slGetSkuInfo($tsactid))) { $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" if ($licenseStatus -eq 1) { @@ -9829,13 +10044,13 @@ if ($env:resetstuff -eq $null) { } } -if ($env:resetstuff -eq '1') { +if ($env:resetstuff) { try { - [LibTSforge.Modifiers.TamperedFlagsDelete]::DeleteTamperFlags($ver, $prod) + if (-not $env:_vis) {[LibTSforge.Modifiers.TamperedFlagsDelete]::DeleteTamperFlags($ver, $prod)} [LibTSforge.SPP.SLApi]::RefreshLicenseStatus() [LibTSforge.Modifiers.RearmReset]::Reset($ver, $prod) [LibTSforge.Modifiers.GracePeriodReset]::Reset($ver, $prod) - [LibTSforge.Modifiers.KeyChangeLockDelete]::Delete($ver, $prod) + if (-not $env:_vis) {[LibTSforge.Modifiers.KeyChangeLockDelete]::Delete($ver, $prod)} } catch { $errcode = 3 @@ -11285,9 +11500,9 @@ echo: echo Initializing... call :dk_chkmal -if not exist %SysPath%\sppsvc.exe ( +if not exist %SysPath%\%_slexe% ( %eline% -echo [%SysPath%\sppsvc.exe] file is missing, aborting... +echo [%SysPath%\%_slexe%] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -11339,7 +11554,7 @@ call :dk_color %Blue% "Internet is required for Online %KS% Activation." echo Initiating Diagnostic Tests... -set "_serv=sppsvc Winmgmt" +set "_serv=%_slser% Winmgmt" :: Software Protection :: Windows Management Instrumentation @@ -11429,9 +11644,11 @@ echo [%winos% ^| %winbuild% ^| SKU:%osSKU%] if %winbuild% GEQ 9200 if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1 if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VLKMS*.xrm-ms" set sppks=1 if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VL-BYPASS*.xrm-ms" set sppks=1 +if %winbuild% LSS 7600 if exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*KMS*.xrm-ms" set sppks=1 +if %winbuild% LSS 7600 if exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*VL-BYPASS*.xrm-ms" set sppks=1 if defined skunotfound ( -call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\" +call :dk_color %Red% "Required license files not found." set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) @@ -12183,6 +12400,11 @@ set "nul=>nul 2>&1" for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G set psc=powershell.exe -nop -c +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set run_once= set t_name=Renewal Task reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "\Activation-Run_Once" >nul && ( @@ -12246,7 +12468,7 @@ call :_taskclear-cache :: Check WMI and sppsvc Errors set applist= -net start sppsvc /y %nul% +net start %_slser% /y %nul% if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %slp% where (ApplicationID='%_wApp%') get ID /VALUE" 2^>nul')" if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %slp% WHERE ApplicationID=''%_wApp%''').Get()).ID ^| %% {echo ('ID='+$_)}" 2^>nul')" %chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a")) @@ -12548,12 +12770,20 @@ exit /b :_taskclear-cache set w= -for %%# in (SppE%w%xtComObj.exe sppsvc.exe) do ( +for %%# in (SppE%w%xtComObj.exe sppsvc.exe SLsvc.exe) do ( reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul% ) set "OPPk=SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" + +if %winbuild% LSS 7600 ( +reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" %nul% && ( +set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" +) +) +if not defined SPPk ( set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" +) set "slp=SoftwareLicensingProduct" set "ospp=OfficeSoftwareProtectionProduct" @@ -12669,10 +12899,11 @@ for /f %%G in ('%psc% "[Guid]::NewGuid().Guid"') do set "randguid=%%G" set "_temp=%SystemRoot%\Temp\%Random%%randguid%" set nil= +if %winbuild% LSS 7600 (set _vista=_vista) if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul% md "%_temp%\" %nul% -call :ks_RenExport renewal "%_temp%\Renewal.xml" Unicode -if not defined _int (call :ks_RenExport run_once "%_temp%\Run_Once.xml" Unicode) +call :ks_RenExport renewal%_vista% "%_temp%\Renewal.xml" Unicode +if not defined _int (call :ks_RenExport run_once%_vista% "%_temp%\Run_Once.xml" Unicode) s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Renewal" /ru "SYS%nil%TEM" /xml "%_temp%\Renewal.xml" %nul% if not defined _int (s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Run_Once" /ru "SYS%nil%TEM" /xml "%_temp%\Run_Once.xml" %nul%) if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul% @@ -12861,6 +13092,121 @@ exit /b :run_once: +:renewal_vista: + + + + 1999-01-01T12:00:00.34375 + WindowsAddict + Online K-M-S Activation-Renewal - Weekly Task + + + + 1999-01-01T12:00:00.34375 + true + + + + + 1 + + + + + + S-1-5-18 + HighestAvailable + + + + + PT10M + PT1H + true + false + + IgnoreNew + false + true + true + true + true + + true + true + false + false + false + PT10M + 7 + + PT5M + 3 + + + + + %ProgramFiles%\Activation-Renewal\Activation_task.cmd + Task + + + +:renewal_vista: + +:run_once_vista: + + + + 1999-01-01T12:00:00.34375 + WindowsAddict + Online K-M-S Activation Run Once - Run and Delete itself on first Internet Contact + + + + true + + + + + S-1-5-18 + HighestAvailable + + + + + PT10M + PT1H + true + false + + IgnoreNew + false + true + true + true + true + + true + true + false + false + false + PT10M + 7 + + PT5M + 3 + + + + + %ProgramFiles%\Activation-Renewal\Activation_task.cmd + Task + + + +:run_once_vista: + ::======================================================================================================================================== :: 1st column = Office version number @@ -13192,7 +13538,22 @@ a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4__17_Server cda18cf3-c196-46ad-b289-60c072869994_TT8MH-CG224-D3D7Q-498W2-9Q%f%CTX__18_ServerHPC a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4__29_ServerWebCore f772515c-0e87-48d5-a676-e6962c3e1195_736RG-XDKJK-V34PF-BHK87-J6%f%X3K__56_ServerEmbeddedSolution -::======================================================================================================================================== +:: Windows Vista +cfd8ff08-c0d7-452b-9f60-ef5c70c32094_VKK3X-68KWM-X2YGT-QR4M6-4B%f%WMV___4_Enterprise +4f3d1606-3fea-4c01-be3c-8d671c401e3b_YFKBB-PQJJV-G996G-VWGXY-2V%f%3X8___6_Business +2c682dc2-8b68-4f63-a165-ae291d4cf138_HMBQG-8H2RH-C77VX-27R82-VM%f%QBT__16_BusinessN +d4f54950-26f2-4fb4-ba21-ffab16afcade_VTC42-BM838-43QHV-84HX6-XJ%f%XKV__27_EnterpriseN +:: Windows Server 2008 +ad2542d4-9154-4c6d-8a44-30f11ee96989_TM24T-X9RMF-VWXK6-X8JC9-BF%f%GM2___7_ServerStandard +68b6e220-cf09-466b-92d3-45cd964b9509_7M67G-PC374-GR742-YH8V4-TC%f%BY3___8_ServerDatacenter +c1af4d90-d1bc-44ca-85d4-003ba33db3b9_YQGMW-MPWTJ-34KDK-48M3W-X4%f%Q6V__10_ServerEnterprise +01ef176b-3e0d-422a-b4f8-4ea880035e8f_4DWFP-JF3DJ-B7DTH-78FJB-PD%f%RHK__15_ServerEnterpriseIA64 +ddfa9f7c-f09e-40b9-8c1a-be877a9a7f4b_WYR28-R7TFJ-3X2YQ-YCY4H-M2%f%49D__17_ServerWeb +7afb1156-2c1d-40fc-b260-aab7442b62fe_RCTX3-KWVHP-BR6TB-RB6DM-6X%f%7HP__18_ServerComputeCluster +2401e3d0-c50a-4b58-87b2-7e794b7d2607_W7VD6-7JFBR-RX26B-YKQ3Y-6F%f%FFJ__36_ServerStandardV +fd09ef77-5647-4eff-809c-af2b64659a45_22XQ2-VRXRG-P8D42-K34TD-G3%f%QQC__37_ServerDatacenterV +8198490a-add0-47b2-b3ba-316b12d647b4_39BXF-X8Q23-P2WWT-38T2F-G3%f%FPG__38_ServerEnterpriseV +::======================================================================================================================================= :: Office 2010 8ce7e872-188c-4b98-9d90-f8f90b7aad02_V7Y44-9T38C-R2VJK-666HK-T7%f%DDX__14_AccessVL cee5d470-6e3b-4fcc-8c2b-d17428568a9f_H62QG-HXVKF-PP4HP-66KMR-CW%f%9BM__14_ExcelVL @@ -15134,6 +15495,13 @@ mode 125, 32 ) title Fix Licensing ^(ClipSVC ^+ SPP ^+ OSPP^) +if %winbuild% EQU 6001 ( +%eline% +echo This option is not supported on Windows Vista SP1. +echo Upgrade to Windows Vista SP2. +goto :at_back +) + echo: echo %line% echo: @@ -15150,7 +15518,7 @@ echo - Clear ClipSVC, SPP and OSPP licenses. echo - Fix permissions of SPP tokens folder and registries. echo - Trigger the repair option for Office. echo: -call :dk_color2 %_White% " - " %Red% "Apply this option only when it is necessary." +call :dk_color2 %_White% " - " %Blue% "Apply this option only when it is necessary." echo: echo %line% echo: @@ -15314,19 +15682,19 @@ echo [No Error Found] ) echo: -echo Stopping sppsvc service... -%psc% Stop-Service sppsvc -force %nul% +echo Stopping %_slser% service... +%psc% Stop-Service %_slser% -force %nul% set w= set _sppint= -for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (set _sppint=1)) +for %%# in (SppEx%w%tComObj.exe %_slexe%) do (reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (set _sppint=1)) if defined _sppint ( echo: echo Removing SPP IFEO registry keys... -for %%# in (SppE%w%xtComObj.exe sppsvc.exe) do (reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%) +for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%) ) -if %winbuild% LSS 9200 ( +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 echo: @@ -15345,6 +15713,7 @@ del /f /q %SysPath%\7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-81 :: Delete registry keys that are not deleted by activation scripts +if not defined _vis ( echo: echo Cleaning some licensing-related registry keys... %nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "ServiceSessionId" /f @@ -15352,6 +15721,7 @@ echo Cleaning some licensing-related registry keys... %nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "PolicyValuesArray" /f %nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul% reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\data" /f +) echo: call :scandat delete @@ -15363,9 +15733,13 @@ call :dk_color %Red% "Failed to delete .dat files." echo: ) +if defined _vis ( +%psc% Start-Service %_slser% %nul% +) + echo: echo Reinstalling system licenses... -%psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% if %errorlevel% EQU 0 ( echo [Successful] @@ -15382,7 +15756,7 @@ call :dk_color %Red% "Failed to rebuild tokens.dat file." echo tokens.dat file was rebuilt successfully. ) -if %winbuild% LSS 9200 ( +if %winbuild% LSS 9200 if not defined _vis ( sc config sppuinotify start= demand ) @@ -15941,6 +16315,7 @@ for %%# in ( %SysPath%\spp\store\ %SysPath%\spp\store\2.0\ %Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\ +%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\ ) do ( if %1==check ( @@ -16027,6 +16402,13 @@ cls if not defined terminal mode 98, 30 title Change Windows Edition %masver% +if %winbuild% LSS 7600 ( +%eline% +echo Unsupported OS version detected [%winbuild%]. +echo This option is supported only for Windows 7/8/8.1/10/11 and their Server equivalents. +goto dk_done +) + echo: echo Initializing... echo: @@ -16884,6 +17266,13 @@ cls if not defined terminal mode 98, 30 title Change Office Edition %masver% +if %winbuild% LSS 7600 ( +%eline% +echo Unsupported OS version detected [%winbuild%]. +echo This option is supported only for Windows 7/8/8.1/10/11 and their Server equivalents. +goto dk_done +) + echo: echo Initializing... echo: diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index bb694f4..006b184 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -808,10 +808,16 @@ goto :dk_done :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) @@ -1002,6 +1008,8 @@ exit /b :dk_reeval +if %winbuild% LSS 7600 exit /b + :: This key is left by the system in rearm process and sppsvc sometimes fails to delete it, it causes issues in working of the Scheduled Tasks of SPP set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState" @@ -1047,13 +1055,13 @@ function InstallLicenseArr($Str) { ForEach ($x in $a) {InstallLicenseFile "$x"} } function InstallLicenseDir($Loc) { - dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"} + Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName} } function ReinstallLicenses() { - $Oem = "$env:SysPath\oem" - $Spp = "$env:SysPath\spp\tokens" - InstallLicenseDir "$Spp" - If (Test-Path $Oem) {InstallLicenseDir "$Oem"} + $Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens") + foreach ($Path in $Paths) { + if (Test-Path $Path) { InstallLicenseDir "$Path" } + } } :xrm: @@ -1071,16 +1079,16 @@ exit /b :dk_sppissue -sc start sppsvc %nul% +sc start %_slser% %nul% set spperror=%errorlevel% if %spperror% NEQ 1056 if %spperror% NEQ 0 ( %eline% -echo sc start sppsvc [Error Code: %spperror%] +echo sc start %_slser% [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -1098,6 +1106,10 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) +if %winbuild% LSS 7600 ( +set "winos=!winos:VistaT=Vista!" +set "winos=!winos:Serverr=Server!" +) if not defined winsub exit /b @@ -1144,11 +1156,11 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" -sc start sppsvc %nul% +sc start %_slser% %nul% echo "%errorlevel%" | findstr "577 225" %nul% && ( set "results=%results%[Likely File Infector]" ) || ( -if not exist %SysPath%\sppsvc.exe 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%"=="" ( @@ -1228,6 +1240,7 @@ for %%# in (%serv_ste%) do ( if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%) if /i %%#==wlidsvc sc config %%# start= demand %nul% if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%) +if /i %%#==SLsvc sc config %%# start= auto %nul% if /i %%#==KeyIso sc config %%# start= demand %nul% if /i %%#==LicenseManager sc config %%# start= demand %nul% if /i %%#==Winmgmt sc config %%# start= auto %nul% @@ -1357,7 +1370,7 @@ if %osedition%==0 ( call :dk_color %Red% "Checking Edition Name [Not Found In Registry]" ) else ( -if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( +if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( set skunotfound=1 call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]" ) @@ -1439,7 +1452,7 @@ call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %m ) -for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( +for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#")) ) if defined _sppint ( @@ -1453,14 +1466,14 @@ echo Checking SPP In IFEO [%_sppint%] ) -for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( +if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul% call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null" ) -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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" @@ -1470,21 +1483,22 @@ set showfix=1 set tokenstore= +if %winbuild% GEQ 7600 ( for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b" if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform" -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" ( set toerr=1 set error=1 set showfix=1 -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!]" set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) - +) :: This code creates token folder only if it's missing and sets default permission for it -if not defined toerr if not exist "%tokenstore%\" ( +if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" ( mkdir "%tokenstore%" %nul% if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';" if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';" @@ -1505,7 +1519,7 @@ set showfix=1 if not defined notwinact ( call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( -%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($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\:.*';iex ($f[1]); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" @@ -1520,7 +1534,7 @@ call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]" ) -if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( +if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( set error=1 call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]" ) @@ -1655,8 +1669,10 @@ $wpaKey.Close() if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 ) exit /b @@ -1664,8 +1680,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 ) exit /b diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index 206ac83..4610158 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -914,10 +914,16 @@ $key.SetAccessControl($acl) :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) @@ -1124,6 +1130,8 @@ exit /b :dk_reeval +if %winbuild% LSS 7600 exit /b + :: This key is left by the system in rearm process and sppsvc sometimes fails to delete it, it causes issues in working of the Scheduled Tasks of SPP set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState" @@ -1151,13 +1159,13 @@ function InstallLicenseArr($Str) { ForEach ($x in $a) {InstallLicenseFile "$x"} } function InstallLicenseDir($Loc) { - dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"} + Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName} } function ReinstallLicenses() { - $Oem = "$env:SysPath\oem" - $Spp = "$env:SysPath\spp\tokens" - InstallLicenseDir "$Spp" - If (Test-Path $Oem) {InstallLicenseDir "$Oem"} + $Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens") + foreach ($Path in $Paths) { + if (Test-Path $Path) { InstallLicenseDir "$Path" } + } } :xrm: @@ -1175,16 +1183,16 @@ exit /b :dk_sppissue -sc start sppsvc %nul% +sc start %_slser% %nul% set spperror=%errorlevel% if %spperror% NEQ 1056 if %spperror% NEQ 0 ( %eline% -echo sc start sppsvc [Error Code: %spperror%] +echo sc start %_slser% [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -1202,6 +1210,10 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) +if %winbuild% LSS 7600 ( +set "winos=!winos:VistaT=Vista!" +set "winos=!winos:Serverr=Server!" +) if not defined winsub exit /b @@ -1293,11 +1305,11 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" -sc start sppsvc %nul% +sc start %_slser% %nul% echo "%errorlevel%" | findstr "577 225" %nul% && ( set "results=%results%[Likely File Infector]" ) || ( -if not exist %SysPath%\sppsvc.exe 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%"=="" ( @@ -1377,6 +1389,7 @@ for %%# in (%serv_ste%) do ( if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%) if /i %%#==wlidsvc sc config %%# start= demand %nul% if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%) +if /i %%#==SLsvc sc config %%# start= auto %nul% if /i %%#==KeyIso sc config %%# start= demand %nul% if /i %%#==LicenseManager sc config %%# start= demand %nul% if /i %%#==Winmgmt sc config %%# start= auto %nul% @@ -1506,7 +1519,7 @@ if %osedition%==0 ( call :dk_color %Red% "Checking Edition Name [Not Found In Registry]" ) else ( -if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( +if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( set skunotfound=1 call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]" ) @@ -1588,7 +1601,7 @@ call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %m ) -for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( +for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#")) ) if defined _sppint ( @@ -1602,14 +1615,14 @@ echo Checking SPP In IFEO [%_sppint%] ) -for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( +if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul% call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null" ) -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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" @@ -1619,21 +1632,22 @@ set showfix=1 set tokenstore= +if %winbuild% GEQ 7600 ( for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b" if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform" -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" ( set toerr=1 set error=1 set showfix=1 -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!]" set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) - +) :: This code creates token folder only if it's missing and sets default permission for it -if not defined toerr if not exist "%tokenstore%\" ( +if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" ( mkdir "%tokenstore%" %nul% if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';" if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';" @@ -1654,7 +1668,7 @@ set showfix=1 if not defined notwinact ( call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( -%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($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\:.*';iex ($f[1]); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" @@ -1669,7 +1683,7 @@ call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]" ) -if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( +if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( set error=1 call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]" ) @@ -1804,8 +1818,10 @@ $wpaKey.Close() if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 ) exit /b @@ -1813,8 +1829,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 ) exit /b diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 6de8e0c..7fe95f3 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -1326,10 +1326,16 @@ exit /b :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) @@ -1472,7 +1478,7 @@ function InstallLicenseArr($Str) { ForEach ($x in $a) {InstallLicenseFile "$x"} } function InstallLicenseDir($Loc) { - dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"} + Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName} } function ReinstallLicenses() { $Oem = "$env:SysPath\oem" @@ -1496,16 +1502,16 @@ exit /b :dk_sppissue -sc start sppsvc %nul% +sc start %_slser% %nul% set spperror=%errorlevel% if %spperror% NEQ 1056 if %spperror% NEQ 0 ( %eline% -echo sc start sppsvc [Error Code: %spperror%] +echo sc start %_slser% [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -1523,6 +1529,11 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) +if %winbuild% LSS 7600 ( +set "winos=!winos:VistaT=Vista!" +set "winos=!winos:Serverr=Server!" +) + exit /b :: Common lines used in PowerShell reflection code @@ -1553,11 +1564,11 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" -sc start sppsvc %nul% +sc start %_slser% %nul% echo "%errorlevel%" | findstr "577 225" %nul% && ( set "results=%results%[Likely File Infector]" ) || ( -if not exist %SysPath%\sppsvc.exe 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%"=="" ( @@ -1637,6 +1648,7 @@ for %%# in (%serv_ste%) do ( if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%) if /i %%#==wlidsvc sc config %%# start= demand %nul% if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%) +if /i %%#==SLsvc sc config %%# start= auto %nul% if /i %%#==KeyIso sc config %%# start= demand %nul% if /i %%#==LicenseManager sc config %%# start= demand %nul% if /i %%#==Winmgmt sc config %%# start= auto %nul% @@ -1766,7 +1778,7 @@ if %osedition%==0 ( call :dk_color %Red% "Checking Edition Name [Not Found In Registry]" ) else ( -if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( +if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( set skunotfound=1 call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]" ) @@ -1848,7 +1860,7 @@ call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %m ) -for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( +for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#")) ) if defined _sppint ( @@ -1862,14 +1874,14 @@ echo Checking SPP In IFEO [%_sppint%] ) -for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( +if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul% call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null" ) -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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" @@ -1879,21 +1891,22 @@ set showfix=1 set tokenstore= +if %winbuild% GEQ 7600 ( for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b" if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform" -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" ( set toerr=1 set error=1 set showfix=1 -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!]" set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) - +) :: This code creates token folder only if it's missing and sets default permission for it -if not defined toerr if not exist "%tokenstore%\" ( +if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" ( mkdir "%tokenstore%" %nul% if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';" if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';" @@ -1914,7 +1927,7 @@ set showfix=1 if not defined notwinact ( call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( -%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($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\:.*';iex ($f[1]); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" @@ -1929,7 +1942,7 @@ call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]" ) -if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( +if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( set error=1 call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]" ) @@ -2064,8 +2077,10 @@ $wpaKey.Close() if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 ) exit /b @@ -2073,8 +2088,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 ) exit /b diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 9f4bed2..940c217 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -202,10 +202,27 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble goto dk_done ) -if %winbuild% LSS 7600 ( +if %winbuild% LSS 6001 ( %nceline% echo Unsupported OS version detected [%winbuild%]. -echo MAS only supports Windows 7/8/8.1/10/11 and their Server equivalents. +echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents. +if %winbuild% EQU 6000 ( +echo: +echo Windows Vista RTM is not supported because Powershell cannot be installed. +echo Upgrade to Windows Vista SP1 or SP2. +) +goto dk_done +) + +if not exist %ps% ( +%nceline% +echo PowerShell is not installed in your system. +if %winbuild% LSS 7600 ( +echo Install PowerShell using the following URL. +echo: +echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +) goto dk_done ) @@ -468,9 +485,9 @@ echo: echo Initializing... call :dk_chkmal -if not exist %SysPath%\sppsvc.exe ( +if not exist %SysPath%\%_slexe% ( %eline% -echo [%SysPath%\sppsvc.exe] file is missing, aborting... +echo [%SysPath%\%_slexe%] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -522,7 +539,7 @@ call :dk_color %Blue% "Internet is required for Online %KS% Activation." echo Initiating Diagnostic Tests... -set "_serv=sppsvc Winmgmt" +set "_serv=%_slser% Winmgmt" :: Software Protection :: Windows Management Instrumentation @@ -612,9 +629,11 @@ echo [%winos% ^| %winbuild% ^| SKU:%osSKU%] if %winbuild% GEQ 9200 if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1 if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VLKMS*.xrm-ms" set sppks=1 if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*VL-BYPASS*.xrm-ms" set sppks=1 +if %winbuild% LSS 7600 if exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*KMS*.xrm-ms" set sppks=1 +if %winbuild% LSS 7600 if exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*VL-BYPASS*.xrm-ms" set sppks=1 if defined skunotfound ( -call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\" +call :dk_color %Red% "Required license files not found." set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) @@ -1648,6 +1667,11 @@ set "nul=>nul 2>&1" for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G set psc=powershell.exe -nop -c +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set run_once= set t_name=Renewal Task reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "\Activation-Run_Once" >nul && ( @@ -1711,7 +1735,7 @@ call :_taskclear-cache :: Check WMI and sppsvc Errors set applist= -net start sppsvc /y %nul% +net start %_slser% /y %nul% if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %slp% where (ApplicationID='%_wApp%') get ID /VALUE" 2^>nul')" if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %slp% WHERE ApplicationID=''%_wApp%''').Get()).ID ^| %% {echo ('ID='+$_)}" 2^>nul')" %chkapp% do (if defined applist (call set "applist=!applist! %%a") else (call set "applist=%%a")) @@ -2013,12 +2037,20 @@ exit /b :_taskclear-cache set w= -for %%# in (SppE%w%xtComObj.exe sppsvc.exe) do ( +for %%# in (SppE%w%xtComObj.exe sppsvc.exe SLsvc.exe) do ( reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul% ) set "OPPk=SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" + +if %winbuild% LSS 7600 ( +reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" %nul% && ( +set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SL" +) +) +if not defined SPPk ( set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" +) set "slp=SoftwareLicensingProduct" set "ospp=OfficeSoftwareProtectionProduct" @@ -2134,10 +2166,11 @@ for /f %%G in ('%psc% "[Guid]::NewGuid().Guid"') do set "randguid=%%G" set "_temp=%SystemRoot%\Temp\%Random%%randguid%" set nil= +if %winbuild% LSS 7600 (set _vista=_vista) if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul% md "%_temp%\" %nul% -call :ks_RenExport renewal "%_temp%\Renewal.xml" Unicode -if not defined _int (call :ks_RenExport run_once "%_temp%\Run_Once.xml" Unicode) +call :ks_RenExport renewal%_vista% "%_temp%\Renewal.xml" Unicode +if not defined _int (call :ks_RenExport run_once%_vista% "%_temp%\Run_Once.xml" Unicode) s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Renewal" /ru "SYS%nil%TEM" /xml "%_temp%\Renewal.xml" %nul% if not defined _int (s%nil%cht%nil%asks /cre%nil%ate /tn "Activation-Run_Once" /ru "SYS%nil%TEM" /xml "%_temp%\Run_Once.xml" %nul%) if exist "%_temp%\.*" rmdir /s /q "%_temp%\" %nul% @@ -2326,16 +2359,137 @@ exit /b :run_once: +:renewal_vista: + + + + 1999-01-01T12:00:00.34375 + WindowsAddict + Online K-M-S Activation-Renewal - Weekly Task + + + + 1999-01-01T12:00:00.34375 + true + + + + + 1 + + + + + + S-1-5-18 + HighestAvailable + + + + + PT10M + PT1H + true + false + + IgnoreNew + false + true + true + true + true + + true + true + false + false + false + PT10M + 7 + + PT5M + 3 + + + + + %ProgramFiles%\Activation-Renewal\Activation_task.cmd + Task + + + +:renewal_vista: + +:run_once_vista: + + + + 1999-01-01T12:00:00.34375 + WindowsAddict + Online K-M-S Activation Run Once - Run and Delete itself on first Internet Contact + + + + true + + + + + S-1-5-18 + HighestAvailable + + + + + PT10M + PT1H + true + false + + IgnoreNew + false + true + true + true + true + + true + true + false + false + false + PT10M + 7 + + PT5M + 3 + + + + + %ProgramFiles%\Activation-Renewal\Activation_task.cmd + Task + + + +:run_once_vista: + ::======================================================================================================================================== :: Set variables :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) @@ -2539,6 +2693,8 @@ exit /b :dk_reeval +if %winbuild% LSS 7600 exit /b + :: This key is left by the system in rearm process and sppsvc sometimes fails to delete it, it causes issues in working of the Scheduled Tasks of SPP set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState" @@ -2566,13 +2722,13 @@ function InstallLicenseArr($Str) { ForEach ($x in $a) {InstallLicenseFile "$x"} } function InstallLicenseDir($Loc) { - dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"} + Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName} } function ReinstallLicenses() { - $Oem = "$env:SysPath\oem" - $Spp = "$env:SysPath\spp\tokens" - InstallLicenseDir "$Spp" - If (Test-Path $Oem) {InstallLicenseDir "$Oem"} + $Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens") + foreach ($Path in $Paths) { + if (Test-Path $Path) { InstallLicenseDir "$Path" } + } } :xrm: @@ -2590,16 +2746,16 @@ exit /b :dk_sppissue -sc start sppsvc %nul% +sc start %_slser% %nul% set spperror=%errorlevel% if %spperror% NEQ 1056 if %spperror% NEQ 0 ( %eline% -echo sc start sppsvc [Error Code: %spperror%] +echo sc start %_slser% [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -2617,6 +2773,10 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) +if %winbuild% LSS 7600 ( +set "winos=!winos:VistaT=Vista!" +set "winos=!winos:Serverr=Server!" +) if not defined winsub exit /b @@ -2708,11 +2868,11 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" -sc start sppsvc %nul% +sc start %_slser% %nul% echo "%errorlevel%" | findstr "577 225" %nul% && ( set "results=%results%[Likely File Infector]" ) || ( -if not exist %SysPath%\sppsvc.exe 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%"=="" ( @@ -2792,6 +2952,7 @@ for %%# in (%serv_ste%) do ( if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%) if /i %%#==wlidsvc sc config %%# start= demand %nul% if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%) +if /i %%#==SLsvc sc config %%# start= auto %nul% if /i %%#==KeyIso sc config %%# start= demand %nul% if /i %%#==LicenseManager sc config %%# start= demand %nul% if /i %%#==Winmgmt sc config %%# start= auto %nul% @@ -2921,7 +3082,7 @@ if %osedition%==0 ( call :dk_color %Red% "Checking Edition Name [Not Found In Registry]" ) else ( -if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( +if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( set skunotfound=1 call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]" ) @@ -3003,7 +3164,7 @@ call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %m ) -for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( +for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#")) ) if defined _sppint ( @@ -3017,14 +3178,14 @@ echo Checking SPP In IFEO [%_sppint%] ) -for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( +if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul% call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null" ) -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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" @@ -3034,21 +3195,22 @@ set showfix=1 set tokenstore= +if %winbuild% GEQ 7600 ( for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b" if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform" -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" ( set toerr=1 set error=1 set showfix=1 -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!]" set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) - +) :: This code creates token folder only if it's missing and sets default permission for it -if not defined toerr if not exist "%tokenstore%\" ( +if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" ( mkdir "%tokenstore%" %nul% if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';" if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';" @@ -3069,7 +3231,7 @@ set showfix=1 if not defined notwinact ( call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( -%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($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\:.*';iex ($f[1]); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" @@ -3084,7 +3246,7 @@ call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]" ) -if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( +if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( set error=1 call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]" ) @@ -3219,8 +3381,10 @@ $wpaKey.Close() if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 ) exit /b @@ -3228,8 +3392,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 ) exit /b @@ -3588,7 +3754,22 @@ a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4__17_Server cda18cf3-c196-46ad-b289-60c072869994_TT8MH-CG224-D3D7Q-498W2-9Q%f%CTX__18_ServerHPC a78b8bd9-8017-4df5-b86a-09f756affa7c_6TPJF-RBVHG-WBW2R-86QPH-6R%f%TM4__29_ServerWebCore f772515c-0e87-48d5-a676-e6962c3e1195_736RG-XDKJK-V34PF-BHK87-J6%f%X3K__56_ServerEmbeddedSolution -::======================================================================================================================================== +:: Windows Vista +cfd8ff08-c0d7-452b-9f60-ef5c70c32094_VKK3X-68KWM-X2YGT-QR4M6-4B%f%WMV___4_Enterprise +4f3d1606-3fea-4c01-be3c-8d671c401e3b_YFKBB-PQJJV-G996G-VWGXY-2V%f%3X8___6_Business +2c682dc2-8b68-4f63-a165-ae291d4cf138_HMBQG-8H2RH-C77VX-27R82-VM%f%QBT__16_BusinessN +d4f54950-26f2-4fb4-ba21-ffab16afcade_VTC42-BM838-43QHV-84HX6-XJ%f%XKV__27_EnterpriseN +:: Windows Server 2008 +ad2542d4-9154-4c6d-8a44-30f11ee96989_TM24T-X9RMF-VWXK6-X8JC9-BF%f%GM2___7_ServerStandard +68b6e220-cf09-466b-92d3-45cd964b9509_7M67G-PC374-GR742-YH8V4-TC%f%BY3___8_ServerDatacenter +c1af4d90-d1bc-44ca-85d4-003ba33db3b9_YQGMW-MPWTJ-34KDK-48M3W-X4%f%Q6V__10_ServerEnterprise +01ef176b-3e0d-422a-b4f8-4ea880035e8f_4DWFP-JF3DJ-B7DTH-78FJB-PD%f%RHK__15_ServerEnterpriseIA64 +ddfa9f7c-f09e-40b9-8c1a-be877a9a7f4b_WYR28-R7TFJ-3X2YQ-YCY4H-M2%f%49D__17_ServerWeb +7afb1156-2c1d-40fc-b260-aab7442b62fe_RCTX3-KWVHP-BR6TB-RB6DM-6X%f%7HP__18_ServerComputeCluster +2401e3d0-c50a-4b58-87b2-7e794b7d2607_W7VD6-7JFBR-RX26B-YKQ3Y-6F%f%FFJ__36_ServerStandardV +fd09ef77-5647-4eff-809c-af2b64659a45_22XQ2-VRXRG-P8D42-K34TD-G3%f%QQC__37_ServerDatacenterV +8198490a-add0-47b2-b3ba-316b12d647b4_39BXF-X8Q23-P2WWT-38T2F-G3%f%FPG__38_ServerEnterpriseV +::======================================================================================================================================= :: Office 2010 8ce7e872-188c-4b98-9d90-f8f90b7aad02_V7Y44-9T38C-R2VJK-666HK-T7%f%DDX__14_AccessVL cee5d470-6e3b-4fcc-8c2b-d17428568a9f_H62QG-HXVKF-PP4HP-66KMR-CW%f%9BM__14_ExcelVL diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index ebc1399..e5228bb 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -208,13 +208,42 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble goto dk_done ) -if %winbuild% LSS 7600 ( +if %winbuild% LSS 6001 ( %nceline% echo Unsupported OS version detected [%winbuild%]. -echo MAS only supports Windows 7/8/8.1/10/11 and their Server equivalents. +echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents. +if %winbuild% EQU 6000 ( +echo: +echo Windows Vista RTM is not supported because Powershell cannot be installed. +echo Upgrade to Windows Vista SP1 or SP2. +) goto dk_done ) +if not exist %ps% ( +%nceline% +echo PowerShell is not installed in your system. +if %winbuild% LSS 7600 ( +echo Install PowerShell using the following URL. +echo: +echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +) +goto dk_done +) + +if %winbuild% LSS 7600 ( +reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" /v Install %nul2% | find /i "0x1" %nul1% || ( +%eline% +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 +start https://www.microsoft.com/download/details.aspx?id=25150 +goto dk_done +) +) + ::======================================================================================================================================== :: Fix special character limitations in path name @@ -415,7 +444,11 @@ echo [A] Activate - Windows %KS% Host echo [B] Activate - Office %KS% Host echo [C] Activate - Windows 8/8.1 APPX Sideloading echo [D] Activate - Manually Select Products +if defined _vis ( +echo [E] Reset - Rearm/Timers +) else ( echo [E] Reset - Rearm/Timers/Tamper/Lock +) echo _______________________________________________ echo: echo [6] Remove TSforge Activation @@ -461,9 +494,9 @@ echo: echo Initializing... call :dk_chkmal -if not exist %SysPath%\sppsvc.exe ( +if not exist %SysPath%\%_slexe% ( %eline% -echo [%SysPath%\sppsvc.exe] file is missing, aborting... +echo [%SysPath%\%_slexe%] file is missing, aborting... echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" @@ -486,10 +519,10 @@ goto dk_done if %winbuild% LSS 9200 if exist "%SysPath%\wlms\wlms.exe" ( sc query wlms | find /i "RUNNING" %nul% && ( -sc stop sppsvc %nul% +sc stop %_slser% %nul% if !errorlevel! EQU 1051 ( %eline% -echo Evaluation WLMS service is running, sppsvc 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: set fixes=%fixes% %mas%troubleshoot @@ -522,7 +555,7 @@ call :dk_showosinfo echo Initiating Diagnostic Tests... -set "_serv=sppsvc Winmgmt" +set "_serv=%_slser% Winmgmt" :: Software Protection :: Windows Management Instrumentation @@ -571,6 +604,8 @@ call :dk_color %Gray% "Checking OS Activation [Windows is alrea goto :ts_esu ) +if defined _vis goto :ts_winvista + set tempid= set keytype=zero for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':wintsid\:.*';iex ($f[1])" %nul6%') do ( @@ -593,6 +628,86 @@ goto :ts_esu ::======================================================================================================================================== +:ts_winvista + +:: Process Windows Vista + +:: 1st column = Activation ID +:: 2nd column = Generic key +:: 3rd column = Key channel +:: 4th column = Edition ID +:: Separator = _ + +:: Keys aren't available for these editions, but since these editions aren't publicly available, it doesn't matter +:: a797d61e-1475-470b-86c8-f737a72c188d StarterN +:: 5e9f548a-c8a9-44e6-a6c2-3f8d0a7a99dd ServerComputeClusterV + +set f= +set key= +set tempid= +if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f + +for %%# in ( +:: WindowsVista +9de9abe2-d01d-4538-af84-4498bdbc2ba3_4D2XH-PRBMM-8Q22B-K8BM3-MR%f%W4W_____Retail_Business +db442be4-81ed-4ab3-9d66-2417e8a5c81c_76884-QXFY2-6Q2WX-2QTQ8-QX%f%X44_____Retail_BusinessN +b51791c2-b562-4b73-97b0-735a0e4429a6_YQPQV-RW8R3-XMPFG-RXG9R-JG%f%TVF_____Retail_Enterprise +58c37517-42f8-4723-bb44-30b05791ff2a_Q7J9R-G63R4-BFMHF-FWM9R-RW%f%DMV_____Retail_EnterpriseN +95c6e80a-0ff8-4bd0-95f2-c4a39b79d09e_RCG7P-TX42D-HM8FM-TCFCW-3V%f%4VD_____Retail_HomeBasic +d0333dad-c14e-46f2-b62a-8b47a1b9768b_HY2VV-XC6FF-MD6WV-FPYBQ-GF%f%JBT_____Retail_HomeBasicN +9e042223-03bf-49ae-808f-ff37f128d40d_X9HTF-MKJQQ-XK376-TJ7T4-76%f%PKF_____Retail_HomePremium +92d8977c-d506-4e63-b500-6d39283b6cd5_KJ6TP-PF9W2-23T3Q-XTV7M-PX%f%DT2_____Retail_HomePremiumN +89e51a3c-76c0-4beb-a650-53d34c8f8186_X9PYV-YBQRV-9BXWV-TQDMK-QD%f%WK4_____Retail_Starter +30fab9cc-8614-4339-989f-7ce61fb7a5c4_VMCB9-FDRV6-6CDQM-RV23K-RP%f%8F7_____Retail_Ultimate +1eefed20-8ac0-478c-8774-70cd44782ea1_CVX38-P27B4-2X8BT-RXD4J-V7%f%CKX_____Retail_UltimateN +:: WindowsServer2008 +c9ad502b-ef48-41d1-a2a0-38a38e82fed0_24FV9-H7JW8-C8Q6X-BQKMK-K9%f%77J_____Retail_ServerComputeCluster +866e924e-c2a3-4872-aca1-6b48c13962d5_6QBHY-DXTPJ-T9W3P-DTJXX-4V%f%QMB_____Retail_ServerDatacenter +d020c729-07f0-4f8f-87ce-bf803275c786_83TWG-TD3TC-HRDP2-K93FJ-Y3%f%4YC_OEM:NONSLP_ServerDatacenterV +32b40e5e-0c6d-4c6f-ab12-a031933fd2c6_MRB7H-QJRHG-FXTBR-B2Q2M-8W%f%MTJ_____Retail_ServerEnterprise +256cc990-1692-4ea8-965c-2d423d5dd24e_H4VB6-QPRWH-VDCYM-996P8-MH%f%KFY_OEM:NONSLP_ServerEnterpriseIA64 +1ba5e036-e386-42c4-b7eb-16bdb4fa1945_H8H7M-HDPQT-PJHQF-M7B83-9C%f%VGV_____Retail_ServerEnterpriseV +8df04457-07c8-4301-bce9-d61eb76cb2d6_RGBMC-PQBVF-94Q9K-HD63B-VY%f%6MP_____Retail_ServerHomePremium +5bd23b19-aa71-4a5b-8b68-c8801c2baff6_6C8KR-MD3QK-9GWFW-44CY2-W9%f%CBM_____Retail_ServerHomeStandard +b86c7736-91ff-4de9-bfa9-b32b8a09acac_7XRBY-6MP2K-VQPT8-F37JV-YY%f%Q83_____Retail_ServerMediumBusinessManagement +d3f5642f-081d-40b2-a4b9-efd3054d4584_6PDTD-JK48J-662TF-8J2QV-R4%f%CRB_____Retail_ServerMediumBusinessMessaging +c6936a36-69f3-4994-9857-3069c7b9ec7a_D694V-CMWKH-PY92X-PFQKQ-JC%f%B69_____Retail_ServerMediumBusinessSecurity +cc4c2cf8-ef29-4d8e-b168-2b65a3db3309_MRDK3-YYQF3-88BQJ-D6FJG-69%f%YJY_____Retail_ServerSBSPremium +b3827b27-bd38-4284-98af-e4f4d1c051a0_2KB23-GJRBD-W3T9C-6CH2W-39%f%B7V_____Retail_ServerSBSPrime +5dad0eff-3f6f-4310-8844-422f9dc7c84b_H4XDD-B27GY-667P6-XWVV7-GY%f%G8J_____Retail_ServerSBSStandard +603504f9-109f-49f0-9271-8c66f7878f58_8YVM4-YQBDH-7WDQM-R27WR-WV%f%CWG_____Retail_ServerStandard +65ab7338-9ad0-43fe-af1b-190b577495e2_H9MW3-6V7GK-94P9G-7FTPJ-VK%f%CKF_____Retail_ServerStandardV +2be204da-24a0-4943-b66c-81e8464acd7e_2264C-TD9T8-P8HPW-CC9GH-MH%f%M2V_____Retail_ServerStorageEnterprise +60207eba-8b4a-486c-a013-023b4b742c2f_RCYMT-YX342-8T6YY-XYHYC-3D%f%D7X_____Retail_ServerStorageExpress +368856e9-43f7-4601-8358-e561f36c7dd8_FKFT2-WXYY9-WBPY7-6YMY4-X4%f%8JF_____Retail_ServerStorageStandard +4bf433fa-ab04-4c6c-b55b-00170e14b8cd_8X9J7-HCJ7J-3WDJT-QM7D8-46%f%4YH_____Retail_ServerStorageWorkgroup +a77a6806-f59e-4953-97d7-229317b8e6a6_BGT39-9FYH7-X2CYD-T628F-QP%f%QPW_____Retail_ServerWeb +f92f836d-4d3e-4e90-a08f-2d612d65e716_HPH76-FHFPP-DRW9D-7W2V4-HW%f%GKT_____Retail_ServerWinSB +3059a9fd-b068-4f0d-acaf-66324dca67ac_2V8G6-KRXYR-MMGXJ-6RWM3-GX%f%CCG_____Retail_ServerWinSBV +) do ( +for /f "tokens=1-4 delims=_" %%A in ("%%#") do if %tsedition%==%%D if not defined key ( +echo "%allapps%" | find /i "%%A" %nul1% && ( +set key=%%B +set tempid=%%A +) +) +) + +if not defined key ( +set error=1 +call :dk_color %Red% "Checking Activation ID [%tsedition% SKU-%osSKU% not found in the system]" +call :dk_color %Blue% "%_fixmsg%" +goto :ts_esu +) + +echo Checking Activation ID [%tempid%] [%tsedition%] + +call :ts_inskey "[%key%]" +if not defined error set tsids=%tsids% %tempid% +goto :ts_esu + +::======================================================================================================================================== + :ts_wineval call :dk_color %Gray% "Checking OS Edition [%tsedition%] [Evaluation edition found]" @@ -709,19 +824,7 @@ goto :ts_esu echo Resetting Rearm / GracePeriod [Successful] ) -%psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% -set keyerror=%errorlevel% -cmd /c exit /b %keyerror% -if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" - -if %keyerror% EQU 0 ( -call :dk_refresh -echo Installing Activable Evaluation Key [%key%] [Successful] -) else ( -set error=1 -call :dk_color %Red% "Installing Activable Evaluation Key [%key%] [Failed] %keyerror%" -call :dk_color %Blue% "%_fixmsg%" -) +call :ts_inskey "[%key%]" ::======================================================================================================================================== @@ -757,7 +860,7 @@ REM Windows7EmbeddedPOSReady7 4f1f646c-1e66-4908-acc7-d1606229b29e_POS-ESU-Year3[1-3y]_-Embedded[POS]- REM Windows7EmbeddedStandard 6aaf1c7d-527f-4ed5-b908-9fc039dfc654_WES-ESU-Year3[1-3y]_-Embedded[Standard]- -REM WindowsServer2008R2 +REM WindowsServer2008/WindowsServer2008R2 8e7bfb1e-acc1-4f56-abae-b80fce56cd4b_Server-ESU-PA[1-6y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-ServerEnterprise-ServerEnterpriseCore-ServerEnterpriseV-ServerEnterpriseVCore- REM Windows8.1 4afc620f-12a4-48ad-8015-2aebfbd6e47c_Client-ESU-Year3[1-3y]_-Enterprise-EnterpriseN-Professional-ProfessionalN- @@ -791,6 +894,13 @@ set esuexistbutnosup=1 ) ) +if defined esuexistsup if defined _vis ( +set key=9FPV7-MWGT8-7XPDF-JC23W-WT7TW +REM This is a non-generic blocked MAK key for Server-ESU-PA +call :ts_inskey "[!key!]" +goto :ts_off +) + if defined esuexistsup ( echo "%tsids%" | find /i "4220f546-f522-46df-8202-4d07afd26454" %nul1% && ( echo "%tsids%" | find /i "7e94be23-b161-4956-a682-146ab291774c" %nul1% || ( @@ -813,7 +923,8 @@ goto :ts_off ) set esuavail= -if %winbuild% LEQ 7602 if not defined isThinpc 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% GTR 7602 if %winbuild% LSS 10240 if 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 @@ -835,7 +946,7 @@ if not %_actoff%==1 goto :ts_act if %winbuild% LSS 9200 ( echo: call :dk_color %Gray% "Checking Supported Office [TSforge for Office is supported on Windows 8 and later versions]" -call :dk_color %Blue% "On Windows 7 build, use Online %KS% activation option for Office instead." +call :dk_color %Blue% "On Windows Vista / 7, use Online %KS% activation option for Office instead." goto :ts_act ) @@ -1108,7 +1219,7 @@ echo: if %winbuild% GEQ 10586 ( call :dk_color %Gray% "With %KS% Host license, system may randomly change Windows Edition later. It is a Windows issue and can be safely ignored." ) -call :dk_color %Gray% "%KS% Host [Not to be confused with %KS% Client] license causes the sppsvc service to run continuously." +call :dk_color %Gray% "%KS% Host [Not to be confused with %KS% Client] license causes the %_slser% service to run continuously." call :dk_color %Blue% "Only use this activation when necessary, you can revert to normal activation from the previous menu." if %_unattended%==0 ( @@ -1122,6 +1233,8 @@ set _arr= set tempid= set keytype=kmshost +if defined _vis goto :ts_whost_vista + :: Install current edition csvlk license so that correct edition can reflect for csvlk if %winbuild% GEQ 10586 ( @@ -1153,6 +1266,53 @@ goto :ts_act ::======================================================================================================================================== +:ts_whost_vista + +:: Process Windows K-M-S host for Vista + +:: 1st column = Activation ID +:: 2nd column = CSVLK key +:: 3rd column = Edition IDs +:: Separator = _ + +set f= +set key= +set tempid= +if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f + +for %%# in ( +:: WindowsVista +212a64dc-43b1-4d3d-a30c-2fc69d2095c6_TWVG3-9Q4P8-W9XJF-Y76FJ-DW%f%Q4R_-Business-BusinessN-Enterprise-EnterpriseN- +:: WindowsServer2008 +c90d1b4e-8aa8-439e-8b9e-b6d6b6a6d975_BHC4Q-6D7B7-QMVH7-4MKQH-Y9%f%VK7_-ServerComputeCluster-ServerDatacenter-ServerDatacenterV-ServerEnterprise-ServerEnterpriseIA64-ServerEnterpriseV-ServerStandard-ServerStandardV-ServerWeb- +56df4151-1f9f-41bf-acaa-2941c071872b_PVGKG-2R7XQ-7WTFD-FXTJR-DQ%f%BQ3_-ServerComputeCluster-ServerEnterprise-ServerEnterpriseV-ServerStandard-ServerStandardV-ServerWeb- +c448fa06-49d1-44ec-82bb-0085545c3b51_KH4PC-KJFX6-XFVHQ-GDK2G-JC%f%JY9_-ServerComputeCluster-ServerWeb- +) do ( +for /f "tokens=1-3 delims=_" %%A in ("%%#") do if not defined key ( +echo "%allapps%" | find /i "%%A" %nul1% && ( +echo "%%C" | find /i "-%tsedition%-" %nul1% && ( +set key=%%B +set tempid=%%A +) +) +) +) + +if defined key ( +echo Checking Activation ID [%tempid%] [%tsedition%] +) else ( +call :dk_color %Red% "Checking Activation ID [Not Found] [%tsedition%] [%osSKU%]" +call :dk_color %Blue% "%KS% Host license is not found on your system. It is available for the below editions." +call :dk_color %Blue% "Business, BusinessN, Enterprise, EnterpriseN, and Server editions, etc." +goto :ts_act +) + +call :ts_inskey "[%key%]" +if not defined error set tsids=%tsids% %tempid% +goto :ts_act + +::======================================================================================================================================== + :ts_ohost :: Process Office K-M-S host @@ -1160,6 +1320,12 @@ goto :ts_act echo: echo Processing Office %KS% Host... +if defined _vis ( +echo: +call :dk_color %Blue% "Windows Vista and Server 2008 do not support the installation of Office KMS Host." +goto :ts_act +) + set ohostexist= call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 set ohostids=%allapps% @@ -1242,7 +1408,11 @@ goto :ts_act :ts_resetall echo: +if defined _vis ( +echo Processing Reset of Rearm / Timers... +) else ( echo Processing Reset of Rearm / Timers / Tamper / Lock... +) echo: set resetstuff=1 @@ -1291,6 +1461,10 @@ goto :dk_done for /f "delims=" %%a in ('%psc% "$ids = Get-WmiObject -Query 'SELECT ID FROM SoftwareLicensingProduct' | Select-Object -ExpandProperty ID; $ids" %nul6%') do call set "allactids= %%a !allactids! " +if defined _vis ( +echo: +call :dk_color %Blue% "On Windows Vista and Server 2008, you must manually install the key before activating it." +) echo: call :dk_color %Gray% "Enter / Paste the Activation ID shown in first column in the opened text file, or just press Enter to return:" echo Add space after each Activation ID if you are adding multiple: @@ -1421,7 +1595,7 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble if defined tsids ( echo: -echo Installing Forged Product Key Data... +if not defined _vis echo Installing Forged Product Key Data... echo Depositing Zero Confirmation ID... echo: %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" @@ -1969,10 +2143,16 @@ exit /b :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) @@ -2090,7 +2270,7 @@ if ($r -eq 0) { :ts_checkwinperm -%psc% "Get-WmiObject -Query 'SELECT Name, Description FROM SoftwareLicensingProduct WHERE LicenseStatus=''1'' AND GracePeriodRemaining=''0'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Where-Object { $_.Description -notmatch 'KMS_' } | Select-Object -Property Name" %nul2% | findstr /i "Windows" %nul1% && set _perm=1||set _perm= +%psc% "Get-WmiObject -Query 'SELECT Name, Description FROM SoftwareLicensingProduct WHERE LicenseStatus=''1'' AND GracePeriodRemaining=''0'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Where-Object { $_.Description -notmatch 'KMS' } | Select-Object -Property Name" %nul2% | findstr /i "Windows" %nul1% && set _perm=1||set _perm= exit /b :: Refresh license status @@ -2101,6 +2281,27 @@ if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call RefreshLicenseStatus if %_wmic% EQU 0 %psc% "$null=(([WMICLASS]'%sps%').GetInstances()).RefreshLicenseStatus()" %nul% exit /b +:: Install Key + +:ts_inskey + +if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey="%key%" %nul% +if %_wmic% EQU 0 %psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% +set keyerror=%errorlevel% +cmd /c exit /b %keyerror% +if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" + +if %keyerror% EQU 0 ( +if %sps%==SoftwareLicensingService call :dk_refresh +echo Installing Product Key %~1 [Successful] +) else ( +set error=1 +call :dk_color %Red% "Installing Product Key %~1 [Failed] %keyerror%" +call :dk_color %Blue% "%_fixmsg%" +) + +exit /b + :: Activation command :dk_act @@ -2153,6 +2354,8 @@ exit /b :dk_reeval +if %winbuild% LSS 7600 exit /b + :: This key is left by the system in rearm process and sppsvc sometimes fails to delete it, it causes issues in working of the Scheduled Tasks of SPP set "ruleskey=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedSystemState" @@ -2180,13 +2383,13 @@ function InstallLicenseArr($Str) { ForEach ($x in $a) {InstallLicenseFile "$x"} } function InstallLicenseDir($Loc) { - dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"} + Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName} } function ReinstallLicenses() { - $Oem = "$env:SysPath\oem" - $Spp = "$env:SysPath\spp\tokens" - InstallLicenseDir "$Spp" - If (Test-Path $Oem) {InstallLicenseDir "$Oem"} + $Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens") + foreach ($Path in $Paths) { + if (Test-Path $Path) { InstallLicenseDir "$Path" } + } } :xrm: @@ -2204,16 +2407,16 @@ exit /b :dk_sppissue -sc start sppsvc %nul% +sc start %_slser% %nul% set spperror=%errorlevel% if %spperror% NEQ 1056 if %spperror% NEQ 0 ( %eline% -echo sc start sppsvc [Error Code: %spperror%] +echo sc start %_slser% [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used) @@ -2231,6 +2434,10 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) +if %winbuild% LSS 7600 ( +set "winos=!winos:VistaT=Vista!" +set "winos=!winos:Serverr=Server!" +) if not defined winsub exit /b @@ -2277,11 +2484,11 @@ for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do ( find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1) if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]" -sc start sppsvc %nul% +sc start %_slser% %nul% echo "%errorlevel%" | findstr "577 225" %nul% && ( set "results=%results%[Likely File Infector]" ) || ( -if not exist %SysPath%\sppsvc.exe 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%"=="" ( @@ -2361,6 +2568,7 @@ for %%# in (%serv_ste%) do ( if /i %%#==ClipSVC (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "3" /f %nul% & sc config %%# start= demand %nul%) if /i %%#==wlidsvc sc config %%# start= demand %nul% if /i %%#==sppsvc (reg add "HKLM\SYSTEM\CurrentControlSet\Services\%%#" /v "Start" /t REG_DWORD /d "2" /f %nul% & sc config %%# start= delayed-auto %nul%) +if /i %%#==SLsvc sc config %%# start= auto %nul% if /i %%#==KeyIso sc config %%# start= demand %nul% if /i %%#==LicenseManager sc config %%# start= demand %nul% if /i %%#==Winmgmt sc config %%# start= auto %nul% @@ -2490,7 +2698,7 @@ if %osedition%==0 ( call :dk_color %Red% "Checking Edition Name [Not Found In Registry]" ) else ( -if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( +if not exist "%SysPath%\spp\tokens\skus\%osedition%\%osedition%*.xrm-ms" if not exist "%SysPath%\spp\tokens\skus\Security-SPP-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" if not exist "%SysPath%\licensing\skus\Security-Licensing-SLC-Component-SKU-%osedition%\*-%osedition%-*.xrm-ms" ( set skunotfound=1 call :dk_color %Red% "Checking License Files [Not Found] [%osedition%]" ) @@ -2572,7 +2780,7 @@ call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %m ) -for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( +for %%# in (SppEx%w%tComObj.exe SLsvc.exe sppsvc.exe sppsvc.exe\PerfOptions) do ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#")) ) if defined _sppint ( @@ -2586,14 +2794,14 @@ echo Checking SPP In IFEO [%_sppint%] ) -for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( +if %winbuild% GEQ 7600 for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 ( reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul% call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null" ) -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]" set fixes=%fixes% %mas%issues_due_to_gaming_spoofers call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers" @@ -2603,21 +2811,22 @@ set showfix=1 set tokenstore= +if %winbuild% GEQ 7600 ( for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v TokenStore %nul6%') do call set "tokenstore=%%b" if %winbuild% LSS 9200 set "tokenstore=%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform" -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" ( set toerr=1 set error=1 set showfix=1 -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!]" set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" ) - +) :: This code creates token folder only if it's missing and sets default permission for it -if not defined toerr if not exist "%tokenstore%\" ( +if %winbuild% GEQ 7600 if not defined toerr if not exist "%tokenstore%\" ( mkdir "%tokenstore%" %nul% if %winbuild% LSS 9200 set "d=$sddl = 'O:NSG:NSD:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;FA;;;NS)';" if %winbuild% GEQ 9200 set "d=$sddl = 'O:BAG:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICIIO;GR;;;BU)(A;;FR;;;BU)(A;OICI;FA;;;S-1-5-80-123231216-2592883651-3715271367-3753151631-4175906628)';" @@ -2638,7 +2847,7 @@ set showfix=1 if not defined notwinact ( call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( -%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($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\:.*';iex ($f[1]); ReinstallLicenses" call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" @@ -2653,7 +2862,7 @@ call :dk_color %Red% "Checking Activation IDs [!_notfoundids!]" ) -if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( +if %winbuild% GEQ 7600 if exist "%tokenstore%\" if not exist "%tokenstore%\tokens.dat" ( set error=1 call :dk_color %Red% "Checking SPP tokens.dat [Not Found] [%tokenstore%\]" ) @@ -2788,8 +2997,10 @@ $wpaKey.Close() if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 ) exit /b @@ -2797,8 +3008,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 ) exit /b @@ -7670,7 +7883,7 @@ function slGetSkuInfo($SkuId) { } } -if ($env:resetstuff -eq $null) { +if (-not $env:resetstuff) { foreach ($tsactid in $tsactids) { try { $prodDes = Get-WmiInfo -tsactid $tsactid -property "Description" @@ -7679,7 +7892,9 @@ if ($env:resetstuff -eq $null) { $nameParts = $prodName -split ',', 2 $prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null } } + if (-not $env:_vis) { [LibTSforge.Modifiers.GenPKeyInstall]::InstallGenPKey($ver, $prod, $tsactid) + } if ($prodName -match 'Office' -and -not (slGetSkuInfo($tsactid))) { $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus" if ($licenseStatus -eq 1) { @@ -7712,13 +7927,13 @@ if ($env:resetstuff -eq $null) { } } -if ($env:resetstuff -eq '1') { +if ($env:resetstuff) { try { - [LibTSforge.Modifiers.TamperedFlagsDelete]::DeleteTamperFlags($ver, $prod) + if (-not $env:_vis) {[LibTSforge.Modifiers.TamperedFlagsDelete]::DeleteTamperFlags($ver, $prod)} [LibTSforge.SPP.SLApi]::RefreshLicenseStatus() [LibTSforge.Modifiers.RearmReset]::Reset($ver, $prod) [LibTSforge.Modifiers.GracePeriodReset]::Reset($ver, $prod) - [LibTSforge.Modifiers.KeyChangeLockDelete]::Delete($ver, $prod) + if (-not $env:_vis) {[LibTSforge.Modifiers.KeyChangeLockDelete]::Delete($ver, $prod)} } catch { $errcode = 3 diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 708689b..7cd7548 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -134,9 +134,9 @@ goto dk_done ) if %winbuild% LSS 7600 ( -%nceline% +%eline% echo Unsupported OS version detected [%winbuild%]. -echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents. +echo This option is supported only for Windows 7/8/8.1/10/11 and their Server equivalents. goto dk_done ) @@ -1352,10 +1352,16 @@ if ($appIdsList.Count -gt 0) { :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) @@ -1412,16 +1418,16 @@ exit /b :dk_sppissue -sc start sppsvc %nul% +sc start %_slser% %nul% set spperror=%errorlevel% if %spperror% NEQ 1056 if %spperror% NEQ 0 ( %eline% -echo sc start sppsvc [Error Code: %spperror%] +echo sc start %_slser% [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Common lines used in PowerShell reflection code @@ -1439,8 +1445,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 ) exit /b @@ -1448,8 +1456,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 ) exit /b diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 594f857..eff01d7 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -139,9 +139,9 @@ goto dk_done ) if %winbuild% LSS 7600 ( -%nceline% +%eline% echo Unsupported OS version detected [%winbuild%]. -echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents. +echo This option is supported only for Windows 7/8/8.1/10/11 and their Server equivalents. goto dk_done ) @@ -824,10 +824,16 @@ exit /b :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) @@ -911,16 +917,16 @@ exit /b :dk_sppissue -sc start sppsvc %nul% +sc start %_slser% %nul% set spperror=%errorlevel% if %spperror% NEQ 1056 if %spperror% NEQ 0 ( %eline% -echo sc start sppsvc [Error Code: %spperror%] +echo sc start %_slser% [Error Code: %spperror%] ) echo: -%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}" +%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host '%_slser% is not working correctly. Check this webpage for help - %mas%troubleshoot'}" exit /b :: Common lines used in PowerShell reflection code @@ -1018,8 +1024,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 ) exit /b @@ -1027,8 +1035,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 ) exit /b diff --git a/MAS/Separate-Files-Version/Check_Activation_Status.cmd b/MAS/Separate-Files-Version/Check_Activation_Status.cmd index fd72a3f..104a856 100644 --- a/MAS/Separate-Files-Version/Check_Activation_Status.cmd +++ b/MAS/Separate-Files-Version/Check_Activation_Status.cmd @@ -23,10 +23,11 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste set "ComSpec=%SysPath%\cmd.exe" set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" -set "_psc=powershell -nop -c" +set "ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe" +set "_psc=%ps% -nop -c" set "_err===== ERROR ====" set _pwsh=1 -for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" set _pwsh=0 +if not exist %ps% set _pwsh=0 cmd /c "%_psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" 1>nul || (set _pwsh=0) if %_pwsh% equ 0 ( echo %_err% diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index 34ba8d0..469d01f 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -129,13 +129,30 @@ echo: setlocal EnableDelayedExpansion set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" -goto dk_done +goto done2 ) -if %winbuild% LSS 7600 ( +if %winbuild% LSS 6001 ( %nceline% echo Unsupported OS version detected [%winbuild%]. -echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents. +echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents. +if %winbuild% EQU 6000 ( +echo: +echo Windows Vista RTM is not supported because Powershell cannot be installed. +echo Upgrade to Windows Vista SP1 or SP2. +) +goto done2 +) + +if not exist %ps% ( +%nceline% +echo PowerShell is not installed in your system. +if %winbuild% LSS 7600 ( +echo Install PowerShell using the following URL. +echo: +echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +) goto done2 ) @@ -732,10 +749,16 @@ exit /b :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) @@ -791,8 +814,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 ) exit /b @@ -800,8 +825,10 @@ exit /b if %_NCS% EQU 1 ( echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( +) else if exist %ps% ( %psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 ) exit /b diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index 487b496..461e866 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -133,10 +133,27 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble goto dk_done ) -if %winbuild% LSS 7600 ( +if %winbuild% LSS 6001 ( %nceline% echo Unsupported OS version detected [%winbuild%]. -echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents. +echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents. +if %winbuild% EQU 6000 ( +echo: +echo Windows Vista RTM is not supported because Powershell cannot be installed. +echo Upgrade to Windows Vista SP1 or SP2. +) +goto dk_done +) + +if not exist %ps% ( +%nceline% +echo PowerShell is not installed in your system. +if %winbuild% LSS 7600 ( +echo Install PowerShell using the following URL. +echo: +echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +) goto dk_done ) @@ -515,6 +532,13 @@ mode 125, 32 ) title Fix Licensing ^(ClipSVC ^+ SPP ^+ OSPP^) +if %winbuild% EQU 6001 ( +%eline% +echo This option is not supported on Windows Vista SP1. +echo Upgrade to Windows Vista SP2. +goto :at_back +) + echo: echo %line% echo: @@ -531,7 +555,7 @@ echo - Clear ClipSVC, SPP and OSPP licenses. echo - Fix permissions of SPP tokens folder and registries. echo - Trigger the repair option for Office. echo: -call :dk_color2 %_White% " - " %Red% "Apply this option only when it is necessary." +call :dk_color2 %_White% " - " %Blue% "Apply this option only when it is necessary." echo: echo %line% echo: @@ -695,19 +719,19 @@ echo [No Error Found] ) echo: -echo Stopping sppsvc service... -%psc% Stop-Service sppsvc -force %nul% +echo Stopping %_slser% service... +%psc% Stop-Service %_slser% -force %nul% set w= set _sppint= -for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (set _sppint=1)) +for %%# in (SppEx%w%tComObj.exe %_slexe%) do (reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (set _sppint=1)) if defined _sppint ( echo: echo Removing SPP IFEO registry keys... -for %%# in (SppE%w%xtComObj.exe sppsvc.exe) do (reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%) +for %%# in (SppE%w%xtComObj.exe %_slexe%) do (reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" /f %nul%) ) -if %winbuild% LSS 9200 ( +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 echo: @@ -726,6 +750,7 @@ del /f /q %SysPath%\7B296FB0-376B-497e-B012-9C450E1B7327-*.C7483456-A289-439d-81 :: Delete registry keys that are not deleted by activation scripts +if not defined _vis ( echo: echo Cleaning some licensing-related registry keys... %nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "ServiceSessionId" /f @@ -733,6 +758,7 @@ echo Cleaning some licensing-related registry keys... %nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "PolicyValuesArray" /f %nul% reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul% reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\data" /f +) echo: call :scandat delete @@ -744,9 +770,13 @@ call :dk_color %Red% "Failed to delete .dat files." echo: ) +if defined _vis ( +%psc% Start-Service %_slser% %nul% +) + echo: echo Reinstalling system licenses... -%psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% +%psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul% if %errorlevel% EQU 0 ( echo [Successful] @@ -763,7 +793,7 @@ call :dk_color %Red% "Failed to rebuild tokens.dat file." echo tokens.dat file was rebuilt successfully. ) -if %winbuild% LSS 9200 ( +if %winbuild% LSS 9200 if not defined _vis ( sc config sppuinotify start= demand ) @@ -1329,13 +1359,13 @@ function InstallLicenseArr($Str) { ForEach ($x in $a) {InstallLicenseFile "$x"} } function InstallLicenseDir($Loc) { - dir $Loc *.xrm-ms -af -s | select -expand FullName | % {InstallLicenseFile "$_"} + Get-ChildItem $Loc -Recurse -Filter *.xrm-ms | ForEach-Object {InstallLicenseFile $_.FullName} } function ReinstallLicenses() { - $Oem = "$env:SysPath\oem" - $Spp = "$env:SysPath\spp\tokens" - InstallLicenseDir "$Spp" - If (Test-Path $Oem) {InstallLicenseDir "$Oem"} + $Paths = @("$env:SysPath\oem", "$env:SysPath\licensing", "$env:SysPath\spp\tokens") + foreach ($Path in $Paths) { + if (Test-Path $Path) { InstallLicenseDir "$Path" } + } } :xrm: @@ -1349,6 +1379,7 @@ for %%# in ( %SysPath%\spp\store\ %SysPath%\spp\store\2.0\ %Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\ +%Systemdrive%\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\ ) do ( if %1==check ( @@ -1424,9 +1455,35 @@ $key.SetAccessControl($acl) ::======================================================================================================================================== +:dk_color + +if %_NCS% EQU 1 ( +echo %esc%[%~1%~2%esc%[0m +) else if exist %ps% ( +%psc% write-host -back '%1' -fore '%2' '%3' +) else if not exist %ps% ( +echo %~3 +) +exit /b + +:dk_color2 + +if %_NCS% EQU 1 ( +echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m +) else if exist %ps% ( +%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' +) else if not exist %ps% ( +echo %~3 %~6 +) +exit /b + +::======================================================================================================================================== + :dk_done echo: +if %_unattended%==1 timeout /t 2 & exit /b + if defined fixes ( 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" @@ -1441,26 +1498,7 @@ choice /c 0 /n call :dk_color %_Yellow% "Press any key to %_exitmsg%..." pause %nul1% ) -exit /b -::======================================================================================================================================== - -:dk_color - -if %_NCS% EQU 1 ( -echo %esc%[%~1%~2%esc%[0m -) else ( -%psc% write-host -back '%1' -fore '%2' '%3' -) -exit /b - -:dk_color2 - -if %_NCS% EQU 1 ( -echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m -) else ( -%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6' -) exit /b ::======================================================================================================================================== @@ -1469,10 +1507,16 @@ exit /b :dk_setvar -set psc=powershell.exe -nop -c +set ps=%SysPath%\WindowsPowerShell\v1.0\powershell.exe +set psc=%ps% -nop -c set winbuild=1 for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G +set _slexe=sppsvc.exe& set _slser=sppsvc +if %winbuild% LEQ 6300 (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %winbuild% LSS 7600 if exist "%SysPath%\SLsvc.exe" (set _slexe=SLsvc.exe& set _slser=SLsvc) +if %_slexe%==SLsvc.exe set _vis=1 + set _NCS=1 if %winbuild% LSS 10586 set _NCS=0 if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0) From 52ba9f138f2a256c4f95de464073fd2778595e56 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Mon, 21 Apr 2025 00:53:08 +0530 Subject: [PATCH 26/30] Ask to run DISM restore and SFC scan when system files are missing --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 18 ++++++++++++++++++ .../Activators/HWID_Activation.cmd | 3 +++ .../Activators/KMS38_Activation.cmd | 3 +++ .../Activators/Ohook_Activation_AIO.cmd | 3 +++ .../Activators/Online_KMS_Activation.cmd | 3 +++ .../Activators/TSforge_Activation.cmd | 3 +++ .../Change_Windows_Edition.cmd | 3 +++ 7 files changed, 36 insertions(+) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index fd2f429..59e6540 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -667,6 +667,9 @@ if not exist %SysPath%\%%# ( %eline% echo [%SysPath%\%%#] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done @@ -2232,6 +2235,9 @@ if not exist %SysPath%\sppsvc.exe ( %eline% echo [%SysPath%\sppsvc.exe] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done @@ -3797,6 +3803,9 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done @@ -10672,6 +10681,9 @@ if defined _fmiss ( %eline% echo [%_fmiss%] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done @@ -11504,6 +11516,9 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done @@ -16421,6 +16436,9 @@ if not exist %SysPath%\%%# ( %eline% echo [%SysPath%\%%#] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 006b184..6aa033b 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -381,6 +381,9 @@ if not exist %SysPath%\%%# ( %eline% echo [%SysPath%\%%#] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index 4610158..890ac89 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -421,6 +421,9 @@ if defined _fmiss ( %eline% echo [%_fmiss%] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 7fe95f3..e2978a4 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -412,6 +412,9 @@ if not exist %SysPath%\sppsvc.exe ( %eline% echo [%SysPath%\sppsvc.exe] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 940c217..8e316c0 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -489,6 +489,9 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index e5228bb..9c64be6 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -498,6 +498,9 @@ if not exist %SysPath%\%_slexe% ( %eline% echo [%SysPath%\%_slexe%] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index eff01d7..ad5083a 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -354,6 +354,9 @@ if not exist %SysPath%\%%# ( %eline% echo [%SysPath%\%%#] file is missing, aborting... echo: +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." +echo: set fixes=%fixes% %mas%troubleshoot call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" goto dk_done From af18bd773c1b4bb4dd1c4e055ab154cccfa7782f Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Mon, 21 Apr 2025 02:29:22 +0530 Subject: [PATCH 27/30] Fix a missing echo --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 59e6540..bc8220d 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -4903,7 +4903,7 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble if defined tsids ( echo: -if not defined _vis Installing Forged Product Key Data... +if not defined _vis echo Installing Forged Product Key Data... echo Depositing Zero Confirmation ID... echo: %psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" From 5090cde0a04698521979d48f28f670827a69d74e Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Mon, 21 Apr 2025 18:01:09 +0530 Subject: [PATCH 28/30] Use wmic.exe on builds below 9200 --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 11 ++++------- .../Activators/HWID_Activation.cmd | 4 +++- .../Activators/KMS38_Activation.cmd | 10 +++------- .../Activators/Ohook_Activation_AIO.cmd | 4 +++- .../Activators/Online_KMS_Activation.cmd | 5 ++++- .../Activators/TSforge_Activation.cmd | 7 ++++--- MAS/Separate-Files-Version/Change_Office_Edition.cmd | 1 + MAS/Separate-Files-Version/Change_Windows_Edition.cmd | 1 + 8 files changed, 23 insertions(+), 20 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index bc8220d..e5bc555 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -1374,6 +1374,7 @@ function ReinstallLicenses() { :dk_ckeckwmic +if %winbuild% LSS 9200 (set _wmic=1&exit /b) set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1 @@ -1687,7 +1688,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed ) -%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% +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%" @@ -10978,12 +10980,6 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml"" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null" -sc query sppsvc | find /i "STOPPED" %nul% && ( -echo Stopping sppsvc Service [Successful] -) || ( -call :dk_color %Gray% "Stopping sppsvc Service [Failed]" -) - %_xmlexist% ( %psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null" %_xmlexist% timeout /t 2 %nul% @@ -12431,6 +12427,7 @@ set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1 ) +if %winbuild% LSS 9200 set _wmic=1 setlocal EnableDelayedExpansion if exist "%ProgramFiles%\Activation-Renewal\" call :_taskstart>>"%ProgramFiles%\Activation-Renewal\Logs.txt" diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 6aa033b..6409cec 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -1072,6 +1072,7 @@ function ReinstallLicenses() { :dk_ckeckwmic +if %winbuild% LSS 9200 (set _wmic=1&exit /b) set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1 @@ -1385,7 +1386,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed ) -%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% +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%" diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index 890ac89..bb2c624 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -718,12 +718,6 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml"" %psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null" -sc query sppsvc | find /i "STOPPED" %nul% && ( -echo Stopping sppsvc Service [Successful] -) || ( -call :dk_color %Gray% "Stopping sppsvc Service [Failed]" -) - %_xmlexist% ( %psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null" %_xmlexist% timeout /t 2 %nul% @@ -1176,6 +1170,7 @@ function ReinstallLicenses() { :dk_ckeckwmic +if %winbuild% LSS 9200 (set _wmic=1&exit /b) set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1 @@ -1534,7 +1529,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed ) -%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% +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%" diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index e2978a4..5be9615 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -1495,6 +1495,7 @@ function ReinstallLicenses() { :dk_ckeckwmic +if %winbuild% LSS 9200 (set _wmic=1&exit /b) set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1 @@ -1793,7 +1794,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed ) -%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% +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%" diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 8e316c0..48e93ac 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -1686,6 +1686,7 @@ set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1 ) +if %winbuild% LSS 9200 set _wmic=1 setlocal EnableDelayedExpansion if exist "%ProgramFiles%\Activation-Renewal\" call :_taskstart>>"%ProgramFiles%\Activation-Renewal\Logs.txt" @@ -2739,6 +2740,7 @@ function ReinstallLicenses() { :dk_ckeckwmic +if %winbuild% LSS 9200 (set _wmic=1&exit /b) set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1 @@ -3097,7 +3099,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed ) -%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% +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%" diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 9c64be6..b4effe7 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -2400,6 +2400,7 @@ function ReinstallLicenses() { :dk_ckeckwmic +if %winbuild% LSS 9200 (set _wmic=1&exit /b) set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1 @@ -2712,8 +2713,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed ) ) - -%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% +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%" @@ -2850,7 +2851,7 @@ set showfix=1 if not defined notwinact ( call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f 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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" +%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\:.*';iex ($f[1]); ReinstallLicenses" %nul% call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f if not defined apps ( set "_notfoundids=Key Not Installed / Act ID Not Found" diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index 7cd7548..a068afa 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -1408,6 +1408,7 @@ exit /b :dk_ckeckwmic +if %winbuild% LSS 9200 (set _wmic=1&exit /b) set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1 diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index ad5083a..5c34093 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -910,6 +910,7 @@ exit /b :dk_ckeckwmic +if %winbuild% LSS 9200 (set _wmic=1&exit /b) set _wmic=0 for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" ( cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1 From b8ad749bac256882fd5ec1c3b2924ff86e681c90 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Mon, 21 Apr 2025 20:22:13 +0530 Subject: [PATCH 29/30] Fix issue related to URL opening in unattended mode --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 4 ++-- .../Activators/Online_KMS_Activation.cmd | 2 +- MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd | 4 ++-- MAS/Separate-Files-Version/Extract_OEM_Folder.cmd | 2 +- MAS/Separate-Files-Version/Troubleshoot.cmd | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index e5bc555..a67b39c 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -160,7 +160,7 @@ if %winbuild% LSS 7600 ( echo Install PowerShell using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 ) goto dk_done ) @@ -3719,7 +3719,7 @@ 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 -start https://www.microsoft.com/download/details.aspx?id=25150 +if %_unattended%==0 start https://www.microsoft.com/download/details.aspx?id=25150 goto dk_done ) ) diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 48e93ac..07b7470 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -221,7 +221,7 @@ if %winbuild% LSS 7600 ( echo Install PowerShell using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 ) goto dk_done ) diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index b4effe7..2400e45 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -227,7 +227,7 @@ if %winbuild% LSS 7600 ( echo Install PowerShell using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 ) goto dk_done ) @@ -239,7 +239,7 @@ 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 -start https://www.microsoft.com/download/details.aspx?id=25150 +if %_unattended%==0 start https://www.microsoft.com/download/details.aspx?id=25150 goto dk_done ) ) diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index 469d01f..10030b1 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -151,7 +151,7 @@ if %winbuild% LSS 7600 ( echo Install PowerShell using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 ) goto done2 ) diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index 461e866..55a42ed 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -152,7 +152,7 @@ if %winbuild% LSS 7600 ( echo Install PowerShell using the following URL. echo: echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 -start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 ) goto dk_done ) From 5872b7df53cb1d0e4316860897a0725695dc4864 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Tue, 29 Apr 2025 22:40:56 +0530 Subject: [PATCH 30/30] 3.1 Added Ohook support for OSPP based Office on Vista and later --- .gitattributes | 6 +- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 997 ++++++++++-------- .../Activators/HWID_Activation.cmd | 15 +- .../Activators/KMS38_Activation.cmd | 15 +- .../Activators/Ohook_Activation_AIO.cmd | 480 +++++++-- .../Activators/Online_KMS_Activation.cmd | 63 +- .../Activators/TSforge_Activation.cmd | 92 +- .../Change_Office_Edition.cmd | 2 +- .../Change_Windows_Edition.cmd | 2 +- .../Check_Activation_Status.cmd | 427 ++++---- .../Extract_OEM_Folder.cmd | 2 +- MAS/Separate-Files-Version/Troubleshoot.cmd | 2 +- README.md | 45 +- 13 files changed, 1320 insertions(+), 828 deletions(-) diff --git a/.gitattributes b/.gitattributes index 8749e12..de5bd3d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ -# MAS export-ignore -# LICENSE export-ignore -# README.md export-ignore +MAS export-ignore +LICENSE export-ignore +README.md export-ignore .gitattributes export-ignore diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index a67b39c..73ac408 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -1,5 +1,5 @@ -@::63489fhty3-random -@set masver=3.0 +@::de62hd8-random +@set masver=3.1 @setlocal DisableDelayedExpansion @echo off @@ -386,8 +386,7 @@ if not defined terminal mode 76, 34 if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" set _hwidgo=1 if %winbuild% GTR 14393 if exist "%SysPath%\spp\tokens\skus\EnterpriseSN\" set _hwidgo= if not defined _hwidgo set _tsforgego=1 -if %winbuild% GEQ 9200 set _ohookgo=1 -if %winbuild% LSS 9200 set _okmsgo=1 +set _ohookgo=1 echo: echo: @@ -413,11 +412,7 @@ call :dk_color3 %_White% " [3] " %_Green% "TSforge" %_White% " echo: [3] TSforge - Windows / Office / ESU ) echo: [4] KMS38 - Windows -if defined _okmsgo ( -call :dk_color3 %_White% " [5] " %_Green% "Online KMS" %_White% " - Windows / Office" -) else ( echo: [5] Online KMS - Windows / Office -) echo: __________________________________________________ echo: echo: [6] Check Activation Status @@ -827,6 +822,7 @@ call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] detected. Script w echo: ) +set generickey=1 call :dk_inskey "[%key%]" ::======================================================================================================================================== @@ -1246,11 +1242,12 @@ set keyerror=%errorlevel% cmd /c exit /b %keyerror% if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" +if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ") if %keyerror% EQU 0 ( if %sps%==SoftwareLicensingService call :dk_refresh -echo Installing Generic Product Key %~1 [Successful] +echo %keyecho% %~1 [Successful] ) else ( -call :dk_color %Red% "Installing Generic Product Key %~1 [Failed] %keyerror%" +call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%" if not defined error ( if defined altapplist call :dk_color %Red% "Activation ID not found for this key." call :dk_color %Blue% "%_fixmsg%" @@ -1259,6 +1256,7 @@ set showfix=1 set error=1 ) +set generickey= exit /b :: Activation command @@ -1402,7 +1400,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -1412,10 +1410,6 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) -if %winbuild% LSS 7600 ( -set "winos=!winos:VistaT=Vista!" -set "winos=!winos:Serverr=Server!" -) if not defined winsub exit /b @@ -2170,12 +2164,27 @@ for %%A in (%_act% %_rem%) do (if "%%A"=="1" set _unattended=1) ::======================================================================================================================================== -if %winbuild% LSS 9200 ( -%eline% +if %winbuild% LSS 6001 ( +%nceline% echo Unsupported OS version detected [%winbuild%]. -echo Ohook Activation is supported only on Windows 8/10/11 and their server equivalents. +echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents. +if %winbuild% EQU 6000 ( echo: -call :dk_color %Blue% "Use Online KMS activation option instead." +echo Windows Vista RTM is not supported because Powershell cannot be installed. +echo Upgrade to Windows Vista SP1 or SP2. +) +goto dk_done +) + +if not exist %ps% ( +%nceline% +echo PowerShell is not installed in your system. +if %winbuild% LSS 7600 ( +echo Install PowerShell using the following URL. +echo: +echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +) goto dk_done ) @@ -2223,8 +2232,8 @@ goto :oh_menu cls if not defined terminal ( -mode 130, 32 -if exist "%SysPath%\spp\store_test\" mode 134, 32 +mode 140, 32 +if exist "%SysPath%\spp\store_test\" mode 140, 32 %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% ) title Ohook Activation %masver% @@ -2233,9 +2242,9 @@ echo: echo Initializing... call :dk_chkmal -if not exist %SysPath%\sppsvc.exe ( +if not exist %SysPath%\%_slexe% ( %eline% -echo [%SysPath%\sppsvc.exe] file is missing, aborting... +echo [%SysPath%\%_slexe%] file is missing, aborting... echo: 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." @@ -2267,7 +2276,7 @@ call :dk_showosinfo echo Initiating Diagnostic Tests... -set "_serv=sppsvc Winmgmt" +set "_serv=%_slser% Winmgmt" :: Software Protection :: Windows Management Instrumentation @@ -2276,9 +2285,10 @@ set notwinact=1 set ohookact=1 call :dk_errorcheck +call :oh_setspp + :: Check unsupported office versions -set o14msi= set o14c2r= set o16uwp= @@ -2293,10 +2303,10 @@ if %winbuild% GEQ 10240 ( for /f "delims=" %%a in ('%psc% "(Get-AppxPackage -name 'Microsoft.Office.Desktop' | Select-Object -ExpandProperty InstallLocation)" %nul6%') do (if exist "%%a\Integration\Integrator.exe" set o16uwp=Office UWP ) ) -if not "%o14msi%%o14c2r%%o16uwp%"=="" ( +if not "%o14c2r%%o16uwp%"=="" ( echo: -call :dk_color %Red% "Checking Unsupported Office Install [ %o14msi%%o14c2r%%o16uwp%]" -if not "%o14msi%%o16uwp%"=="" call :dk_color %Blue% "Use Online KMS option to activate it." +call :dk_color %Red% "Checking Unsupported Office Install [ %o14c2r%%o16uwp%]" +if not "%o16uwp%"=="" call :dk_color %Blue% "Use TSforge option to activate it." ) if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && ( @@ -2327,10 +2337,10 @@ set o15c2r= set error=1 ) -if "%o16c2r%%o15c2r%%o16msi%%o15msi%"=="" ( +if "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="" ( set error=1 echo: -if not "%o14msi%%o14c2r%%o16uwp%"=="" ( +if not "%o14c2r%%o16uwp%"=="" ( call :dk_color %Red% "Checking Supported Office Install [Not Found]" ) else ( call :dk_color %Red% "Checking Installed Office [Not Found]" @@ -2349,8 +2359,8 @@ goto dk_done ) set multioffice= -if not "%o16c2r%%o15c2r%%o16msi%%o15msi%"=="1" set multioffice=1 -if not "%o14msi%%o14c2r%%o16uwp%"=="" set multioffice=1 +if not "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="1" set multioffice=1 +if not "%o14c2r%%o16uwp%"=="" set multioffice=1 if defined multioffice ( call :dk_color %Gray% "Checking Multiple Office Install [Found, its recommended to install only one version]" @@ -2394,12 +2404,8 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe" if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll") if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll") -if not "%osarch%"=="x86" ( -if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll" -if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll" -) else ( -set "_sppcPath=%SystemRoot%\System32\sppc.dll" -) + +call :oh_ppcpath echo: echo Activating Office... [C2R ^| %_version% ^| %_oArch%] @@ -2410,9 +2416,20 @@ set error=1 goto :starto16c2r ) +if defined noOsppc ( +call :dk_color %Red% "Checking OSPPC.DLL [Not found. Aborting activation...]" +call :dk_color %Blue% "%_fixmsg%" +set error=1 +goto :starto16c2r +) + call :oh_fixprids call :oh_process +if defined isOspp ( +call :oh_hookinstall_ospp +) else ( call :oh_hookinstall +) ::======================================================================================================================================== @@ -2444,12 +2461,8 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe" if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll") if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll") -if not "%osarch%"=="x86" ( -if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll" -if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll" -) else ( -set "_sppcPath=%SystemRoot%\System32\sppc.dll" -) + +call :oh_ppcpath echo: echo Activating Office... [C2R ^| %_version% %_AudienceData%^| %_oArch%] @@ -2460,9 +2473,20 @@ set error=1 goto :startmsi ) +if defined noOsppc ( +call :dk_color %Red% "Checking OSPPC.DLL [Not found. Aborting activation...]" +call :dk_color %Blue% "%_fixmsg%" +set error=1 +goto :startmsi +) + call :oh_fixprids call :oh_process +if defined isOspp ( +call :oh_hookinstall_ospp +) else ( call :oh_hookinstall +) ::======================================================================================================================================== @@ -2499,6 +2523,9 @@ echo Adding a Registry to Prevent Banner [Successful] :startmsi +if defined o14msi call :oh_setspp 14 +if defined o14msi call :oh_processmsi 14 %o14msi_reg% +call :oh_setspp if defined o15msi call :oh_processmsi 15 %o15msi_reg% if defined o16msi call :oh_processmsi 16 %o16msi_reg% @@ -2530,7 +2557,7 @@ goto :dk_done :oh_uninstall cls -if not defined terminal mode 99, 32 +if not defined terminal mode 145, 32 title Uninstall Ohook Activation %masver% set _present= @@ -2546,6 +2573,7 @@ if defined o16c2r_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg if defined o15c2r_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o15c2r_reg% /v InstallPath" %nul6%') do (set "_15CHook=%%b\root\vfs")) if defined o16msi_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o16msi_reg%\Common\InstallRoot /v Path" %nul6%') do (set "_16MHook=%%b")) if defined o15msi_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o15msi_reg%\Common\InstallRoot /v Path" %nul6%') do (set "_15MHook=%%b")) +if defined o14msi_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o14msi_reg%\Common\InstallRoot /v Path" %nul6%') do (set "_14MHook=%%b")) if defined _16CHook (if exist "%_16CHook%\System\sppc*dll" (set _present=1& del /s /f /q "%_16CHook%\System\sppc*dll" & if exist "%_16CHook%\System\sppc*dll" set _unerror=1)) if defined _16CHook (if exist "%_16CHook%\SystemX86\sppc*dll" (set _present=1& del /s /f /q "%_16CHook%\SystemX86\sppc*dll" & if exist "%_16CHook%\SystemX86\sppc*dll" set _unerror=1)) @@ -2553,8 +2581,9 @@ if defined _15CHook (if exist "%_15CHook%\System\sppc*dll" (set _present=1& d if defined _15CHook (if exist "%_15CHook%\SystemX86\sppc*dll" (set _present=1& del /s /f /q "%_15CHook%\SystemX86\sppc*dll" & if exist "%_15CHook%\SystemX86\sppc*dll" set _unerror=1)) if defined _16MHook (if exist "%_16MHook%sppc*dll" (set _present=1& del /s /f /q "%_16MHook%sppc*dll" & if exist "%_16MHook%sppc*dll" set _unerror=1)) if defined _15MHook (if exist "%_15MHook%sppc*dll" (set _present=1& del /s /f /q "%_15MHook%sppc*dll" & if exist "%_15MHook%sppc*dll" set _unerror=1)) +if defined _14MHook (if exist "%_14MHook%sppc*dll" (set _present=1& del /s /f /q "%_14MHook%sppc*dll" & if exist "%_14MHook%sppc*dll" set _unerror=1)) -for %%# in (15 16) do ( +for %%# in (14 15 16) do ( for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do ( if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" (set _present=1& del /s /f /q "%%~A\Microsoft Office\Office%%#\sppc*dll" & if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" set _unerror=1) ) @@ -2568,6 +2597,31 @@ if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" (set _present=1& del /s /f ) ) +::================================== + +for %%# in (OSPPC.DLL sppcs.dll) do ( +for %%A in ("%CommonProgramFiles%" "%CommonProgramW6432%" "%CommonProgramFiles(x86)%") do ( +for %%G in ("%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\%%#") do ( +set size=0 +set size=%%~zG +if !size! GEQ 1 if !size! LSS 100000 ( +set _present=1 +del /f /q "%%~G" +if exist "%%~G" (move /y "%%~G" "!_ttemp!\needsToBeDeleted%random%" %nul%) +if exist "%%~G" (set _unerror=1) else (echo Deleted file - %%~G) +) +if /i sppcs.dll==%%# if !size! GEQ 100000 ( +move /y "%%~G" "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL" %nul% +if exist "%%~G" (move /y "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL" "!_ttemp!\needsToBeDeleted%random%" %nul%) +move /y "%%~G" "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL" %nul% +if exist "%%~G" (set _unerror=1&echo Failed to rename sppcs.dll back to "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL") else (echo Renamed sppcs.dll back to "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL") +) +) +) +) + +::================================== + reg query HKCU\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && ( echo: echo Deleting - Registry keys for skipping license check @@ -2597,6 +2651,8 @@ reg unload HKU\%%# %nul% ) ) +::================================== + set "kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663" reg query "%kmskey%" %nul% && ( echo: @@ -2643,6 +2699,7 @@ set _oLPath= set _hookPath= set _hook= set _sppcPath= +set _osppPath= set _actid= set _prod= set _lic= @@ -2661,6 +2718,7 @@ set o16c2r= set o15c2r= set o16msi= set o15msi= +set o14msi= set _68=HKLM\SOFTWARE\Microsoft\Office set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office @@ -2674,6 +2732,52 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v P for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0) + +exit /b + +::======================================================================================================================================== + +:oh_ppcpath + +if not defined isOspp ( +if not "%osarch%"=="x86" ( +if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll" +if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll" +) else ( +set "_sppcPath=%SystemRoot%\System32\sppc.dll" +) +) + +set noOsppc= +set _hook68= +set _hook86= +set _osppPath68= +set _osppPath86= + +if defined isOspp ( +if not "%osarch%"=="x86" ( +if /i "%_oArch%"=="x64" ( +for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath68=%%b") +if not exist "!_osppPath68!OSPPC.DLL" set noOsppc=1 +) +if /i "%_oArch%"=="x86" ( +for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath68=%%b") +for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath86=%%b") +if not exist "!_osppPath68!OSPPC.DLL" set noOsppc=1 +if not exist "!_osppPath86!OSPPC.DLL" set noOsppc=1 +) +) else ( +for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath86=%%b") +if not exist "!_osppPath86!OSPPC.DLL" set noOsppc=1 +) +if "!_osppPath68:~-1!"=="\" set "_osppPath68=!_osppPath68:~0,-1!" +if "!_osppPath86:~-1!"=="\" set "_osppPath86=!_osppPath86:~0,-1!" +) + +if defined _osppPath68 set _hook68=sppc64.dll +if defined _osppPath86 set _hook86=sppc32.dll exit /b @@ -2769,15 +2873,24 @@ set hasherror= if %_hook%==sppc32.dll set offset=2564 if %_hook%==sppc64.dll set offset=3076 -del /s /q "%_hookPath%\sppcs.dll" %nul% -del /s /q "%_hookPath%\sppc.dll" %nul% +::====================================== -if exist "%_hookPath%\sppcs.dll" set "ierror=Remove Previous Ohook Install" -if exist "%_hookPath%\sppc.dll" set "ierror=Remove Previous Ohook Install" +:: Remove previous Install + +for %%# in (sppcs.dll sppc.dll) do ( +del /f /q "%_hookPath%\%%#" %nul% +if exist "%_hookPath%\%%#" (move /y "%_hookPath%\%%#" "!_ttemp!\needsToBeDeleted%random%" %nul%) +if exist "%_hookPath%\%%#" (set "ierror=Remove Previous Ohook Install [%%#]") +) + +if defined ierror goto :oh_hookinstall_error + +::====================================== mklink "%_hookPath%\sppcs.dll" "%_sppcPath%" %nul% -if not %errorlevel%==0 ( -if not defined ierror set ierror=mklink +if not exist "%_hookPath%\sppcs.dll" ( +set ierror=mklink sppcs.dll +goto :oh_hookinstall_error ) set exhook= @@ -2792,17 +2905,122 @@ popd call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%" ) ) -if not exist "%_hookPath%\sppc.dll" (if not defined ierror set ierror=Copy) +if not exist "%_hookPath%\sppc.dll" ( +set ierror=Copy +goto :oh_hookinstall_error +) echo: -if not defined ierror ( -echo Symlinking System's sppc.dll to ["%_hookPath%\sppcs.dll"] [Successful] +echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful] if defined exhook ( echo Copying Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful] ) else ( echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful] ) + +goto :oh_hookinstall_error + +::======================================================================================================================================== + +:oh_hookinstall_ospp + +set ierror= +set hasherror= + +if defined _hook86 set offset86=2564 +if defined _hook68 set offset68=3076 + +::====================================== + +:: Remove previous Install + +for %%# in (OSPPC.DLL sppcs.dll) do ( +for %%A in ("%_osppPath68%\%%#" "%_osppPath86%\%%#") do ( +set size=0 +set size=%%~zA +if !size! GEQ 1 if !size! LSS 100000 ( +del /f /q "%%~A" %nul% +if exist "%%~A" (move /y "%%~A" "!_ttemp!\needsToBeDeleted%random%" %nul%) +if exist "%%~A" (set "ierror=Remove Previous Ohook Install [%%#]") +) +) +) + +if defined ierror goto :oh_hookinstall_error + +for %%A in ("%_osppPath68%" "%_osppPath86%") do ( +if exist "%%~A\sppcs.dll" (move /y "%%~A\sppcs.dll" "%%~A\OSPPC.DLL" %nul%) +if exist "%%~A\sppcs.dll" ( +move /y "%%~A\OSPPC.DLL" "!_ttemp!\needsToBeDeleted%random%" %nul% +move /y "%%~A\sppcs.dll" "%%~A\OSPPC.DLL" %nul% +) +if exist "%%~A\sppcs.dll" (set "ierror=Move sppcs.dll back to OSPPC.DLL") +) + +del /f /q "%_hookPath%\sppcs.dll" %nul% +if exist "%_hookPath%\sppcs.dll" (move /y "%_hookPath%\sppcs.dll" "!_ttemp!\needsToBeDeleted%random%" %nul%) +if exist "%_hookPath%\sppcs.dll" (set "ierror=Remove Previous Ohook mklink sppcs.dll") + +if defined ierror goto :oh_hookinstall_error + +::====================================== + +if defined _osppPath68 (move /y "%_osppPath68%\OSPPC.DLL" "%_osppPath68%\sppcs.dll" %nul% & if not exist "%_osppPath68%\sppcs.dll" set ierror=1) +if defined _osppPath86 (move /y "%_osppPath86%\OSPPC.DLL" "%_osppPath86%\sppcs.dll" %nul% & if not exist "%_osppPath86%\sppcs.dll" set ierror=1) + +if defined ierror ( +set "ierror=Rename OSPPC.DLL" +goto :oh_hookinstall_error +) + +if defined _osppPath68 if defined _osppPath86 (mklink "%_hookPath%\sppcs.dll" "%_osppPath86%\sppcs.dll" %nul%) +if defined _osppPath68 if not defined _osppPath86 (mklink "%_hookPath%\sppcs.dll" "%_osppPath68%\sppcs.dll" %nul%) +if defined _osppPath86 if not defined _osppPath68 (mklink "%_hookPath%\sppcs.dll" "%_osppPath86%\sppcs.dll" %nul%) + +if not exist "%_hookPath%\sppcs.dll" ( +set ierror=mklink sppcs.dll +goto :oh_hookinstall_error +) + +set exhook= +if exist "!_work!\BIN\%_hook68%" if exist "!_work!\BIN\%_hook86%" set exhook=1 + +if defined exhook ( +pushd "!_work!\BIN\" +if defined _osppPath68 (copy /y /b "%_hook68%" "%_osppPath68%\OSPPC.DLL" %nul%) +if defined _osppPath86 (copy /y /b "%_hook86%" "%_osppPath86%\OSPPC.DLL" %nul%) +popd ) else ( +if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%") +if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%") +) + +if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1) +if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1) + +if defined ierror ( +set ierror=Copy +goto :oh_hookinstall_error +) + +echo: +if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"]) +if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"]) +if defined exhook ( +if defined _osppPath68 (echo Copying Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"]) +if defined _osppPath86 (echo Copying Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"]) +) else ( +if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"]) +if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"]) +) + +echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"] + +::======================================================================================================================================== + +:oh_hookinstall_error + +if defined ierror ( set error=1 call :dk_color %Red% "Installing Ohook [Failed to %ierror%]" echo: @@ -2821,9 +3039,9 @@ if not defined exhook if not defined ierror ( if defined hasherror ( set error=1 set ierror=1 -call :dk_color %Red% "Modifying Hash of Custom %_hook% [Failed]" +call :dk_color %Red% "Modifying Hash of Custom sppcs.dll [Failed]" ) else ( -echo Modifying Hash of Custom %_hook% [Successful] +echo Modifying Hash of Custom sppcs.dll [Successful] ) ) @@ -2831,6 +3049,26 @@ exit /b ::======================================================================================================================================== +:oh_setspp + +set isOspp= +if %winbuild% GEQ 9200 ( +set spp=SoftwareLicensingProduct +set sps=SoftwareLicensingService +) else ( +set isOspp=1 +set spp=OfficeSoftwareProtectionProduct +set sps=OfficeSoftwareProtectionService +) +if "%1"=="14" ( +set isOspp=1 +set spp=OfficeSoftwareProtectionProduct +set sps=OfficeSoftwareProtectionService +) +exit /b + +::======================================================================================================================================== + :oh_process for %%# in (%_oIds%) do ( @@ -2850,10 +3088,11 @@ call :ohookdata getinfo !_prod! if not "!key!"=="" ( echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic +if not %oVer%==14 set generickey=1 call :dk_inskey "[!key!] [!_prod!] [!_lic!]" ) else ( set error=1 -call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]" +call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! key not found in script]" call :dk_color %Blue% "Make sure you are using the latest version of MAS." set fixes=%fixes% %mas% call :dk_color %_Yellow% "%mas%" @@ -2880,7 +3119,11 @@ exit /b :: Process Office MSI Version call :oh_reset +if "%1"=="14" ( +call :dk_actids 59a52881-a989-479d-af46-f275c6370663 +) else ( call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 +) set oVer=%1 for /f "skip=2 tokens=2*" %%a in ('"reg query %2\Common\InstallRoot /v Path" %nul6%') do (set "_oRoot=%%b") @@ -2893,16 +3136,8 @@ if "%osarch%"=="x86" set _oArch=x86 if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%" & set "_hook=sppc64.dll") if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%" & set "_hook=sppc32.dll") -if not "%osarch%"=="x86" ( -if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll" -if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll" -) else ( -set "_sppcPath=%SystemRoot%\System32\sppc.dll" -) -set "_common=%CommonProgramFiles%" -if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" -set "_common2=%CommonProgramFiles(x86)%" +call :oh_ppcpath call :msiofficedata %2 @@ -2915,8 +3150,23 @@ call :dk_color %Red% "Checking Installed Products [Product IDs not f exit /b ) +if defined noOsppc ( +call :dk_color %Red% "Checking OSPPC.DLL [Not found. Aborting activation...]" +call :dk_color %Blue% "%_fixmsg%" +set error=1 +exit /b +) + +if %oVer%==14 if defined SingleImage ( +echo Checking Installed Products [SingleImage product found, Professional Retail key will be used for activation] +) + call :oh_process +if defined isOspp ( +call :oh_hookinstall_ospp +) else ( call :oh_hookinstall +) exit /b @@ -3154,15 +3404,69 @@ exit /b :: 1st column = Office version number :: 2nd column = Activation ID -:: 3rd column = Generic key. Preference is given in this order, Retail:TB:Sub > Retail > OEM:NONSLP > Volume:MAK > Volume:GVLK +:: 3rd column = For Office 2013 and later, the generated keys are listed. For Office 2010, the blocked keys sourced from the Internet are listed. +:: For Office 2013 and later, key preference is given in this order, Retail:TB:Sub > Retail > OEM:NONSLP > Volume:MAK > Volume:GVLK +:: For Office 2010, key preference is given in this order, Retail > Volume:MAK :: 4th column = Last part of license description :: 5th column = Edition +:: 6th column = Other Edition IDs if they are part of the same primary product (For reference only) :: Separator = "_" +::=============== + +:: We couldn't find any keys (blocked/generic doesn't matter) for these Office 2010 products. If you have them, please share with us. + +14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_Retail________ExcelR_[HSExcelR] +14_7004b7f0-6407-4f45-8eac-966e5f868bde_Retail________GrooveR +14_fbf4ac36-31c8-4340-8666-79873129cf40_Retail________OutlookR +14_133c8359-4e93-4241-8118-30bb18737ea0_Retail________PowerPointR_[HSPowerPointR] +14_98677603-a668-4fa4-9980-3f1f05f78f69_Retail________PublisherR +14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_Retail________WordR_[HSWordR] +14_dbe3aee0-5183-4ff7-8142-66050173cb01_Retail________SmallBusBasicsR_[SmallBusBasicsMSDNR] + +:: These installers are not publicly available, so it doesn't matter if we don't have their keys. + +14_19316117-30a8-4773-8fd9-7f7231f4e060_SubPrepid_____HomeBusinessSubR +14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_SubPrepid_____ProjectProSubR +14_e98ef0c0-71c4-42ce-8305-287d8721e26c_SubPrepid_____ProPlusSubR +14_14f5946a-debc-4716-babc-7e2c240fec08_Retail________MondoR +14_533b656a-4425-480b-8e30-1a2358898350_MAK___________MondoVL + :ohookdata set f= for %%# in ( +:: Office 2010 +14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_7KTYC-XR43P-C3MRW-BJKFD-XB%f%YPG_Retail________AccessR +14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_7XHPQ-BQMYG-YBP49-CY8B2-T8%f%CGQ_ByPass________AccessRuntimeR +14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_89RTQ-MT4GK-6CPTX-WWP7C-J9%f%KXR_MAK___________AccessVL +14_71dc86ff-f056-40d0-8ffb-9592705c9b76_39TRR-C2F37-9WYJ2-MJQXH-B9%f%38K_MAK___________ExcelVL +14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_RCGT3-FPQDV-H49CD-PPDBF-TH%f%47G_MAK___________GrooveVL +14_7b7d1f17-fdcb-4820-9789-9bec6e377821_3YR9B-D9W79-BY66R-R8XYP-QY%f%YYY_Retail________HomeBusinessR_[HomeBusinessDemoR] +14_09e2d37e-474b-4121-8626-58ad9be5776f_3X43R-HHHXX-FRHRW-2M2WJ-8V%f%PHD_Retail________HomeStudentR_[HomeStudentDemoR] +14_ef1da464-01c8-43a6-91af-e4e5713744f9_XDGJY-KFHW9-JWX9X-YM4GW-GC%f%8WR_Retail________InfoPathR +14_85e22450-b741-430c-a172-a37962c938af_6GKT2-KMJPK-4RRBF-8VQKB-JB%f%6G6_MAK___________InfoPathVL +14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_2TG3P-9DB76-4YT99-8RXGD-CW%f%XBP_Retail________OneNoteR_[HSOneNoteR] +14_6860b31f-6a67-48b8-84b9-e312b3485c4b_CV64P-F4VRH-BJ33D-PH6MR-X6%f%9RY_MAK___________OneNoteVL +14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_J8C9M-YXMH2-9CX44-2C3YG-V7%f%692_MAK___________OutlookVL +14_acb51361-c0db-4895-9497-1831c41f31a6_GMBWM-WVX26-7WHV4-DB43D-WV%f%DY2_Retail________PersonalR_[PersonalDemoR,PersonalPrepaidR] +14_38252940-718c-4aa6-81a4-135398e53851_HPBQP-RJHDR-Q3472-PT9Q6-PB%f%B72_MAK___________PowerPointVL +14_8b559c37-0117-413e-921b-b853aeb6e210_367X9-9HP9R-TKHY6-DH4QH-K9%f%PY7_Retail________ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR,OEM-SingleImage] +14_725714d7-d58f-4d12-9fa8-35873c6f7215_6JD4G-KRW3J-48MGV-DM6FC-T9%f%WKR_Retail________ProjectProR_[ProjectProMSDNR] +14_1cf57a59-c532-4e56-9a7d-ffa2fe94b474_3XDTH-MMGJ6-F9MKX-THP8D-G9%f%BP7_MAK___________ProjectProVL +14_688f6589-2bd9-424e-a152-b13f36aa6de1_2W96V-RTQ9R-2BPVT-PT8H9-MV%f%68T_Retail________ProjectStdR +14_11b39439-6b93-4642-9570-f2eb81be2238_4DTT4-D4MKX-23KFH-JKR6T-YK%f%G2J_MAK___________ProjectStdVL +14_71af7e84-93e6-4363-9b69-699e04e74071_2J9H6-H4D3G-PCXD2-96XVM-TR%f%R73_Retail________ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] +14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_6CD6C-9R8PB-T2D9Y-8RKKX-W7%f%DFK_MAK___________ProPlusVL_[ProPlusAcadVL] +14_3d014759-b128-4466-9018-e80f6320d9d0_32YG9-3VX77-YXJVV-PRVFW-TT%f%8BV_MAK___________PublisherVL +14_8090771e-d41a-4482-929e-de87f1f47e46_7VKXH-9BWCG-RPTBB-JBRV3-GR%f%HYC_MAK___________SmallBusBasicsVL +14_b78df69e-0966-40b1-ae85-30a5134dedd0_H48K6-FB4Y6-P83GH-9J7XG-HD%f%KKX_ByPass________SPDR +14_b6d2565c-341d-4768-ad7d-addbe00bb5ce_W3BTX-H6BW7-Q6DFW-BXFFY-8R%f%VJP_Retail________StandardR_[StandardMSDNR][KeyisforMSDNR] +14_1f76e346-e0be-49bc-9954-70ec53a4fcfe_2XTQP-GDR7C-GTXPC-6W6PV-4R%f%XGC_MAK___________StandardVL_[StandardAcadVL] +14_2745e581-565a-4670-ae90-6bf7c57ffe43_VXHHB-W7HBD-7M342-RJ7P8-CH%f%BD6_ByPass________StarterR +14_66cad568-c2dc-459d-93ec-2f3cb967ee34_2RDPT-WPYQM-C2WXF-BTPDW-2J%f%2HM_Retail________VisioSIR_Prem[Pro,Std] +14_36756cb8-8e69-4d11-9522-68899507cd6a_7PKFT-X2MKQ-GT6X2-8CB2W-CH%f%C9K_MAK___________VisioSIVL_Prem[Pro,Std] +14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_6J3XK-DFKGK-X373V-QJHYM-V3%f%FC2_MAK___________WordVL :: Office 2013 15_ab4d047b-97cf-4126-a69f-34df08e2f254_B7RFY-7NXPK-Q4342-Y9X2H-3J%f%X4X_Retail________AccessRetail 15_259de5be-492b-44b3-9d78-9645f848f7b0_X3XNB-HJB7K-66THH-8DWQ3-XH%f%GJP_Bypass________AccessRuntimeRetail @@ -3397,7 +3701,7 @@ exit /b :oh_extractdll set b= -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1]);" %nul2% | find /i "Error found" %nul1% && set hasherror=1 +%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1])" %nul2% | find /i "Error found" %nul1% && set hasherror=1 exit /b :hexedit: @@ -3436,7 +3740,7 @@ $Writer.Write($unixTimestamp) $Writer.Flush() # Write the current state of the MemoryStream to a temporary file -$tempFilePath = [System.IO.Path]::Combine($env:windir, "Temp", [System.IO.Path]::GetRandomFileName()) +$tempFilePath = "$env:windir\Temp\$([System.IO.Path]::GetRandomFileName())" [System.IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray()) # Update hash using the temporary file @@ -3693,8 +3997,6 @@ set _unattended=0 set _args=%* if defined _args set _args=%_args:"=% -if defined _args set _args=%_args:re1=% -if defined _args set _args=%_args:re2=% if defined _args for %%A in (%_args%) do ( if /i "%%A"=="-el" (set _elev=1) if /i "%%A"=="/Z-Windows" (set _actwin=1) @@ -3739,9 +4041,9 @@ echo: echo ______________________________________________________________ echo: echo [1] Activate - Windows -echo [2] Activate - Windows [ESU] -echo [3] Activate - Office [All] -echo [4] Activate - Office [Project/Visio] +echo [2] Activate - ESU +echo [3] Activate - Office [All] +echo [4] Activate - Office [Project/Visio] echo [5] Activate - All echo _______________________________________________ echo: @@ -3872,13 +4174,6 @@ set "_serv=%_slser% Winmgmt" call :dk_errorcheck -if defined error ( -call :dk_color %Red% "Some errors were detected. Aborting the operation..." -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" -goto :dk_done -) - call :ts_getedition if not defined tsedition ( call :dk_color %Red% "Checking Windows Edition ID [Not found in installed licenses, aborting...]" @@ -4012,7 +4307,8 @@ goto :ts_esu echo Checking Activation ID [%tempid%] [%tsedition%] -call :ts_inskey "[%key%]" +set generickey=1 +call :dk_inskey "[%key%]" if not defined error set tsids=%tsids% %tempid% goto :ts_esu @@ -4134,7 +4430,8 @@ goto :ts_esu echo Resetting Rearm / GracePeriod [Successful] ) -call :ts_inskey "[%key%]" +set generickey=1 +call :dk_inskey "[%key%]" ::======================================================================================================================================== @@ -4207,7 +4504,7 @@ set esuexistbutnosup=1 if defined esuexistsup if defined _vis ( set key=9FPV7-MWGT8-7XPDF-JC23W-WT7TW REM This is a non-generic blocked MAK key for Server-ESU-PA -call :ts_inskey "[!key!]" +call :dk_inskey "[!key!]" goto :ts_off ) @@ -4256,7 +4553,7 @@ if not %_actoff%==1 goto :ts_act if %winbuild% LSS 9200 ( echo: call :dk_color %Gray% "Checking Supported Office [TSforge for Office is supported on Windows 8 and later versions]" -call :dk_color %Blue% "On Windows Vista / 7, use Online %KS% activation option for Office instead." +call :dk_color %Blue% "On Windows Vista / 7, use Ohook activation option for Office instead." goto :ts_act ) @@ -4297,6 +4594,7 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v P if not "%o14msi%%o14c2r%"=="" ( echo: call :dk_color %Red% "Checking Unsupported Office Install [ %o14msi%%o14c2r%]" +if defined o14msi call :dk_color %Blue% "Use Ohook activation option for Office 2010." ) if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && ( @@ -4617,7 +4915,7 @@ call :dk_color %Blue% "Business, BusinessN, Enterprise, EnterpriseN, and Server goto :ts_act ) -call :ts_inskey "[%key%]" +call :dk_inskey "[%key%]" if not defined error set tsids=%tsids% %tempid% goto :ts_act @@ -5146,27 +5444,6 @@ exit /b %psc% "Get-WmiObject -Query 'SELECT Name, Description FROM SoftwareLicensingProduct WHERE LicenseStatus=''1'' AND GracePeriodRemaining=''0'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn IS NULL' | Where-Object { $_.Description -notmatch 'KMS' } | Select-Object -Property Name" %nul2% | findstr /i "Windows" %nul1% && set _perm=1||set _perm= exit /b -:: Install Key - -:ts_inskey - -if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey="%key%" %nul% -if %_wmic% EQU 0 %psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% -set keyerror=%errorlevel% -cmd /c exit /b %keyerror% -if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" - -if %keyerror% EQU 0 ( -if %sps%==SoftwareLicensingService call :dk_refresh -echo Installing Product Key %~1 [Successful] -) else ( -set error=1 -call :dk_color %Red% "Installing Product Key %~1 [Failed] %keyerror%" -call :dk_color %Blue% "%_fixmsg%" -) - -exit /b - ::======================================================================================================================================== :tsforge: @@ -10651,7 +10928,7 @@ echo: echo [0] %_exitmsg% echo: ______________________________________________________ echo: -call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,0]" +call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,0]" choice /C:120 /N set _el=!errorlevel! if !_el!==3 exit /b @@ -10882,6 +11159,7 @@ call echo Checking Installed Product Key [Partial Key - %%_partial%%] [ ) if defined key ( +set generickey=1 call :dk_inskey "[%key%]" ) @@ -11700,6 +11978,7 @@ call echo Checking Installed Product Key [Partial Key - %%_partial%%] [ ) if defined key ( +set generickey=1 call :dk_inskey "[%key%]" ) @@ -11709,7 +11988,7 @@ call :dk_inskey "[%key%]" if not %_actoff%==1 goto :ks_activate -call :ks_setspp +call :oh_setspp :: Check ohook install @@ -11754,7 +12033,7 @@ set ohub=1 :: Check supported office versions -call :ks_getpath +call :oh_getpath set o16uwp= set o16uwp_path= @@ -11933,9 +12212,9 @@ call :ks_process :ks_startmsi -if defined o14msi call :ks_setspp 14 +if defined o14msi call :oh_setspp 14 if defined o14msi call :ks_processmsi 14 %o14msi_reg% -call :ks_setspp +call :oh_setspp if defined o15msi call :ks_processmsi 15 %o15msi_reg% if defined o16msi call :ks_processmsi 16 %o16msi_reg% @@ -12079,33 +12358,6 @@ exit /b ::======================================================================================================================================== -:ks_getpath - -set o16c2r= -set o15c2r= -set o16msi= -set o15msi= -set o14msi= - -set _68=HKLM\SOFTWARE\Microsoft\Office -set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office - -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set o16c2r=1&set o16c2r_reg=%_86%\ClickToRun) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set o16c2r=1&set o16c2r_reg=%_68%\ClickToRun) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_86%\15.0\ClickToRun) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set o15c2r=1&set o15c2r_reg=%_68%\15.0\ClickToRun) - -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_86%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0) - -exit /b - -::======================================================================================================================================== - :: After retail to volume conversion, new product ID needs .OSPPReady key in registry, otherwise product info may not fully reflect :ks_osppready @@ -12134,16 +12386,19 @@ exit /b ::======================================================================================================================================== -:ks_setspp +:oh_setspp +set isOspp= if %winbuild% GEQ 9200 ( set spp=SoftwareLicensingProduct set sps=SoftwareLicensingService ) else ( +set isOspp=1 set spp=OfficeSoftwareProtectionProduct set sps=OfficeSoftwareProtectionService ) if "%1"=="14" ( +set isOspp=1 set spp=OfficeSoftwareProtectionProduct set sps=OfficeSoftwareProtectionService ) @@ -12203,6 +12458,7 @@ call :ks_osppready if not "!key!"=="" ( echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic +set generickey=1 call :dk_inskey "[!key!] [!_prod!]" ) else ( if not defined _oMSI ( @@ -12211,7 +12467,7 @@ call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 ! call :dk_color %Blue% "Make sure you are using Latest MAS script." ) else ( call :dk_color %Red% "Checking Product In Script [!_prod! MSI Retail is not supported]" -call :dk_color %Blue% "Uninstall this and Install C2R or MSI VL version of Office." +call :dk_color %Blue% "Use Ohook option to activate it." ) set fixes=%fixes% %mas%genuine-installation-media call :dk_color %_Yellow% "%mas%genuine-installation-media" @@ -12245,10 +12501,6 @@ echo "%2" | find /i "Wow6432Node" %nul1% && set _oArch=x86 if not "%osarch%"=="x86" if not defined _oArch set _oArch=x64 if "%osarch%"=="x86" set _oArch=x86 -set "_common=%CommonProgramFiles%" -if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" -set "_common2=%CommonProgramFiles(x86)%" - call :msiofficedata %2 echo: @@ -13228,47 +13480,30 @@ exit /b :: 5th column = Other Edition IDs if they are part of the same primary product (For reference only) :: Separator = "_" -:: EditionID Notes: -:: For Office 2013 and later, all Edition IDs are clearly defined, and each ID corresponds to its specific licensing. - -:: In Office 2010, the situation is a bit more complicated. -:: Products typically fall into two separate categories: Volume License (VL) and Non-VL. This is because a single installation cannot include both Retail and VL licensing types. -:: Some Edition IDs share the same primary product ID. For example, installing ProPlusVL also installs ProPlusAcadVL licenses, as both use 0011 as the primary product ID. -:: Therefore, in the script, we grouped VL and Non-VL versions by primary product ID and selected the highest Edition ID when multiple Edition IDs existed for the same primary product ID. - -:: There are a few exceptions to this 2010 rule: Visio (Premium, Pro, Standard) and OEM-SingleImage. - -:: For Visio, the issue is that branding.xml lists incorrect primary product IDs. The correct primary product ID for all three Visio variants is 0057. Based on the criteria above, we chose Visio-Premium as the representative Edition ID among the three. -:: For OEM-SingleImage, it installs multiple Edition IDs and uses 003D as the primary product ID. Following our method, we selected the highest available Edition ID—ProfessionalR in this case. - :msiofficedata for %%# in ( 14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR 14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR 14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL -14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR +14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR_[HSExcelR] 14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL 14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR 14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL 14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR] 14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR 14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR] -14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_0029_HSExcelR -14_25fe4611-b44d-49cc-ae87-2143d299194e_00A3_HSOneNoteR -14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_0037_HSPowerPointR -14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_002B_HSWordR 14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR 14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL 14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR 14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL 14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception -14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR +14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR_[HSOneNoteR] 14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL 14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR 14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL 14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR] -14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR +14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR_[HSPowerPointR] 14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL 14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR] 14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR] @@ -13289,7 +13524,7 @@ for %%# in ( 14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR 14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception 14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception -14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR +14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR_[HSWordR] 14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL :: Office 2013 15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail @@ -13407,6 +13642,7 @@ if "%oVer%"=="%%A" ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) +if /i 003D==%%C set SingleImage=1 ) ) ) @@ -13878,12 +14114,14 @@ function BoolToWStr($bVal) { } function InitializePInvoke($LaDll, $bOffice) { - $Marshal = [System.Runtime.InteropServices.Marshal] - $Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly((Get-Random), 'Run').DefineDynamicModule((Get-Random), $False) - $SLApp = $NT7 -Or $bOffice -Or ($LaDll -EQ 'sppc.dll' -And [Diagnostics.FileVersionInfo]::GetVersionInfo("$SysPath\sppc.dll").FilePrivatePart -GE 16501) - + $LaName = [IO.Path]::GetFileNameWithoutExtension($LaDll) + $SLApp = $NT7 -Or $bOffice -Or ($LaName -EQ 'sppc' -And [Diagnostics.FileVersionInfo]::GetVersionInfo("$SysPath\sppc.dll").FilePrivatePart -GE 16501) $Win32 = $null - $Class = $Module.DefineType((Get-Random), 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0) + + $Marshal = [System.Runtime.InteropServices.Marshal] + $Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly(($LaName+"_Assembly"), 'Run').DefineDynamicModule(($LaName+"_Module"), $False) + $Class = $Module.DefineType(($LaName+"_Methods"), 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0) + $Class.DefinePInvokeMethod('SLClose', $LaDll, 22, 1, [Int32], @([IntPtr]), 1, 3).SetImplementationFlags(128) $Class.DefinePInvokeMethod('SLOpen', $LaDll, 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) $Class.DefinePInvokeMethod('SLGenerateOfflineInstallationId', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) @@ -13932,10 +14170,51 @@ function SlGetInfoIID($SkuId) { return $null } + else + { + return $Marshal::PtrToStringUni($bData) + } +} - $rData = $Marshal::PtrToStringUni($bData) - $Marshal::FreeHGlobal($bData) - return $rData +function SlReturnData($hrRet, $tData, $cData, $bData) { + if ($hrRet -NE 0 -Or $cData -EQ 0) + { + return $null + } + if ($tData -EQ 1) + { + return $Marshal::PtrToStringUni($bData) + } + elseif ($tData -EQ 4) + { + return $Marshal::ReadInt32($bData) + } + elseif ($tData -EQ 3 -And $cData -EQ 8) + { + return $Marshal::ReadInt64($bData) + } + else + { + return $null + } +} + +function SlGetInfoPKey($PkeyId, $Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $hrRet = $Win32::SLGetPKeyInformation( + $hSLC, + [ref][Guid]$PkeyId, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + return SlReturnData $hrRet $tData $cData $bData } function SlGetInfoSku($SkuId, $Value) @@ -13944,7 +14223,7 @@ function SlGetInfoSku($SkuId, $Value) $cData = 0 $bData = 0 - $ret = $Win32::SLGetProductSkuInformation( + $hrRet = $Win32::SLGetProductSkuInformation( $hSLC, [ref][Guid]$SkuId, $Value, @@ -13953,70 +14232,7 @@ function SlGetInfoSku($SkuId, $Value) [ref]$bData ) - if ($ret -Or !$cData) - { - return $null - } - - if ($tData -EQ 1) - { - $rData = $Marshal::PtrToStringUni($bData) - } - elseif ($tData -EQ 4) - { - $rData = $Marshal::ReadInt32($bData) - } - elseif ($tData -EQ 3 -And $cData -EQ 8) - { - $rData = $Marshal::ReadInt64($bData) - } - else - { - $rData = $null - } - - $Marshal::FreeHGlobal($bData) - return $rData -} - -function SlGetInfoService($Value) -{ - $tData = 0 - $cData = 0 - $bData = 0 - - $ret = $Win32::SLGetServiceInformation( - $hSLC, - $Value, - [ref]$tData, - [ref]$cData, - [ref]$bData - ) - - if ($ret -Or !$cData) - { - return $null - } - - if ($tData -EQ 1) - { - $rData = $Marshal::PtrToStringUni($bData) - } - elseif ($tData -EQ 4) - { - $rData = $Marshal::ReadInt32($bData) - } - elseif ($tData -EQ 3 -And $cData -EQ 8) - { - $rData = $Marshal::ReadInt64($bData) - } - else - { - $rData = $null - } - - $Marshal::FreeHGlobal($bData) - return $rData + return SlReturnData $hrRet $tData $cData $bData } function SlGetInfoApp($AppId, $Value) @@ -14025,7 +14241,7 @@ function SlGetInfoApp($AppId, $Value) $cData = 0 $bData = 0 - $ret = $Win32::SLGetApplicationInformation( + $hrRet = $Win32::SLGetApplicationInformation( $hSLC, [ref][Guid]$AppId, $Value, @@ -14034,80 +14250,49 @@ function SlGetInfoApp($AppId, $Value) [ref]$bData ) - if ($ret -Or !$cData) - { - return $null - } + return SlReturnData $hrRet $tData $cData $bData +} - if ($tData -EQ 1) - { - $rData = $Marshal::PtrToStringUni($bData) - } - elseif ($tData -EQ 4) - { - $rData = $Marshal::ReadInt32($bData) - } - elseif ($tData -EQ 3 -And $cData -EQ 8) - { - $rData = $Marshal::ReadInt64($bData) - } - else - { - $rData = $null - } +function SlGetInfoService($Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 - $Marshal::FreeHGlobal($bData) - return $rData + $hrRet = $Win32::SLGetServiceInformation( + $hSLC, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + return SlReturnData $hrRet $tData $cData $bData } function SlGetInfoSvcApp($strApp, $Value) { if ($SLApp) { - $rData = SlGetInfoApp $strApp $Value + return SlGetInfoApp $strApp $Value } else { - $rData = SlGetInfoService $Value + return SlGetInfoService $Value } - return $rData -} - -function SlGetInfoPKey($PkeyId, $Value) -{ - $cData = 0 - $bData = 0 - - $ret = $Win32::SLGetPKeyInformation( - $hSLC, - [ref][Guid]$PKeyId, - $Value, - [ref]$null, - [ref]$cData, - [ref]$bData - ) - - if ($ret -Or !$cData) - { - return $null - } - - $rData = $Marshal::PtrToStringUni($bData) - $Marshal::FreeHGlobal($bData) - return $rData } function SlGetInfoLicensing($AppId, $SkuId) { - $LicenseStatus = 0 - $GracePeriodRemaining = 0 + $dwStatus = 0 + $dwGrace = 0 $hrReason = 0 - $EvaluationEndDate = 0 + $qwValidity = 0 $cStatus = 0 $pStatus = 0 - $ret = $Win32::SLGetLicensingStatusInformation( + $hrRet = $Win32::SLGetLicensingStatusInformation( $hSLC, [ref][Guid]$AppId, [ref][Guid]$SkuId, @@ -14116,80 +14301,46 @@ function SlGetInfoLicensing($AppId, $SkuId) [ref]$pStatus ) - if ($ret -Or !$cStatus) + if ($hrRet -NE 0 -Or $cStatus -EQ 0) { return } [IntPtr]$ppStatus = [Int64]$pStatus + [Int64]40 * ($cStatus - 1) - $eStatus = $Marshal::ReadInt32($ppStatus, 16) - $GracePeriodRemaining = $Marshal::ReadInt32($ppStatus, 20) + $dwStatus = $Marshal::ReadInt32($ppStatus, 16) + $dwGrace = $Marshal::ReadInt32($ppStatus, 20) $hrReason = $Marshal::ReadInt32($ppStatus, 28) - $EvaluationEndDate = $Marshal::ReadInt64($ppStatus, 32) + $qwValidity = $Marshal::ReadInt64($ppStatus, 32) - if ($eStatus -EQ 3) + if ($dwStatus -EQ 3) { - $eStatus = 5 + $dwStatus = 5 } - if ($eStatus -EQ 2) + if ($dwStatus -EQ 2) { if ($hrReason -EQ 0x4004F00D) { - $eStatus = 3 + $dwStatus = 3 } elseif ($hrReason -EQ 0x4004F065) { - $eStatus = 4 + $dwStatus = 4 } elseif ($hrReason -EQ 0x4004FC06) { - $eStatus = 6 + $dwStatus = 6 } } - $LicenseStatus = $eStatus - $Marshal::FreeHGlobal($pStatus) return } -function SlCheckInfo($SkuId, $Value) -{ - $cData = 0 - $bData = 0 - - $ret = $Win32::SLGetProductSkuInformation( - $hSLC, - [ref][Guid]$SkuId, - $Value, - [ref]$null, - [ref]$cData, - [ref]$bData - ) - - if ($ret -Or !$cData) - { - return $false - } - - if ($Value -EQ "pkeyId") - { - $rData = $Marshal::PtrToStringUni($bData) - } - else - { - $rData = $true - } - - $Marshal::FreeHGlobal($bData) - return $rData -} - function SlGetInfoSLID($AppId) { $cReturnIds = 0 $pReturnIds = 0 - $ret = $Win32::SLGetSLIDList( + $hrRet = $Win32::SLGetSLIDList( $hSLC, 0, [ref][Guid]$AppId, @@ -14198,7 +14349,7 @@ function SlGetInfoSLID($AppId) [ref]$pReturnIds ) - if ($ret -Or !$cReturnIds) + if ($hrRet -NE 0 -Or $cReturnIds -EQ 0) { return } @@ -14213,17 +14364,16 @@ function SlGetInfoSLID($AppId) $bytes = New-Object byte[] 16 $Marshal::Copy([Int64]$pReturnIds + [Int64]16 * $i, $bytes, 0, 16) $actid = ([Guid]$bytes).Guid - $gPPK = SlCheckInfo $actid "pkeyId" - $gAdd = SlCheckInfo $actid "DependsOn" + $gPPK = SlGetInfoSku $actid "pkeyId" + $gAdd = SlGetInfoSku $actid "DependsOn" if ($All.IsPresent) { - if (!$gPPK -And $gAdd) { $a1List += @{id = $actid; pk = $null; ex = $true} } - if (!$gPPK -And !$gAdd) { $a2List += @{id = $actid; pk = $null; ex = $false} } + if ($null -EQ $gPPK -And $null -NE $gAdd) { $a1List += @{id = $actid; pk = $null; ex = $true} } + if ($null -EQ $gPPK -And $null -EQ $gAdd) { $a2List += @{id = $actid; pk = $null; ex = $false} } } - if ($gPPK -And $gAdd) { $a3List += @{id = $actid; pk = $gPPK; ex = $true} } - if ($gPPK -And !$gAdd) { $a4List += @{id = $actid; pk = $gPPK; ex = $false} } + if ($null -NE $gPPK -And $null -NE $gAdd) { $a3List += @{id = $actid; pk = $gPPK; ex = $true} } + if ($null -NE $gPPK -And $null -EQ $gAdd) { $a4List += @{id = $actid; pk = $gPPK; ex = $false} } } - $Marshal::FreeHGlobal($pReturnIds) return ($a1List + $a2List + $a3List + $a4List) } @@ -14280,7 +14430,7 @@ function DetectSubscription { function DetectAdbaClient { - $propADBA | foreach { set $_ (SlGetInfoSku $ID $_) } + $propADBA | foreach { set $_ (SlGetInfoSku $licID $_) } CONOUT "`nAD Activation client information:" CONOUT " Object Name: $ADActivationObjectName" CONOUT " Domain Name: $ADActivationObjectDN" @@ -14290,7 +14440,7 @@ function DetectAdbaClient function DetectAvmClient { - $propAVMA | foreach { set $_ (SlGetInfoSku $ID $_) } + $propAVMA | foreach { set $_ (SlGetInfoSku $licID $_) } CONOUT "`nAutomatic VM Activation client information:" if (-Not [String]::IsNullOrEmpty($InheritedActivationId)) { CONOUT " Guest IAID: $InheritedActivationId" @@ -14321,7 +14471,6 @@ function DetectKmsHost if (-Not $IsKeyManagementService) { return } - if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} if ($Vista -Or $NT5) { $regk = $SLKeyPath @@ -14374,9 +14523,9 @@ function DetectKmsHost function DetectKmsClient { - if ($strSLP -EQ $wslp -And $NT8) + if ($win8) { - $VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $ID) "VLActivationType" + $VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $licID) "VLActivationType" if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath + '\' + $strApp) "VLActivationType"} if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath) "VLActivationType"} if ($null -EQ $VLType -Or $VLType -GT 3) {$VLType = 0} @@ -14390,7 +14539,7 @@ function DetectKmsClient } if ($NT7 -Or $strSLP -EQ $oslp) { - $propKMSClient | foreach { set $_ (SlGetInfoSku $ID $_) } + $propKMSClient | foreach { set $_ (SlGetInfoSku $licID $_) } if ($strSLP -EQ $oslp) {$regk = $OPKeyPath} else {$regk = $SPKeyPath} $KMSCaching = strGetRegistry $regk "DisableKeyManagementServiceHostCaching" if (-Not $KMSCaching) {$KMSCaching = "TRUE"} else {$KMSCaching = BoolToWStr (!$KMSCaching)} @@ -14448,58 +14597,90 @@ function DetectKmsClient function GetResult($strSLP, $strApp, $entry) { - $ID = $entry.id - $propPrd | foreach { set $_ (SlGetInfoSku $ID $_) } - . SlGetInfoLicensing $strApp $ID + $licID = $entry.id + $propPrd | foreach { set $_ (SlGetInfoSku $licID $_) } + . SlGetInfoLicensing $strApp $licID + $LicenseStatus = $dwStatus + $LicReason = $hrReason + $EvaluationEndDate = $qwValidity + $gprMnt = $dwGrace + + $pkid = $entry.pk + $isPPK = $null -NE $pkid + + $add_on = $Name.IndexOf("add-on for", 5) + if ($add_on -NE -1) { + $Name = $Name.Substring(0, $add_on + 7) + } + + $licPHN = "empty" + if ($Dlv -Or $All.IsPresent) { + $licPHN = SlGetInfoSku $licID "msft:sl/EUL/PHONE/PUBLIC" + } + + if ($LicenseStatus -EQ 0 -And !$isPPK) { + & $isAll + CONOUT "Name: $Name" + CONOUT "Description: $Description" + CONOUT "Activation ID: $licID" + CONOUT "License Status: Unlicensed" + if ($licPHN -NE "empty") { + $gPHN = [String]::IsNullOrEmpty($licPHN) -NE $true + CONOUT "Phone activatable: $($gPHN.ToString())" + } + return + } $winID = ($strApp -EQ $winApp) $winPR = ($winID -And -Not $entry.ex) $Vista = ($winID -And $NT6 -And -Not $NT7) $NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001) + $win8 = ($strSLP -EQ $wslp -And $NT8) $reapp = ("Windows", "App")[!$winID] $prmnt = ("machine", "product")[!$winPR] - if ($Description | Select-String "VOLUME_KMSCLIENT") {$cKmsClient = 1; $_mTag = "Volume"} - if ($Description | Select-String "TIMEBASED_") {$cTblClient = 1; $_mTag = "Timebased"} - if ($Description | Select-String "VIRTUAL_MACHINE_ACTIVATION") {$cAvmClient = 1; $_mTag = "Automatic VM"} - if ($null -EQ $cKmsClient) { - if ($Description | Select-String "VOLUME_KMS") {$cKmsServer = 1} + if ($Description.Contains("VOLUME_KMSCLIENT")) {$cKmsClient = 1; $actTag = "Volume"} + if ($Description.Contains("TIMEBASED_")) {$cTblClient = 1; $actTag = "Timebased"} + if ($Description.Contains("VIRTUAL_MACHINE_ACTIVATION")) {$cAvmClient = 1; $actTag = "Automatic VM"} + if ($null -EQ $cKmsClient -And $Description.Contains("VOLUME_KMS")) {$cKmsServer = 1} + + $gprDay = [Math]::Round($gprMnt/1440) + $_xpr = "" + $inGrace = $false + if ($gprMnt -GT 0) { + $_xpr = [DateTime]::Now.AddMinutes($gprMnt).ToString('yyyy-MM-dd hh:mm:ss tt') + $inGrace = $true } - $_gpr = [Math]::Round($GracePeriodRemaining/1440) - if ($_gpr -GT 0) { - $_xpr = [DateTime]::Now.AddMinutes($GracePeriodRemaining).ToString('yyyy-MM-dd hh:mm:ss tt') - } - - $LicenseReason = '0x{0:X}' -f $hrReason - $LicenseMsg = "Time remaining: $GracePeriodRemaining minute(s) ($_gpr day(s))" + $LicenseMsg = "Time remaining: $gprMnt minute(s) ($gprDay day(s))" if ($LicenseStatus -EQ 0) { $LicenseInf = "Unlicensed" $LicenseMsg = $null } if ($LicenseStatus -EQ 1) { $LicenseInf = "Licensed" - if ($GracePeriodRemaining -EQ 0) { + if ($gprMnt -EQ 0) { $LicenseMsg = $null $ExpireMsg = "The $prmnt is permanently activated." } else { - $LicenseMsg = "$_mTag activation expiration: $GracePeriodRemaining minute(s) ($_gpr day(s))" - if ($null -NE $_xpr) {$ExpireMsg = "$_mTag activation will expire $_xpr"} + $LicenseMsg = "$actTag activation expiration: $gprMnt minute(s) ($gprDay day(s))" + if ($inGrace) {$ExpireMsg = "$actTag activation will expire $_xpr"} } } if ($LicenseStatus -EQ 2) { $LicenseInf = "Initial grace period" - if ($null -NE $_xpr) {$ExpireMsg = "Initial grace period ends $_xpr"} + if ($inGrace) {$ExpireMsg = "$LicenseInf ends $_xpr"} } if ($LicenseStatus -EQ 3) { $LicenseInf = "Additional grace period (KMS license expired or hardware out of tolerance)" - if ($null -NE $_xpr) {$ExpireMsg = "Additional grace period ends $_xpr"} + if ($inGrace) {$ExpireMsg = "Additional grace period ends $_xpr"} } if ($LicenseStatus -EQ 4) { $LicenseInf = "Non-genuine grace period" - if ($null -NE $_xpr) {$ExpireMsg = "Non-genuine grace period ends $_xpr"} + if ($inGrace) {$ExpireMsg = "$LicenseInf ends $_xpr"} } if ($LicenseStatus -EQ 5 -And -Not $NT5) { + $LicenseReason = '0x{0:X}' -f $LicReason $LicenseInf = "Notification" $LicenseMsg = "Notification Reason: $LicenseReason" if ($LicenseReason -EQ "0xC004F00F") {if ($null -NE $cKmsClient) {$LicenseMsg = $LicenseMsg + " (KMS license expired)."} else {$LicenseMsg = $LicenseMsg + " (hardware out of tolerance)."}} @@ -14512,36 +14693,35 @@ function GetResult($strSLP, $strApp, $entry) } if ($LicenseStatus -EQ 6 -And -Not $Vista -And -Not $NT5) { $LicenseInf = "Extended grace period" - if ($null -NE $_xpr) {$ExpireMsg = "Extended grace period ends $_xpr"} + if ($inGrace) {$ExpireMsg = "$LicenseInf ends $_xpr"} } - $pkid = $entry.pk - if ($null -NE $pkid) { + if ($isPPK) { $propPkey | foreach { set $_ (SlGetInfoPKey $pkid $_) } } - if ($winPR -And $null -NE $PartialProductKey -And -Not $NT8) { - $uxd = SlGetInfoSku $ID 'UXDifferentiator' + if ($winPR -And $isPPK -And -Not $NT8) { + $uxd = SlGetInfoSku $licID 'UXDifferentiator' $script:primary += @{ - aid = $ID; + aid = $licID; ppk = $PartialProductKey; chn = $Channel; lst = $LicenseStatus; - lcr = $hrReason; - ged = $GracePeriodRemaining; + lcr = $LicReason; + ged = $gprMnt; evl = $EvaluationEndDate; dff = $uxd } } - if ($IID -And $null -NE $PartialProductKey) { - $OfflineInstallationId = SlGetInfoIID $ID + if ($IID -And $isPPK) { + $OfflineInstallationId = SlGetInfoIID $licID } if ($Dlv) { - if ($strSLP -EQ $wslp -And $NT8) + if ($win8) { - $RemainingSkuReArmCount = SlGetInfoSku $ID 'RemainingRearmCount' + $RemainingSkuReArmCount = SlGetInfoSku $licID 'RemainingRearmCount' $RemainingAppReArmCount = SlGetInfoApp $strApp 'RemainingRearmCount' } else @@ -14561,16 +14741,10 @@ function GetResult($strSLP, $strApp, $entry) } } - if ($Dlv -Or $All.IsPresent) { - $gPHN = SlCheckInfo $ID "msft:sl/EUL/PHONE/PUBLIC" - } - - $add_on = $Name.IndexOf("add-on for", 5) - & $isAll - if ($add_on -EQ -1) {CONOUT "Name: $Name"} else {CONOUT "Name: $($Name.Substring(0, $add_on + 7))"} + CONOUT "Name: $Name" CONOUT "Description: $Description" - CONOUT "Activation ID: $ID" + CONOUT "Activation ID: $licID" if ($null -NE $DigitalPID) {CONOUT "Extended PID: $DigitalPID"} if ($null -NE $DigitalPID2 -And $Dlv) {CONOUT "Product ID: $DigitalPID2"} if ($null -NE $OfflineInstallationId -And $IID) {CONOUT "Installation ID: $OfflineInstallationId"} @@ -14582,9 +14756,9 @@ function GetResult($strSLP, $strApp, $entry) $EED = [DateTime]::FromFileTimeUtc($EvaluationEndDate).ToString('yyyy-MM-dd hh:mm:ss tt') CONOUT "Evaluation End Date: $EED UTC" } - if ($LicenseStatus -NE 1 -And $null -NE $gPHN) { - $gPHN = $gPHN.ToString() - CONOUT "Phone activatable: $gPHN" + if ($LicenseStatus -NE 1 -And $licPHN -NE "empty") { + $gPHN = [String]::IsNullOrEmpty($licPHN) -NE $true + CONOUT "Phone activatable: $($gPHN.ToString())" } if ($Dlv) { if ($null -NE $RemainingSLReArmCount) { @@ -14599,11 +14773,11 @@ function GetResult($strSLP, $strApp, $entry) CONOUT "Trusted time: $TTD" } } - if ($null -EQ $PartialProductKey) { + if (!$isPPK) { return } - if ($strSLP -EQ $wslp -And $NT8 -And $VLActivationType -EQ 1) { + if ($win8 -And $VLActivationType -EQ 1) { DetectAdbaClient } @@ -14611,7 +14785,7 @@ function GetResult($strSLP, $strApp, $entry) DetectAvmClient } - $chkSub = ($winPR -And $cSub) + $chkSub = ($winPR -And $isSub) $chkSLS = ($null -NE $cKmsClient -Or $null -NE $cKmsServer -Or $chkSub) @@ -14620,15 +14794,14 @@ function GetResult($strSLP, $strApp, $entry) return } - if ($null -NE $cKmsServer) { - DetectKmsHost - } - if ($null -NE $cKmsClient) { DetectKmsClient } - if ($null -EQ $cKmsServer) { + if ($null -NE $cKmsServer) { + if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} + DetectKmsHost + } else { if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} } @@ -15045,14 +15218,14 @@ function clcGetExpireKrn $cData = 0 $bData = 0 - $ret = $Win32::SLGetWindowsInformation( + $hrRet = $Win32::SLGetWindowsInformation( "Kernel-ExpirationDate", [ref]$tData, [ref]$cData, [ref]$bData ) - if ($ret -Or !$cData -Or $tData -NE 3) + if ($hrRet -Or !$cData -Or $tData -NE 3) { return $null } @@ -15067,7 +15240,7 @@ function clcGetExpireKrn $rData = '{0}/{1}/{2}:{3}:{4}:{5}' -f $year, $Marshal::ReadInt16($bData, 2), $Marshal::ReadInt16($bData, 4), $Marshal::ReadInt16($bData, 6), $Marshal::ReadInt16($bData, 8), $Marshal::ReadInt16($bData, 10) } - $Marshal::FreeHGlobal($bData) + #$Marshal::FreeHGlobal($bData) return $rData } @@ -15103,12 +15276,12 @@ function clcGetGenuineState($AppId) $dwGenuine = 0 if ($NT7) { - $ret = $Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine) + $hrRet = $Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine) } else { - $ret = $Win32::SLIsGenuineLocal([ref][Guid]$AppId, [ref]$dwGenuine, 0) + $hrRet = $Win32::SLIsGenuineLocal([ref][Guid]$AppId, [ref]$dwGenuine, 0) } - if ($ret) + if ($hrRet) { $dwGenuine = 4 } @@ -15176,7 +15349,7 @@ $osls = "OfficeSoftwareProtectionService" $winApp = "55c92734-d682-4d71-983e-d6ec3f16059f" $o14App = "59a52881-a989-479d-af46-f275c6370663" $o15App = "0ff1ce15-a989-479d-af46-f275c6370663" -$cSub = ($winbuild -GE 26000) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType") +$isSub = ($winbuild -GE 26000) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType") $DllDigital = ($winbuild -GE 14393) -And (Test-Path "$SysPath\EditionUpgradeManagerObj.dll") $DllSubscription = ($winbuild -GE 14393) -And (Test-Path "$SysPath\Clipc.dll") $VLActTypes = @("All", "AD", "KMS", "Token") diff --git a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd index 6409cec..340c2a8 100644 --- a/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/HWID_Activation.cmd @@ -1,4 +1,4 @@ -@set masver=3.0 +@set masver=3.1 @echo off @@ -541,6 +541,7 @@ call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] detected. Script w echo: ) +set generickey=1 call :dk_inskey "[%key%]" ::======================================================================================================================================== @@ -960,11 +961,12 @@ set keyerror=%errorlevel% cmd /c exit /b %keyerror% if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" +if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ") if %keyerror% EQU 0 ( if %sps%==SoftwareLicensingService call :dk_refresh -echo Installing Generic Product Key %~1 [Successful] +echo %keyecho% %~1 [Successful] ) else ( -call :dk_color %Red% "Installing Generic Product Key %~1 [Failed] %keyerror%" +call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%" if not defined error ( if defined altapplist call :dk_color %Red% "Activation ID not found for this key." call :dk_color %Blue% "%_fixmsg%" @@ -973,6 +975,7 @@ set showfix=1 set error=1 ) +set generickey= exit /b :: Activation command @@ -1100,7 +1103,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -1110,10 +1113,6 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) -if %winbuild% LSS 7600 ( -set "winos=!winos:VistaT=Vista!" -set "winos=!winos:Serverr=Server!" -) if not defined winsub exit /b diff --git a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd index bb2c624..3f99aee 100644 --- a/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/KMS38_Activation.cmd @@ -1,4 +1,4 @@ -@set masver=3.0 +@set masver=3.1 @echo off @@ -620,6 +620,7 @@ call echo Checking Installed Product Key [Partial Key - %%_partial%%] [ ) if defined key ( +set generickey=1 call :dk_inskey "[%key%]" ) @@ -1079,11 +1080,12 @@ set keyerror=%errorlevel% cmd /c exit /b %keyerror% if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" +if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ") if %keyerror% EQU 0 ( if %sps%==SoftwareLicensingService call :dk_refresh -echo Installing Generic Product Key %~1 [Successful] +echo %keyecho% %~1 [Successful] ) else ( -call :dk_color %Red% "Installing Generic Product Key %~1 [Failed] %keyerror%" +call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%" if not defined error ( if defined altapplist call :dk_color %Red% "Activation ID not found for this key." call :dk_color %Blue% "%_fixmsg%" @@ -1092,6 +1094,7 @@ set showfix=1 set error=1 ) +set generickey= exit /b :: Get Windows installed key channel @@ -1198,7 +1201,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -1208,10 +1211,6 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) -if %winbuild% LSS 7600 ( -set "winos=!winos:VistaT=Vista!" -set "winos=!winos:Serverr=Server!" -) if not defined winsub exit /b diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index 5be9615..ca9a308 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -1,4 +1,4 @@ -@set masver=3.0 +@set masver=3.1 @echo off @@ -171,12 +171,27 @@ call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%trouble goto dk_done ) -if %winbuild% LSS 9200 ( -%eline% +if %winbuild% LSS 6001 ( +%nceline% echo Unsupported OS version detected [%winbuild%]. -echo Ohook Activation is supported only on Windows 8/10/11 and their server equivalents. +echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents. +if %winbuild% EQU 6000 ( echo: -call :dk_color %Blue% "Use Online KMS activation option instead." +echo Windows Vista RTM is not supported because Powershell cannot be installed. +echo Upgrade to Windows Vista SP1 or SP2. +) +goto dk_done +) + +if not exist %ps% ( +%nceline% +echo PowerShell is not installed in your system. +if %winbuild% LSS 7600 ( +echo Install PowerShell using the following URL. +echo: +echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930 +) goto dk_done ) @@ -398,8 +413,8 @@ goto :oh_menu cls if not defined terminal ( -mode 130, 32 -if exist "%SysPath%\spp\store_test\" mode 134, 32 +mode 140, 32 +if exist "%SysPath%\spp\store_test\" mode 140, 32 %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=32;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% ) title Ohook Activation %masver% @@ -408,9 +423,9 @@ echo: echo Initializing... call :dk_chkmal -if not exist %SysPath%\sppsvc.exe ( +if not exist %SysPath%\%_slexe% ( %eline% -echo [%SysPath%\sppsvc.exe] file is missing, aborting... +echo [%SysPath%\%_slexe%] file is missing, aborting... echo: 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." @@ -442,7 +457,7 @@ call :dk_showosinfo echo Initiating Diagnostic Tests... -set "_serv=sppsvc Winmgmt" +set "_serv=%_slser% Winmgmt" :: Software Protection :: Windows Management Instrumentation @@ -451,16 +466,15 @@ set notwinact=1 set ohookact=1 call :dk_errorcheck +call :oh_setspp + :: Check unsupported office versions -set o14msi= set o14c2r= set o16uwp= set _68=HKLM\SOFTWARE\Microsoft\Office set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office -for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI ) -for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=Office 2010 MSI ) %nul% reg query %_68%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R %nul% reg query %_86%\14.0\CVH /f Click2run /k && set o14c2r=Office 2010 C2R @@ -468,10 +482,10 @@ if %winbuild% GEQ 10240 ( for /f "delims=" %%a in ('%psc% "(Get-AppxPackage -name 'Microsoft.Office.Desktop' | Select-Object -ExpandProperty InstallLocation)" %nul6%') do (if exist "%%a\Integration\Integrator.exe" set o16uwp=Office UWP ) ) -if not "%o14msi%%o14c2r%%o16uwp%"=="" ( +if not "%o14c2r%%o16uwp%"=="" ( echo: -call :dk_color %Red% "Checking Unsupported Office Install [ %o14msi%%o14c2r%%o16uwp%]" -if not "%o14msi%%o16uwp%"=="" call :dk_color %Blue% "Use Online KMS option to activate it." +call :dk_color %Red% "Checking Unsupported Office Install [ %o14c2r%%o16uwp%]" +if not "%o16uwp%"=="" call :dk_color %Blue% "Use TSforge option to activate it." ) if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && ( @@ -502,10 +516,10 @@ set o15c2r= set error=1 ) -if "%o16c2r%%o15c2r%%o16msi%%o15msi%"=="" ( +if "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="" ( set error=1 echo: -if not "%o14msi%%o14c2r%%o16uwp%"=="" ( +if not "%o14c2r%%o16uwp%"=="" ( call :dk_color %Red% "Checking Supported Office Install [Not Found]" ) else ( call :dk_color %Red% "Checking Installed Office [Not Found]" @@ -524,8 +538,8 @@ goto dk_done ) set multioffice= -if not "%o16c2r%%o15c2r%%o16msi%%o15msi%"=="1" set multioffice=1 -if not "%o14msi%%o14c2r%%o16uwp%"=="" set multioffice=1 +if not "%o16c2r%%o15c2r%%o16msi%%o15msi%%o14msi%"=="1" set multioffice=1 +if not "%o14c2r%%o16uwp%"=="" set multioffice=1 if defined multioffice ( call :dk_color %Gray% "Checking Multiple Office Install [Found, its recommended to install only one version]" @@ -569,12 +583,8 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe" if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll") if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll") -if not "%osarch%"=="x86" ( -if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll" -if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll" -) else ( -set "_sppcPath=%SystemRoot%\System32\sppc.dll" -) + +call :oh_ppcpath echo: echo Activating Office... [C2R ^| %_version% ^| %_oArch%] @@ -585,9 +595,20 @@ set error=1 goto :starto16c2r ) +if defined noOsppc ( +call :dk_color %Red% "Checking OSPPC.DLL [Not found. Aborting activation...]" +call :dk_color %Blue% "%_fixmsg%" +set error=1 +goto :starto16c2r +) + call :oh_fixprids call :oh_process +if defined isOspp ( +call :oh_hookinstall_ospp +) else ( call :oh_hookinstall +) ::======================================================================================================================================== @@ -619,12 +640,8 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe" if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll") if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll") -if not "%osarch%"=="x86" ( -if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll" -if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll" -) else ( -set "_sppcPath=%SystemRoot%\System32\sppc.dll" -) + +call :oh_ppcpath echo: echo Activating Office... [C2R ^| %_version% %_AudienceData%^| %_oArch%] @@ -635,9 +652,20 @@ set error=1 goto :startmsi ) +if defined noOsppc ( +call :dk_color %Red% "Checking OSPPC.DLL [Not found. Aborting activation...]" +call :dk_color %Blue% "%_fixmsg%" +set error=1 +goto :startmsi +) + call :oh_fixprids call :oh_process +if defined isOspp ( +call :oh_hookinstall_ospp +) else ( call :oh_hookinstall +) ::======================================================================================================================================== @@ -674,6 +702,9 @@ echo Adding a Registry to Prevent Banner [Successful] :startmsi +if defined o14msi call :oh_setspp 14 +if defined o14msi call :oh_processmsi 14 %o14msi_reg% +call :oh_setspp if defined o15msi call :oh_processmsi 15 %o15msi_reg% if defined o16msi call :oh_processmsi 16 %o16msi_reg% @@ -705,7 +736,7 @@ goto :dk_done :oh_uninstall cls -if not defined terminal mode 99, 32 +if not defined terminal mode 145, 32 title Uninstall Ohook Activation %masver% set _present= @@ -721,6 +752,7 @@ if defined o16c2r_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o16c2r_reg if defined o15c2r_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o15c2r_reg% /v InstallPath" %nul6%') do (set "_15CHook=%%b\root\vfs")) if defined o16msi_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o16msi_reg%\Common\InstallRoot /v Path" %nul6%') do (set "_16MHook=%%b")) if defined o15msi_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o15msi_reg%\Common\InstallRoot /v Path" %nul6%') do (set "_15MHook=%%b")) +if defined o14msi_reg (for /f "skip=2 tokens=2*" %%a in ('"reg query %o14msi_reg%\Common\InstallRoot /v Path" %nul6%') do (set "_14MHook=%%b")) if defined _16CHook (if exist "%_16CHook%\System\sppc*dll" (set _present=1& del /s /f /q "%_16CHook%\System\sppc*dll" & if exist "%_16CHook%\System\sppc*dll" set _unerror=1)) if defined _16CHook (if exist "%_16CHook%\SystemX86\sppc*dll" (set _present=1& del /s /f /q "%_16CHook%\SystemX86\sppc*dll" & if exist "%_16CHook%\SystemX86\sppc*dll" set _unerror=1)) @@ -728,8 +760,9 @@ if defined _15CHook (if exist "%_15CHook%\System\sppc*dll" (set _present=1& d if defined _15CHook (if exist "%_15CHook%\SystemX86\sppc*dll" (set _present=1& del /s /f /q "%_15CHook%\SystemX86\sppc*dll" & if exist "%_15CHook%\SystemX86\sppc*dll" set _unerror=1)) if defined _16MHook (if exist "%_16MHook%sppc*dll" (set _present=1& del /s /f /q "%_16MHook%sppc*dll" & if exist "%_16MHook%sppc*dll" set _unerror=1)) if defined _15MHook (if exist "%_15MHook%sppc*dll" (set _present=1& del /s /f /q "%_15MHook%sppc*dll" & if exist "%_15MHook%sppc*dll" set _unerror=1)) +if defined _14MHook (if exist "%_14MHook%sppc*dll" (set _present=1& del /s /f /q "%_14MHook%sppc*dll" & if exist "%_14MHook%sppc*dll" set _unerror=1)) -for %%# in (15 16) do ( +for %%# in (14 15 16) do ( for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do ( if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" (set _present=1& del /s /f /q "%%~A\Microsoft Office\Office%%#\sppc*dll" & if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" set _unerror=1) ) @@ -743,6 +776,31 @@ if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" (set _present=1& del /s /f ) ) +::================================== + +for %%# in (OSPPC.DLL sppcs.dll) do ( +for %%A in ("%CommonProgramFiles%" "%CommonProgramW6432%" "%CommonProgramFiles(x86)%") do ( +for %%G in ("%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\%%#") do ( +set size=0 +set size=%%~zG +if !size! GEQ 1 if !size! LSS 100000 ( +set _present=1 +del /f /q "%%~G" +if exist "%%~G" (move /y "%%~G" "!_ttemp!\needsToBeDeleted%random%" %nul%) +if exist "%%~G" (set _unerror=1) else (echo Deleted file - %%~G) +) +if /i sppcs.dll==%%# if !size! GEQ 100000 ( +move /y "%%~G" "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL" %nul% +if exist "%%~G" (move /y "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL" "!_ttemp!\needsToBeDeleted%random%" %nul%) +move /y "%%~G" "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL" %nul% +if exist "%%~G" (set _unerror=1&echo Failed to rename sppcs.dll back to "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL") else (echo Renamed sppcs.dll back to "%%~A\Microsoft Shared\OfficeSoftwareProtectionPlatform\OSPPC.DLL") +) +) +) +) + +::================================== + reg query HKCU\Software\Microsoft\Office\16.0\Common\Licensing\Resiliency %nul% && ( echo: echo Deleting - Registry keys for skipping license check @@ -772,6 +830,8 @@ reg unload HKU\%%# %nul% ) ) +::================================== + set "kmskey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663" reg query "%kmskey%" %nul% && ( echo: @@ -818,6 +878,7 @@ set _oLPath= set _hookPath= set _hook= set _sppcPath= +set _osppPath= set _actid= set _prod= set _lic= @@ -836,6 +897,7 @@ set o16c2r= set o15c2r= set o16msi= set o15msi= +set o14msi= set _68=HKLM\SOFTWARE\Microsoft\Office set _86=HKLM\SOFTWARE\Wow6432Node\Microsoft\Office @@ -849,6 +911,52 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\16.0\Common\InstallRoot /v P for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o16msi=1&set o16msi_reg=%_68%\16.0) for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_86%\15.0) for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o15msi=1&set o15msi_reg=%_68%\15.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_86%\14.0) +for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v Path" %nul6%') do if exist "%%b\EntityPicker.dll" (set o14msi=1&set o14msi_reg=%_68%\14.0) + +exit /b + +::======================================================================================================================================== + +:oh_ppcpath + +if not defined isOspp ( +if not "%osarch%"=="x86" ( +if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll" +if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll" +) else ( +set "_sppcPath=%SystemRoot%\System32\sppc.dll" +) +) + +set noOsppc= +set _hook68= +set _hook86= +set _osppPath68= +set _osppPath86= + +if defined isOspp ( +if not "%osarch%"=="x86" ( +if /i "%_oArch%"=="x64" ( +for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath68=%%b") +if not exist "!_osppPath68!OSPPC.DLL" set noOsppc=1 +) +if /i "%_oArch%"=="x86" ( +for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath68=%%b") +for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath86=%%b") +if not exist "!_osppPath68!OSPPC.DLL" set noOsppc=1 +if not exist "!_osppPath86!OSPPC.DLL" set noOsppc=1 +) +) else ( +for /f "skip=2 tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /v Path" %nul6%') do (set "_osppPath86=%%b") +if not exist "!_osppPath86!OSPPC.DLL" set noOsppc=1 +) +if "!_osppPath68:~-1!"=="\" set "_osppPath68=!_osppPath68:~0,-1!" +if "!_osppPath86:~-1!"=="\" set "_osppPath86=!_osppPath86:~0,-1!" +) + +if defined _osppPath68 set _hook68=sppc64.dll +if defined _osppPath86 set _hook86=sppc32.dll exit /b @@ -944,15 +1052,24 @@ set hasherror= if %_hook%==sppc32.dll set offset=2564 if %_hook%==sppc64.dll set offset=3076 -del /s /q "%_hookPath%\sppcs.dll" %nul% -del /s /q "%_hookPath%\sppc.dll" %nul% +::====================================== -if exist "%_hookPath%\sppcs.dll" set "ierror=Remove Previous Ohook Install" -if exist "%_hookPath%\sppc.dll" set "ierror=Remove Previous Ohook Install" +:: Remove previous Install + +for %%# in (sppcs.dll sppc.dll) do ( +del /f /q "%_hookPath%\%%#" %nul% +if exist "%_hookPath%\%%#" (move /y "%_hookPath%\%%#" "!_ttemp!\needsToBeDeleted%random%" %nul%) +if exist "%_hookPath%\%%#" (set "ierror=Remove Previous Ohook Install [%%#]") +) + +if defined ierror goto :oh_hookinstall_error + +::====================================== mklink "%_hookPath%\sppcs.dll" "%_sppcPath%" %nul% -if not %errorlevel%==0 ( -if not defined ierror set ierror=mklink +if not exist "%_hookPath%\sppcs.dll" ( +set ierror=mklink sppcs.dll +goto :oh_hookinstall_error ) set exhook= @@ -967,17 +1084,122 @@ popd call :oh_extractdll "%_hookPath%\sppc.dll" "%offset%" ) ) -if not exist "%_hookPath%\sppc.dll" (if not defined ierror set ierror=Copy) +if not exist "%_hookPath%\sppc.dll" ( +set ierror=Copy +goto :oh_hookinstall_error +) echo: -if not defined ierror ( -echo Symlinking System's sppc.dll to ["%_hookPath%\sppcs.dll"] [Successful] +echo Symlinking System's sppc.dll ["%_hookPath%\sppcs.dll"] [Successful] if defined exhook ( echo Copying Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful] ) else ( echo Extracting Custom %_hook% to ["%_hookPath%\sppc.dll"] [Successful] ) + +goto :oh_hookinstall_error + +::======================================================================================================================================== + +:oh_hookinstall_ospp + +set ierror= +set hasherror= + +if defined _hook86 set offset86=2564 +if defined _hook68 set offset68=3076 + +::====================================== + +:: Remove previous Install + +for %%# in (OSPPC.DLL sppcs.dll) do ( +for %%A in ("%_osppPath68%\%%#" "%_osppPath86%\%%#") do ( +set size=0 +set size=%%~zA +if !size! GEQ 1 if !size! LSS 100000 ( +del /f /q "%%~A" %nul% +if exist "%%~A" (move /y "%%~A" "!_ttemp!\needsToBeDeleted%random%" %nul%) +if exist "%%~A" (set "ierror=Remove Previous Ohook Install [%%#]") +) +) +) + +if defined ierror goto :oh_hookinstall_error + +for %%A in ("%_osppPath68%" "%_osppPath86%") do ( +if exist "%%~A\sppcs.dll" (move /y "%%~A\sppcs.dll" "%%~A\OSPPC.DLL" %nul%) +if exist "%%~A\sppcs.dll" ( +move /y "%%~A\OSPPC.DLL" "!_ttemp!\needsToBeDeleted%random%" %nul% +move /y "%%~A\sppcs.dll" "%%~A\OSPPC.DLL" %nul% +) +if exist "%%~A\sppcs.dll" (set "ierror=Move sppcs.dll back to OSPPC.DLL") +) + +del /f /q "%_hookPath%\sppcs.dll" %nul% +if exist "%_hookPath%\sppcs.dll" (move /y "%_hookPath%\sppcs.dll" "!_ttemp!\needsToBeDeleted%random%" %nul%) +if exist "%_hookPath%\sppcs.dll" (set "ierror=Remove Previous Ohook mklink sppcs.dll") + +if defined ierror goto :oh_hookinstall_error + +::====================================== + +if defined _osppPath68 (move /y "%_osppPath68%\OSPPC.DLL" "%_osppPath68%\sppcs.dll" %nul% & if not exist "%_osppPath68%\sppcs.dll" set ierror=1) +if defined _osppPath86 (move /y "%_osppPath86%\OSPPC.DLL" "%_osppPath86%\sppcs.dll" %nul% & if not exist "%_osppPath86%\sppcs.dll" set ierror=1) + +if defined ierror ( +set "ierror=Rename OSPPC.DLL" +goto :oh_hookinstall_error +) + +if defined _osppPath68 if defined _osppPath86 (mklink "%_hookPath%\sppcs.dll" "%_osppPath86%\sppcs.dll" %nul%) +if defined _osppPath68 if not defined _osppPath86 (mklink "%_hookPath%\sppcs.dll" "%_osppPath68%\sppcs.dll" %nul%) +if defined _osppPath86 if not defined _osppPath68 (mklink "%_hookPath%\sppcs.dll" "%_osppPath86%\sppcs.dll" %nul%) + +if not exist "%_hookPath%\sppcs.dll" ( +set ierror=mklink sppcs.dll +goto :oh_hookinstall_error +) + +set exhook= +if exist "!_work!\BIN\%_hook68%" if exist "!_work!\BIN\%_hook86%" set exhook=1 + +if defined exhook ( +pushd "!_work!\BIN\" +if defined _osppPath68 (copy /y /b "%_hook68%" "%_osppPath68%\OSPPC.DLL" %nul%) +if defined _osppPath86 (copy /y /b "%_hook86%" "%_osppPath86%\OSPPC.DLL" %nul%) +popd ) else ( +if defined _osppPath68 (set _hook=%_hook68%&call :oh_extractdll "%_osppPath68%\OSPPC.DLL" "%offset68%") +if defined _osppPath86 (set _hook=%_hook86%&call :oh_extractdll "%_osppPath86%\OSPPC.DLL" "%offset86%") +) + +if defined _osppPath68 (if not exist "%_osppPath68%\OSPPC.DLL" set ierror=1) +if defined _osppPath86 (if not exist "%_osppPath86%\OSPPC.DLL" set ierror=1) + +if defined ierror ( +set ierror=Copy +goto :oh_hookinstall_error +) + +echo: +if defined _osppPath68 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath68%\sppcs.dll"]) +if defined _osppPath86 (echo Renaming OSPPC.DLL to sppcs.dll ["%_osppPath86%\sppcs.dll"]) +if defined exhook ( +if defined _osppPath68 (echo Copying Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"]) +if defined _osppPath86 (echo Copying Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"]) +) else ( +if defined _osppPath68 (echo Extracting Custom %_hook68% to ["%_osppPath68%\OSPPC.DLL"]) +if defined _osppPath86 (echo Extracting Custom %_hook86% to ["%_osppPath86%\OSPPC.DLL"]) +) + +echo Symlinking Renamed sppcs.dll ["%_hookPath%\sppcs.dll"] + +::======================================================================================================================================== + +:oh_hookinstall_error + +if defined ierror ( set error=1 call :dk_color %Red% "Installing Ohook [Failed to %ierror%]" echo: @@ -996,9 +1218,9 @@ if not defined exhook if not defined ierror ( if defined hasherror ( set error=1 set ierror=1 -call :dk_color %Red% "Modifying Hash of Custom %_hook% [Failed]" +call :dk_color %Red% "Modifying Hash of Custom sppcs.dll [Failed]" ) else ( -echo Modifying Hash of Custom %_hook% [Successful] +echo Modifying Hash of Custom sppcs.dll [Successful] ) ) @@ -1006,6 +1228,26 @@ exit /b ::======================================================================================================================================== +:oh_setspp + +set isOspp= +if %winbuild% GEQ 9200 ( +set spp=SoftwareLicensingProduct +set sps=SoftwareLicensingService +) else ( +set isOspp=1 +set spp=OfficeSoftwareProtectionProduct +set sps=OfficeSoftwareProtectionService +) +if "%1"=="14" ( +set isOspp=1 +set spp=OfficeSoftwareProtectionProduct +set sps=OfficeSoftwareProtectionService +) +exit /b + +::======================================================================================================================================== + :oh_process for %%# in (%_oIds%) do ( @@ -1025,10 +1267,11 @@ call :ohookdata getinfo !_prod! if not "!key!"=="" ( echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic +if not %oVer%==14 set generickey=1 call :dk_inskey "[!key!] [!_prod!] [!_lic!]" ) else ( set error=1 -call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]" +call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! key not found in script]" call :dk_color %Blue% "Make sure you are using the latest version of MAS." set fixes=%fixes% %mas% call :dk_color %_Yellow% "%mas%" @@ -1055,7 +1298,11 @@ exit /b :: Process Office MSI Version call :oh_reset +if "%1"=="14" ( +call :dk_actids 59a52881-a989-479d-af46-f275c6370663 +) else ( call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 +) set oVer=%1 for /f "skip=2 tokens=2*" %%a in ('"reg query %2\Common\InstallRoot /v Path" %nul6%') do (set "_oRoot=%%b") @@ -1068,16 +1315,8 @@ if "%osarch%"=="x86" set _oArch=x86 if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%" & set "_hook=sppc64.dll") if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%" & set "_hook=sppc32.dll") -if not "%osarch%"=="x86" ( -if /i "%_oArch%"=="x64" set "_sppcPath=%SystemRoot%\System32\sppc.dll" -if /i "%_oArch%"=="x86" set "_sppcPath=%SystemRoot%\SysWOW64\sppc.dll" -) else ( -set "_sppcPath=%SystemRoot%\System32\sppc.dll" -) -set "_common=%CommonProgramFiles%" -if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" -set "_common2=%CommonProgramFiles(x86)%" +call :oh_ppcpath call :msiofficedata %2 @@ -1090,8 +1329,23 @@ call :dk_color %Red% "Checking Installed Products [Product IDs not f exit /b ) +if defined noOsppc ( +call :dk_color %Red% "Checking OSPPC.DLL [Not found. Aborting activation...]" +call :dk_color %Blue% "%_fixmsg%" +set error=1 +exit /b +) + +if %oVer%==14 if defined SingleImage ( +echo Checking Installed Products [SingleImage product found, Professional Retail key will be used for activation] +) + call :oh_process +if defined isOspp ( +call :oh_hookinstall_ospp +) else ( call :oh_hookinstall +) exit /b @@ -1415,11 +1669,12 @@ set keyerror=%errorlevel% cmd /c exit /b %keyerror% if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" +if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ") if %keyerror% EQU 0 ( if %sps%==SoftwareLicensingService call :dk_refresh -echo Installing Generic Product Key %~1 [Successful] +echo %keyecho% %~1 [Successful] ) else ( -call :dk_color %Red% "Installing Generic Product Key %~1 [Failed] %keyerror%" +call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%" if not defined error ( if defined altapplist call :dk_color %Red% "Activation ID not found for this key." call :dk_color %Blue% "%_fixmsg%" @@ -1428,6 +1683,7 @@ set showfix=1 set error=1 ) +set generickey= exit /b :: Get all products Activation IDs @@ -1523,7 +1779,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -1533,10 +1789,6 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) -if %winbuild% LSS 7600 ( -set "winos=!winos:VistaT=Vista!" -set "winos=!winos:Serverr=Server!" -) exit /b @@ -2128,15 +2380,69 @@ exit /b :: 1st column = Office version number :: 2nd column = Activation ID -:: 3rd column = Generic key. Preference is given in this order, Retail:TB:Sub > Retail > OEM:NONSLP > Volume:MAK > Volume:GVLK +:: 3rd column = For Office 2013 and later, the generated keys are listed. For Office 2010, the blocked keys sourced from the Internet are listed. +:: For Office 2013 and later, key preference is given in this order, Retail:TB:Sub > Retail > OEM:NONSLP > Volume:MAK > Volume:GVLK +:: For Office 2010, key preference is given in this order, Retail > Volume:MAK :: 4th column = Last part of license description :: 5th column = Edition +:: 6th column = Other Edition IDs if they are part of the same primary product (For reference only) :: Separator = "_" +::=============== + +:: We couldn't find any keys (blocked/generic doesn't matter) for these Office 2010 products. If you have them, please share with us. + +14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_Retail________ExcelR_[HSExcelR] +14_7004b7f0-6407-4f45-8eac-966e5f868bde_Retail________GrooveR +14_fbf4ac36-31c8-4340-8666-79873129cf40_Retail________OutlookR +14_133c8359-4e93-4241-8118-30bb18737ea0_Retail________PowerPointR_[HSPowerPointR] +14_98677603-a668-4fa4-9980-3f1f05f78f69_Retail________PublisherR +14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_Retail________WordR_[HSWordR] +14_dbe3aee0-5183-4ff7-8142-66050173cb01_Retail________SmallBusBasicsR_[SmallBusBasicsMSDNR] + +:: These installers are not publicly available, so it doesn't matter if we don't have their keys. + +14_19316117-30a8-4773-8fd9-7f7231f4e060_SubPrepid_____HomeBusinessSubR +14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_SubPrepid_____ProjectProSubR +14_e98ef0c0-71c4-42ce-8305-287d8721e26c_SubPrepid_____ProPlusSubR +14_14f5946a-debc-4716-babc-7e2c240fec08_Retail________MondoR +14_533b656a-4425-480b-8e30-1a2358898350_MAK___________MondoVL + :ohookdata set f= for %%# in ( +:: Office 2010 +14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_7KTYC-XR43P-C3MRW-BJKFD-XB%f%YPG_Retail________AccessR +14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_7XHPQ-BQMYG-YBP49-CY8B2-T8%f%CGQ_ByPass________AccessRuntimeR +14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_89RTQ-MT4GK-6CPTX-WWP7C-J9%f%KXR_MAK___________AccessVL +14_71dc86ff-f056-40d0-8ffb-9592705c9b76_39TRR-C2F37-9WYJ2-MJQXH-B9%f%38K_MAK___________ExcelVL +14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_RCGT3-FPQDV-H49CD-PPDBF-TH%f%47G_MAK___________GrooveVL +14_7b7d1f17-fdcb-4820-9789-9bec6e377821_3YR9B-D9W79-BY66R-R8XYP-QY%f%YYY_Retail________HomeBusinessR_[HomeBusinessDemoR] +14_09e2d37e-474b-4121-8626-58ad9be5776f_3X43R-HHHXX-FRHRW-2M2WJ-8V%f%PHD_Retail________HomeStudentR_[HomeStudentDemoR] +14_ef1da464-01c8-43a6-91af-e4e5713744f9_XDGJY-KFHW9-JWX9X-YM4GW-GC%f%8WR_Retail________InfoPathR +14_85e22450-b741-430c-a172-a37962c938af_6GKT2-KMJPK-4RRBF-8VQKB-JB%f%6G6_MAK___________InfoPathVL +14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_2TG3P-9DB76-4YT99-8RXGD-CW%f%XBP_Retail________OneNoteR_[HSOneNoteR] +14_6860b31f-6a67-48b8-84b9-e312b3485c4b_CV64P-F4VRH-BJ33D-PH6MR-X6%f%9RY_MAK___________OneNoteVL +14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_J8C9M-YXMH2-9CX44-2C3YG-V7%f%692_MAK___________OutlookVL +14_acb51361-c0db-4895-9497-1831c41f31a6_GMBWM-WVX26-7WHV4-DB43D-WV%f%DY2_Retail________PersonalR_[PersonalDemoR,PersonalPrepaidR] +14_38252940-718c-4aa6-81a4-135398e53851_HPBQP-RJHDR-Q3472-PT9Q6-PB%f%B72_MAK___________PowerPointVL +14_8b559c37-0117-413e-921b-b853aeb6e210_367X9-9HP9R-TKHY6-DH4QH-K9%f%PY7_Retail________ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR,OEM-SingleImage] +14_725714d7-d58f-4d12-9fa8-35873c6f7215_6JD4G-KRW3J-48MGV-DM6FC-T9%f%WKR_Retail________ProjectProR_[ProjectProMSDNR] +14_1cf57a59-c532-4e56-9a7d-ffa2fe94b474_3XDTH-MMGJ6-F9MKX-THP8D-G9%f%BP7_MAK___________ProjectProVL +14_688f6589-2bd9-424e-a152-b13f36aa6de1_2W96V-RTQ9R-2BPVT-PT8H9-MV%f%68T_Retail________ProjectStdR +14_11b39439-6b93-4642-9570-f2eb81be2238_4DTT4-D4MKX-23KFH-JKR6T-YK%f%G2J_MAK___________ProjectStdVL +14_71af7e84-93e6-4363-9b69-699e04e74071_2J9H6-H4D3G-PCXD2-96XVM-TR%f%R73_Retail________ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] +14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_6CD6C-9R8PB-T2D9Y-8RKKX-W7%f%DFK_MAK___________ProPlusVL_[ProPlusAcadVL] +14_3d014759-b128-4466-9018-e80f6320d9d0_32YG9-3VX77-YXJVV-PRVFW-TT%f%8BV_MAK___________PublisherVL +14_8090771e-d41a-4482-929e-de87f1f47e46_7VKXH-9BWCG-RPTBB-JBRV3-GR%f%HYC_MAK___________SmallBusBasicsVL +14_b78df69e-0966-40b1-ae85-30a5134dedd0_H48K6-FB4Y6-P83GH-9J7XG-HD%f%KKX_ByPass________SPDR +14_b6d2565c-341d-4768-ad7d-addbe00bb5ce_W3BTX-H6BW7-Q6DFW-BXFFY-8R%f%VJP_Retail________StandardR_[StandardMSDNR][KeyisforMSDNR] +14_1f76e346-e0be-49bc-9954-70ec53a4fcfe_2XTQP-GDR7C-GTXPC-6W6PV-4R%f%XGC_MAK___________StandardVL_[StandardAcadVL] +14_2745e581-565a-4670-ae90-6bf7c57ffe43_VXHHB-W7HBD-7M342-RJ7P8-CH%f%BD6_ByPass________StarterR +14_66cad568-c2dc-459d-93ec-2f3cb967ee34_2RDPT-WPYQM-C2WXF-BTPDW-2J%f%2HM_Retail________VisioSIR_Prem[Pro,Std] +14_36756cb8-8e69-4d11-9522-68899507cd6a_7PKFT-X2MKQ-GT6X2-8CB2W-CH%f%C9K_MAK___________VisioSIVL_Prem[Pro,Std] +14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_6J3XK-DFKGK-X373V-QJHYM-V3%f%FC2_MAK___________WordVL :: Office 2013 15_ab4d047b-97cf-4126-a69f-34df08e2f254_B7RFY-7NXPK-Q4342-Y9X2H-3J%f%X4X_Retail________AccessRetail 15_259de5be-492b-44b3-9d78-9645f848f7b0_X3XNB-HJB7K-66THH-8DWQ3-XH%f%GJP_Bypass________AccessRuntimeRetail @@ -2375,6 +2681,49 @@ exit /b :msiofficedata for %%# in ( +14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR +14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR +14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL +14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR_[HSExcelR] +14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL +14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR +14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL +14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR] +14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR +14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR] +14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR +14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL +14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR +14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL +14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception +14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR_[HSOneNoteR] +14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL +14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR +14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL +14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR] +14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR_[HSPowerPointR] +14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL +14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR] +14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR] +14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_011F_ProjectProSubR +14_1cf57a59-c532-4e56-9a7d-ffa2fe94b474_003B_ProjectProVL +14_688f6589-2bd9-424e-a152-b13f36aa6de1_003A_ProjectStdR +14_11b39439-6b93-4642-9570-f2eb81be2238_003A_ProjectStdVL +14_71af7e84-93e6-4363-9b69-699e04e74071_0011_ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] +14_e98ef0c0-71c4-42ce-8305-287d8721e26c_011D_ProPlusSubR +14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_0011_ProPlusVL_[ProPlusAcadVL] +14_98677603-a668-4fa4-9980-3f1f05f78f69_0019_PublisherR +14_3d014759-b128-4466-9018-e80f6320d9d0_0019_PublisherVL +14_dbe3aee0-5183-4ff7-8142-66050173cb01_008B_SmallBusBasicsR_[SmallBusBasicsMSDNR] +14_8090771e-d41a-4482-929e-de87f1f47e46_008B_SmallBusBasicsVL +14_b78df69e-0966-40b1-ae85-30a5134dedd0_0017_SPDR +14_d3422cfb-8d8b-4ead-99f9-eab0ccd990d7_0012_StandardR +14_1f76e346-e0be-49bc-9954-70ec53a4fcfe_0012_StandardVL_[StandardAcadVL] +14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR +14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception +14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception +14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR_[HSWordR] +14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL :: Office 2013 15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail 15_259de5be-492b-44b3-9d78-9645f848f7b0_001C_AccessRuntimeRetail @@ -2491,6 +2840,7 @@ if "%oVer%"=="%%A" ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) +if /i 003D==%%C set SingleImage=1 ) ) ) @@ -2507,7 +2857,7 @@ exit /b :oh_extractdll set b= -%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1]);" %nul2% | find /i "Error found" %nul1% && set hasherror=1 +%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[io.file]::ReadAllText('!_batp!') -split ':hexedit\:.*';iex ($m[1])" %nul2% | find /i "Error found" %nul1% && set hasherror=1 exit /b :hexedit: @@ -2546,7 +2896,7 @@ $Writer.Write($unixTimestamp) $Writer.Flush() # Write the current state of the MemoryStream to a temporary file -$tempFilePath = [System.IO.Path]::Combine($env:windir, "Temp", [System.IO.Path]::GetRandomFileName()) +$tempFilePath = "$env:windir\Temp\$([System.IO.Path]::GetRandomFileName())" [System.IO.File]::WriteAllBytes($tempFilePath, $MemoryStream.ToArray()) # Update hash using the temporary file diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 07b7470..bb6fd92 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -1,4 +1,4 @@ -@set masver=3.0 +@set masver=3.1 @echo off @@ -677,6 +677,7 @@ call echo Checking Installed Product Key [Partial Key - %%_partial%%] [ ) if defined key ( +set generickey=1 call :dk_inskey "[%key%]" ) @@ -686,7 +687,7 @@ call :dk_inskey "[%key%]" if not %_actoff%==1 goto :ks_activate -call :ks_setspp +call :oh_setspp :: Check ohook install @@ -731,7 +732,7 @@ set ohub=1 :: Check supported office versions -call :ks_getpath +call :oh_getpath set o16uwp= set o16uwp_path= @@ -910,9 +911,9 @@ call :ks_process :ks_startmsi -if defined o14msi call :ks_setspp 14 +if defined o14msi call :oh_setspp 14 if defined o14msi call :ks_processmsi 14 %o14msi_reg% -call :ks_setspp +call :oh_setspp if defined o15msi call :ks_processmsi 15 %o15msi_reg% if defined o16msi call :ks_processmsi 16 %o16msi_reg% @@ -1056,7 +1057,7 @@ exit /b ::======================================================================================================================================== -:ks_getpath +:oh_getpath set o16c2r= set o15c2r= @@ -1143,16 +1144,19 @@ exit /b ::======================================================================================================================================== -:ks_setspp +:oh_setspp +set isOspp= if %winbuild% GEQ 9200 ( set spp=SoftwareLicensingProduct set sps=SoftwareLicensingService ) else ( +set isOspp=1 set spp=OfficeSoftwareProtectionProduct set sps=OfficeSoftwareProtectionService ) if "%1"=="14" ( +set isOspp=1 set spp=OfficeSoftwareProtectionProduct set sps=OfficeSoftwareProtectionService ) @@ -1212,6 +1216,7 @@ call :ks_osppready if not "!key!"=="" ( echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic +set generickey=1 call :dk_inskey "[!key!] [!_prod!]" ) else ( if not defined _oMSI ( @@ -1220,7 +1225,7 @@ call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 ! call :dk_color %Blue% "Make sure you are using Latest MAS script." ) else ( call :dk_color %Red% "Checking Product In Script [!_prod! MSI Retail is not supported]" -call :dk_color %Blue% "Uninstall this and Install C2R or MSI VL version of Office." +call :dk_color %Blue% "Use Ohook option to activate it." ) set fixes=%fixes% %mas%genuine-installation-media call :dk_color %_Yellow% "%mas%genuine-installation-media" @@ -1254,10 +1259,6 @@ echo "%2" | find /i "Wow6432Node" %nul1% && set _oArch=x86 if not "%osarch%"=="x86" if not defined _oArch set _oArch=x64 if "%osarch%"=="x86" set _oArch=x86 -set "_common=%CommonProgramFiles%" -if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" -set "_common2=%CommonProgramFiles(x86)%" - call :msiofficedata %2 echo: @@ -2633,11 +2634,12 @@ set keyerror=%errorlevel% cmd /c exit /b %keyerror% if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" +if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ") if %keyerror% EQU 0 ( if %sps%==SoftwareLicensingService call :dk_refresh -echo Installing Generic Product Key %~1 [Successful] +echo %keyecho% %~1 [Successful] ) else ( -call :dk_color %Red% "Installing Generic Product Key %~1 [Failed] %keyerror%" +call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%" if not defined error ( if defined altapplist call :dk_color %Red% "Activation ID not found for this key." call :dk_color %Blue% "%_fixmsg%" @@ -2646,6 +2648,7 @@ set showfix=1 set error=1 ) +set generickey= exit /b :: Get Windows installed key channel @@ -2768,7 +2771,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -2778,10 +2781,6 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) -if %winbuild% LSS 7600 ( -set "winos=!winos:VistaT=Vista!" -set "winos=!winos:Serverr=Server!" -) if not defined winsub exit /b @@ -3438,47 +3437,30 @@ exit /b :: 5th column = Other Edition IDs if they are part of the same primary product (For reference only) :: Separator = "_" -:: EditionID Notes: -:: For Office 2013 and later, all Edition IDs are clearly defined, and each ID corresponds to its specific licensing. - -:: In Office 2010, the situation is a bit more complicated. -:: Products typically fall into two separate categories: Volume License (VL) and Non-VL. This is because a single installation cannot include both Retail and VL licensing types. -:: Some Edition IDs share the same primary product ID. For example, installing ProPlusVL also installs ProPlusAcadVL licenses, as both use 0011 as the primary product ID. -:: Therefore, in the script, we grouped VL and Non-VL versions by primary product ID and selected the highest Edition ID when multiple Edition IDs existed for the same primary product ID. - -:: There are a few exceptions to this 2010 rule: Visio (Premium, Pro, Standard) and OEM-SingleImage. - -:: For Visio, the issue is that branding.xml lists incorrect primary product IDs. The correct primary product ID for all three Visio variants is 0057. Based on the criteria above, we chose Visio-Premium as the representative Edition ID among the three. -:: For OEM-SingleImage, it installs multiple Edition IDs and uses 003D as the primary product ID. Following our method, we selected the highest available Edition ID—ProfessionalR in this case. - :msiofficedata for %%# in ( 14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR 14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR 14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL -14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR +14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR_[HSExcelR] 14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL 14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR 14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL 14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR] 14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR 14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR] -14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_0029_HSExcelR -14_25fe4611-b44d-49cc-ae87-2143d299194e_00A3_HSOneNoteR -14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_0037_HSPowerPointR -14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_002B_HSWordR 14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR 14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL 14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR 14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL 14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception -14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR +14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR_[HSOneNoteR] 14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL 14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR 14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL 14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR] -14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR +14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR_[HSPowerPointR] 14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL 14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR] 14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR] @@ -3499,7 +3481,7 @@ for %%# in ( 14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR 14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception 14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception -14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR +14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR_[HSWordR] 14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL :: Office 2013 15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail @@ -3617,6 +3599,7 @@ if "%oVer%"=="%%A" ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) +if /i 003D==%%C set SingleImage=1 ) ) ) diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 2400e45..40d9914 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1,4 +1,4 @@ -@set masver=3.0 +@set masver=3.1 @echo off @@ -432,9 +432,9 @@ echo: echo ______________________________________________________________ echo: echo [1] Activate - Windows -echo [2] Activate - Windows [ESU] -echo [3] Activate - Office [All] -echo [4] Activate - Office [Project/Visio] +echo [2] Activate - ESU +echo [3] Activate - Office [All] +echo [4] Activate - Office [Project/Visio] echo [5] Activate - All echo _______________________________________________ echo: @@ -565,13 +565,6 @@ set "_serv=%_slser% Winmgmt" call :dk_errorcheck -if defined error ( -call :dk_color %Red% "Some errors were detected. Aborting the operation..." -set fixes=%fixes% %mas%troubleshoot -call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot" -goto :dk_done -) - call :ts_getedition if not defined tsedition ( call :dk_color %Red% "Checking Windows Edition ID [Not found in installed licenses, aborting...]" @@ -705,7 +698,8 @@ goto :ts_esu echo Checking Activation ID [%tempid%] [%tsedition%] -call :ts_inskey "[%key%]" +set generickey=1 +call :dk_inskey "[%key%]" if not defined error set tsids=%tsids% %tempid% goto :ts_esu @@ -827,7 +821,8 @@ goto :ts_esu echo Resetting Rearm / GracePeriod [Successful] ) -call :ts_inskey "[%key%]" +set generickey=1 +call :dk_inskey "[%key%]" ::======================================================================================================================================== @@ -900,7 +895,7 @@ set esuexistbutnosup=1 if defined esuexistsup if defined _vis ( set key=9FPV7-MWGT8-7XPDF-JC23W-WT7TW REM This is a non-generic blocked MAK key for Server-ESU-PA -call :ts_inskey "[!key!]" +call :dk_inskey "[!key!]" goto :ts_off ) @@ -949,7 +944,7 @@ if not %_actoff%==1 goto :ts_act if %winbuild% LSS 9200 ( echo: call :dk_color %Gray% "Checking Supported Office [TSforge for Office is supported on Windows 8 and later versions]" -call :dk_color %Blue% "On Windows Vista / 7, use Online %KS% activation option for Office instead." +call :dk_color %Blue% "On Windows Vista / 7, use Ohook activation option for Office instead." goto :ts_act ) @@ -990,6 +985,7 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\14.0\Common\InstallRoot /v P if not "%o14msi%%o14c2r%"=="" ( echo: call :dk_color %Red% "Checking Unsupported Office Install [ %o14msi%%o14c2r%]" +if defined o14msi call :dk_color %Blue% "Use Ohook activation option for Office 2010." ) if %winbuild% GEQ 10240 %psc% "Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub"" | find /i "Office" %nul1% && ( @@ -1310,7 +1306,7 @@ call :dk_color %Blue% "Business, BusinessN, Enterprise, EnterpriseN, and Server goto :ts_act ) -call :ts_inskey "[%key%]" +call :dk_inskey "[%key%]" if not defined error set tsids=%tsids% %tempid% goto :ts_act @@ -2286,7 +2282,7 @@ exit /b :: Install Key -:ts_inskey +:dk_inskey if %_wmic% EQU 1 wmic path %sps% where __CLASS='%sps%' call InstallProductKey ProductKey="%key%" %nul% if %_wmic% EQU 0 %psc% "try { $null=(([WMISEARCHER]'SELECT Version FROM %sps%').Get()).InstallProductKey('%key%'); exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul% @@ -2294,15 +2290,21 @@ set keyerror=%errorlevel% cmd /c exit /b %keyerror% if %keyerror% NEQ 0 set "keyerror=[0x%=ExitCode%]" +if defined generickey (set "keyecho=Installing Generic Product Key ") else (set "keyecho=Installing Product Key ") if %keyerror% EQU 0 ( if %sps%==SoftwareLicensingService call :dk_refresh -echo Installing Product Key %~1 [Successful] +echo %keyecho% %~1 [Successful] ) else ( -set error=1 -call :dk_color %Red% "Installing Product Key %~1 [Failed] %keyerror%" +call :dk_color %Red% "%keyecho% %~1 [Failed] %keyerror%" +if not defined error ( +if defined altapplist call :dk_color %Red% "Activation ID not found for this key." call :dk_color %Blue% "%_fixmsg%" +set showfix=1 +) +set error=1 ) +set generickey= exit /b :: Activation command @@ -2428,7 +2430,7 @@ exit /b :dk_product set d1=%ref% $meth = $TypeBuilder.DefinePInvokeMethod('BrandingFormatString', 'winbrand.dll', 'Public, Static', 1, [String], @([String]), 1, 3); -set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') +set d1=%d1% $meth.SetImplementationFlags(128); $TypeBuilder.CreateType()::BrandingFormatString('%%WINDOWS_LONG%%') -replace [string][char]0xa9, '(C)' -replace [string][char]0xae, '(R)' -replace [string][char]0x2122, '(TM)' set winos= for /f "delims=" %%s in ('"%psc% %d1%"') do if not errorlevel 1 (set winos=%%s) @@ -2438,10 +2440,6 @@ if %winbuild% GEQ 22000 ( set winos=!winos:Windows 10=Windows 11! ) ) -if %winbuild% LSS 7600 ( -set "winos=!winos:VistaT=Vista!" -set "winos=!winos:Serverr=Server!" -) if not defined winsub exit /b @@ -8207,6 +8205,49 @@ Office-ActID -pkeypath "$env:pkeypath" -edition "$env:_License" -keytype "$env:k :msiofficedata for %%# in ( +14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR +14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR +14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL +14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR_[HSExcelR] +14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL +14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR +14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL +14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR] +14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR +14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR] +14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR +14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL +14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR +14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL +14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception +14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR_[HSOneNoteR] +14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL +14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR +14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL +14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR] +14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR_[HSPowerPointR] +14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL +14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR] +14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR] +14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_011F_ProjectProSubR +14_1cf57a59-c532-4e56-9a7d-ffa2fe94b474_003B_ProjectProVL +14_688f6589-2bd9-424e-a152-b13f36aa6de1_003A_ProjectStdR +14_11b39439-6b93-4642-9570-f2eb81be2238_003A_ProjectStdVL +14_71af7e84-93e6-4363-9b69-699e04e74071_0011_ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R] +14_e98ef0c0-71c4-42ce-8305-287d8721e26c_011D_ProPlusSubR +14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_0011_ProPlusVL_[ProPlusAcadVL] +14_98677603-a668-4fa4-9980-3f1f05f78f69_0019_PublisherR +14_3d014759-b128-4466-9018-e80f6320d9d0_0019_PublisherVL +14_dbe3aee0-5183-4ff7-8142-66050173cb01_008B_SmallBusBasicsR_[SmallBusBasicsMSDNR] +14_8090771e-d41a-4482-929e-de87f1f47e46_008B_SmallBusBasicsVL +14_b78df69e-0966-40b1-ae85-30a5134dedd0_0017_SPDR +14_d3422cfb-8d8b-4ead-99f9-eab0ccd990d7_0012_StandardR +14_1f76e346-e0be-49bc-9954-70ec53a4fcfe_0012_StandardVL_[StandardAcadVL] +14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR +14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception +14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception +14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR_[HSWordR] +14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL :: Office 2013 15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail 15_259de5be-492b-44b3-9d78-9645f848f7b0_001C_AccessRuntimeRetail @@ -8323,6 +8364,7 @@ if "%oVer%"=="%%A" ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) +if /i 003D==%%C set SingleImage=1 ) ) ) diff --git a/MAS/Separate-Files-Version/Change_Office_Edition.cmd b/MAS/Separate-Files-Version/Change_Office_Edition.cmd index a068afa..951a5b9 100644 --- a/MAS/Separate-Files-Version/Change_Office_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Office_Edition.cmd @@ -1,4 +1,4 @@ -@set masver=3.0 +@set masver=3.1 @echo off diff --git a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd index 5c34093..6529adf 100644 --- a/MAS/Separate-Files-Version/Change_Windows_Edition.cmd +++ b/MAS/Separate-Files-Version/Change_Windows_Edition.cmd @@ -1,4 +1,4 @@ -@set masver=3.0 +@set masver=3.1 @echo off diff --git a/MAS/Separate-Files-Version/Check_Activation_Status.cmd b/MAS/Separate-Files-Version/Check_Activation_Status.cmd index 104a856..458b486 100644 --- a/MAS/Separate-Files-Version/Check_Activation_Status.cmd +++ b/MAS/Separate-Files-Version/Check_Activation_Status.cmd @@ -201,12 +201,14 @@ function BoolToWStr($bVal) { } function InitializePInvoke($LaDll, $bOffice) { - $Marshal = [System.Runtime.InteropServices.Marshal] - $Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly((Get-Random), 'Run').DefineDynamicModule((Get-Random), $False) - $SLApp = $NT7 -Or $bOffice -Or ($LaDll -EQ 'sppc.dll' -And [Diagnostics.FileVersionInfo]::GetVersionInfo("$SysPath\sppc.dll").FilePrivatePart -GE 16501) - + $LaName = [IO.Path]::GetFileNameWithoutExtension($LaDll) + $SLApp = $NT7 -Or $bOffice -Or ($LaName -EQ 'sppc' -And [Diagnostics.FileVersionInfo]::GetVersionInfo("$SysPath\sppc.dll").FilePrivatePart -GE 16501) $Win32 = $null - $Class = $Module.DefineType((Get-Random), 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0) + + $Marshal = [System.Runtime.InteropServices.Marshal] + $Module = [AppDomain]::CurrentDomain.DefineDynamicAssembly(($LaName+"_Assembly"), 'Run').DefineDynamicModule(($LaName+"_Module"), $False) + $Class = $Module.DefineType(($LaName+"_Methods"), 'Public, Abstract, Sealed, BeforeFieldInit', [Object], 0) + $Class.DefinePInvokeMethod('SLClose', $LaDll, 22, 1, [Int32], @([IntPtr]), 1, 3).SetImplementationFlags(128) $Class.DefinePInvokeMethod('SLOpen', $LaDll, 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) $Class.DefinePInvokeMethod('SLGenerateOfflineInstallationId', $LaDll, 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128) @@ -255,10 +257,51 @@ function SlGetInfoIID($SkuId) { return $null } + else + { + return $Marshal::PtrToStringUni($bData) + } +} - $rData = $Marshal::PtrToStringUni($bData) - $Marshal::FreeHGlobal($bData) - return $rData +function SlReturnData($hrRet, $tData, $cData, $bData) { + if ($hrRet -NE 0 -Or $cData -EQ 0) + { + return $null + } + if ($tData -EQ 1) + { + return $Marshal::PtrToStringUni($bData) + } + elseif ($tData -EQ 4) + { + return $Marshal::ReadInt32($bData) + } + elseif ($tData -EQ 3 -And $cData -EQ 8) + { + return $Marshal::ReadInt64($bData) + } + else + { + return $null + } +} + +function SlGetInfoPKey($PkeyId, $Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 + + $hrRet = $Win32::SLGetPKeyInformation( + $hSLC, + [ref][Guid]$PkeyId, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + return SlReturnData $hrRet $tData $cData $bData } function SlGetInfoSku($SkuId, $Value) @@ -267,7 +310,7 @@ function SlGetInfoSku($SkuId, $Value) $cData = 0 $bData = 0 - $ret = $Win32::SLGetProductSkuInformation( + $hrRet = $Win32::SLGetProductSkuInformation( $hSLC, [ref][Guid]$SkuId, $Value, @@ -276,70 +319,7 @@ function SlGetInfoSku($SkuId, $Value) [ref]$bData ) - if ($ret -Or !$cData) - { - return $null - } - - if ($tData -EQ 1) - { - $rData = $Marshal::PtrToStringUni($bData) - } - elseif ($tData -EQ 4) - { - $rData = $Marshal::ReadInt32($bData) - } - elseif ($tData -EQ 3 -And $cData -EQ 8) - { - $rData = $Marshal::ReadInt64($bData) - } - else - { - $rData = $null - } - - $Marshal::FreeHGlobal($bData) - return $rData -} - -function SlGetInfoService($Value) -{ - $tData = 0 - $cData = 0 - $bData = 0 - - $ret = $Win32::SLGetServiceInformation( - $hSLC, - $Value, - [ref]$tData, - [ref]$cData, - [ref]$bData - ) - - if ($ret -Or !$cData) - { - return $null - } - - if ($tData -EQ 1) - { - $rData = $Marshal::PtrToStringUni($bData) - } - elseif ($tData -EQ 4) - { - $rData = $Marshal::ReadInt32($bData) - } - elseif ($tData -EQ 3 -And $cData -EQ 8) - { - $rData = $Marshal::ReadInt64($bData) - } - else - { - $rData = $null - } - - $Marshal::FreeHGlobal($bData) - return $rData + return SlReturnData $hrRet $tData $cData $bData } function SlGetInfoApp($AppId, $Value) @@ -348,7 +328,7 @@ function SlGetInfoApp($AppId, $Value) $cData = 0 $bData = 0 - $ret = $Win32::SLGetApplicationInformation( + $hrRet = $Win32::SLGetApplicationInformation( $hSLC, [ref][Guid]$AppId, $Value, @@ -357,80 +337,49 @@ function SlGetInfoApp($AppId, $Value) [ref]$bData ) - if ($ret -Or !$cData) - { - return $null - } + return SlReturnData $hrRet $tData $cData $bData +} - if ($tData -EQ 1) - { - $rData = $Marshal::PtrToStringUni($bData) - } - elseif ($tData -EQ 4) - { - $rData = $Marshal::ReadInt32($bData) - } - elseif ($tData -EQ 3 -And $cData -EQ 8) - { - $rData = $Marshal::ReadInt64($bData) - } - else - { - $rData = $null - } +function SlGetInfoService($Value) +{ + $tData = 0 + $cData = 0 + $bData = 0 - $Marshal::FreeHGlobal($bData) - return $rData + $hrRet = $Win32::SLGetServiceInformation( + $hSLC, + $Value, + [ref]$tData, + [ref]$cData, + [ref]$bData + ) + + return SlReturnData $hrRet $tData $cData $bData } function SlGetInfoSvcApp($strApp, $Value) { if ($SLApp) { - $rData = SlGetInfoApp $strApp $Value + return SlGetInfoApp $strApp $Value } else { - $rData = SlGetInfoService $Value + return SlGetInfoService $Value } - return $rData -} - -function SlGetInfoPKey($PkeyId, $Value) -{ - $cData = 0 - $bData = 0 - - $ret = $Win32::SLGetPKeyInformation( - $hSLC, - [ref][Guid]$PKeyId, - $Value, - [ref]$null, - [ref]$cData, - [ref]$bData - ) - - if ($ret -Or !$cData) - { - return $null - } - - $rData = $Marshal::PtrToStringUni($bData) - $Marshal::FreeHGlobal($bData) - return $rData } function SlGetInfoLicensing($AppId, $SkuId) { - $LicenseStatus = 0 - $GracePeriodRemaining = 0 + $dwStatus = 0 + $dwGrace = 0 $hrReason = 0 - $EvaluationEndDate = 0 + $qwValidity = 0 $cStatus = 0 $pStatus = 0 - $ret = $Win32::SLGetLicensingStatusInformation( + $hrRet = $Win32::SLGetLicensingStatusInformation( $hSLC, [ref][Guid]$AppId, [ref][Guid]$SkuId, @@ -439,80 +388,46 @@ function SlGetInfoLicensing($AppId, $SkuId) [ref]$pStatus ) - if ($ret -Or !$cStatus) + if ($hrRet -NE 0 -Or $cStatus -EQ 0) { return } [IntPtr]$ppStatus = [Int64]$pStatus + [Int64]40 * ($cStatus - 1) - $eStatus = $Marshal::ReadInt32($ppStatus, 16) - $GracePeriodRemaining = $Marshal::ReadInt32($ppStatus, 20) + $dwStatus = $Marshal::ReadInt32($ppStatus, 16) + $dwGrace = $Marshal::ReadInt32($ppStatus, 20) $hrReason = $Marshal::ReadInt32($ppStatus, 28) - $EvaluationEndDate = $Marshal::ReadInt64($ppStatus, 32) + $qwValidity = $Marshal::ReadInt64($ppStatus, 32) - if ($eStatus -EQ 3) + if ($dwStatus -EQ 3) { - $eStatus = 5 + $dwStatus = 5 } - if ($eStatus -EQ 2) + if ($dwStatus -EQ 2) { if ($hrReason -EQ 0x4004F00D) { - $eStatus = 3 + $dwStatus = 3 } elseif ($hrReason -EQ 0x4004F065) { - $eStatus = 4 + $dwStatus = 4 } elseif ($hrReason -EQ 0x4004FC06) { - $eStatus = 6 + $dwStatus = 6 } } - $LicenseStatus = $eStatus - $Marshal::FreeHGlobal($pStatus) return } -function SlCheckInfo($SkuId, $Value) -{ - $cData = 0 - $bData = 0 - - $ret = $Win32::SLGetProductSkuInformation( - $hSLC, - [ref][Guid]$SkuId, - $Value, - [ref]$null, - [ref]$cData, - [ref]$bData - ) - - if ($ret -Or !$cData) - { - return $false - } - - if ($Value -EQ "pkeyId") - { - $rData = $Marshal::PtrToStringUni($bData) - } - else - { - $rData = $true - } - - $Marshal::FreeHGlobal($bData) - return $rData -} - function SlGetInfoSLID($AppId) { $cReturnIds = 0 $pReturnIds = 0 - $ret = $Win32::SLGetSLIDList( + $hrRet = $Win32::SLGetSLIDList( $hSLC, 0, [ref][Guid]$AppId, @@ -521,7 +436,7 @@ function SlGetInfoSLID($AppId) [ref]$pReturnIds ) - if ($ret -Or !$cReturnIds) + if ($hrRet -NE 0 -Or $cReturnIds -EQ 0) { return } @@ -536,17 +451,16 @@ function SlGetInfoSLID($AppId) $bytes = New-Object byte[] 16 $Marshal::Copy([Int64]$pReturnIds + [Int64]16 * $i, $bytes, 0, 16) $actid = ([Guid]$bytes).Guid - $gPPK = SlCheckInfo $actid "pkeyId" - $gAdd = SlCheckInfo $actid "DependsOn" + $gPPK = SlGetInfoSku $actid "pkeyId" + $gAdd = SlGetInfoSku $actid "DependsOn" if ($All.IsPresent) { - if (!$gPPK -And $gAdd) { $a1List += @{id = $actid; pk = $null; ex = $true} } - if (!$gPPK -And !$gAdd) { $a2List += @{id = $actid; pk = $null; ex = $false} } + if ($null -EQ $gPPK -And $null -NE $gAdd) { $a1List += @{id = $actid; pk = $null; ex = $true} } + if ($null -EQ $gPPK -And $null -EQ $gAdd) { $a2List += @{id = $actid; pk = $null; ex = $false} } } - if ($gPPK -And $gAdd) { $a3List += @{id = $actid; pk = $gPPK; ex = $true} } - if ($gPPK -And !$gAdd) { $a4List += @{id = $actid; pk = $gPPK; ex = $false} } + if ($null -NE $gPPK -And $null -NE $gAdd) { $a3List += @{id = $actid; pk = $gPPK; ex = $true} } + if ($null -NE $gPPK -And $null -EQ $gAdd) { $a4List += @{id = $actid; pk = $gPPK; ex = $false} } } - $Marshal::FreeHGlobal($pReturnIds) return ($a1List + $a2List + $a3List + $a4List) } @@ -603,7 +517,7 @@ function DetectSubscription { function DetectAdbaClient { - $propADBA | foreach { set $_ (SlGetInfoSku $ID $_) } + $propADBA | foreach { set $_ (SlGetInfoSku $licID $_) } CONOUT "`nAD Activation client information:" CONOUT " Object Name: $ADActivationObjectName" CONOUT " Domain Name: $ADActivationObjectDN" @@ -613,7 +527,7 @@ function DetectAdbaClient function DetectAvmClient { - $propAVMA | foreach { set $_ (SlGetInfoSku $ID $_) } + $propAVMA | foreach { set $_ (SlGetInfoSku $licID $_) } CONOUT "`nAutomatic VM Activation client information:" if (-Not [String]::IsNullOrEmpty($InheritedActivationId)) { CONOUT " Guest IAID: $InheritedActivationId" @@ -644,7 +558,6 @@ function DetectKmsHost if (-Not $IsKeyManagementService) { return } - if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} if ($Vista -Or $NT5) { $regk = $SLKeyPath @@ -697,9 +610,9 @@ function DetectKmsHost function DetectKmsClient { - if ($strSLP -EQ $wslp -And $NT8) + if ($win8) { - $VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $ID) "VLActivationType" + $VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $licID) "VLActivationType" if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath + '\' + $strApp) "VLActivationType"} if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath) "VLActivationType"} if ($null -EQ $VLType -Or $VLType -GT 3) {$VLType = 0} @@ -713,7 +626,7 @@ function DetectKmsClient } if ($NT7 -Or $strSLP -EQ $oslp) { - $propKMSClient | foreach { set $_ (SlGetInfoSku $ID $_) } + $propKMSClient | foreach { set $_ (SlGetInfoSku $licID $_) } if ($strSLP -EQ $oslp) {$regk = $OPKeyPath} else {$regk = $SPKeyPath} $KMSCaching = strGetRegistry $regk "DisableKeyManagementServiceHostCaching" if (-Not $KMSCaching) {$KMSCaching = "TRUE"} else {$KMSCaching = BoolToWStr (!$KMSCaching)} @@ -771,58 +684,90 @@ function DetectKmsClient function GetResult($strSLP, $strApp, $entry) { - $ID = $entry.id - $propPrd | foreach { set $_ (SlGetInfoSku $ID $_) } - . SlGetInfoLicensing $strApp $ID + $licID = $entry.id + $propPrd | foreach { set $_ (SlGetInfoSku $licID $_) } + . SlGetInfoLicensing $strApp $licID + $LicenseStatus = $dwStatus + $LicReason = $hrReason + $EvaluationEndDate = $qwValidity + $gprMnt = $dwGrace + + $pkid = $entry.pk + $isPPK = $null -NE $pkid + + $add_on = $Name.IndexOf("add-on for", 5) + if ($add_on -NE -1) { + $Name = $Name.Substring(0, $add_on + 7) + } + + $licPHN = "empty" + if ($Dlv -Or $All.IsPresent) { + $licPHN = SlGetInfoSku $licID "msft:sl/EUL/PHONE/PUBLIC" + } + + if ($LicenseStatus -EQ 0 -And !$isPPK) { + & $isAll + CONOUT "Name: $Name" + CONOUT "Description: $Description" + CONOUT "Activation ID: $licID" + CONOUT "License Status: Unlicensed" + if ($licPHN -NE "empty") { + $gPHN = [String]::IsNullOrEmpty($licPHN) -NE $true + CONOUT "Phone activatable: $($gPHN.ToString())" + } + return + } $winID = ($strApp -EQ $winApp) $winPR = ($winID -And -Not $entry.ex) $Vista = ($winID -And $NT6 -And -Not $NT7) $NT5 = ($strSLP -EQ $wslp -And $winbuild -LT 6001) + $win8 = ($strSLP -EQ $wslp -And $NT8) $reapp = ("Windows", "App")[!$winID] $prmnt = ("machine", "product")[!$winPR] - if ($Description | Select-String "VOLUME_KMSCLIENT") {$cKmsClient = 1; $_mTag = "Volume"} - if ($Description | Select-String "TIMEBASED_") {$cTblClient = 1; $_mTag = "Timebased"} - if ($Description | Select-String "VIRTUAL_MACHINE_ACTIVATION") {$cAvmClient = 1; $_mTag = "Automatic VM"} - if ($null -EQ $cKmsClient) { - if ($Description | Select-String "VOLUME_KMS") {$cKmsServer = 1} + if ($Description.Contains("VOLUME_KMSCLIENT")) {$cKmsClient = 1; $actTag = "Volume"} + if ($Description.Contains("TIMEBASED_")) {$cTblClient = 1; $actTag = "Timebased"} + if ($Description.Contains("VIRTUAL_MACHINE_ACTIVATION")) {$cAvmClient = 1; $actTag = "Automatic VM"} + if ($null -EQ $cKmsClient -And $Description.Contains("VOLUME_KMS")) {$cKmsServer = 1} + + $gprDay = [Math]::Round($gprMnt/1440) + $_xpr = "" + $inGrace = $false + if ($gprMnt -GT 0) { + $_xpr = [DateTime]::Now.AddMinutes($gprMnt).ToString('yyyy-MM-dd hh:mm:ss tt') + $inGrace = $true } - $_gpr = [Math]::Round($GracePeriodRemaining/1440) - if ($_gpr -GT 0) { - $_xpr = [DateTime]::Now.AddMinutes($GracePeriodRemaining).ToString('yyyy-MM-dd hh:mm:ss tt') - } - - $LicenseReason = '0x{0:X}' -f $hrReason - $LicenseMsg = "Time remaining: $GracePeriodRemaining minute(s) ($_gpr day(s))" + $LicenseMsg = "Time remaining: $gprMnt minute(s) ($gprDay day(s))" if ($LicenseStatus -EQ 0) { $LicenseInf = "Unlicensed" $LicenseMsg = $null } if ($LicenseStatus -EQ 1) { $LicenseInf = "Licensed" - if ($GracePeriodRemaining -EQ 0) { + if ($gprMnt -EQ 0) { $LicenseMsg = $null $ExpireMsg = "The $prmnt is permanently activated." } else { - $LicenseMsg = "$_mTag activation expiration: $GracePeriodRemaining minute(s) ($_gpr day(s))" - if ($null -NE $_xpr) {$ExpireMsg = "$_mTag activation will expire $_xpr"} + $LicenseMsg = "$actTag activation expiration: $gprMnt minute(s) ($gprDay day(s))" + if ($inGrace) {$ExpireMsg = "$actTag activation will expire $_xpr"} } } if ($LicenseStatus -EQ 2) { $LicenseInf = "Initial grace period" - if ($null -NE $_xpr) {$ExpireMsg = "Initial grace period ends $_xpr"} + if ($inGrace) {$ExpireMsg = "$LicenseInf ends $_xpr"} } if ($LicenseStatus -EQ 3) { $LicenseInf = "Additional grace period (KMS license expired or hardware out of tolerance)" - if ($null -NE $_xpr) {$ExpireMsg = "Additional grace period ends $_xpr"} + if ($inGrace) {$ExpireMsg = "Additional grace period ends $_xpr"} } if ($LicenseStatus -EQ 4) { $LicenseInf = "Non-genuine grace period" - if ($null -NE $_xpr) {$ExpireMsg = "Non-genuine grace period ends $_xpr"} + if ($inGrace) {$ExpireMsg = "$LicenseInf ends $_xpr"} } if ($LicenseStatus -EQ 5 -And -Not $NT5) { + $LicenseReason = '0x{0:X}' -f $LicReason $LicenseInf = "Notification" $LicenseMsg = "Notification Reason: $LicenseReason" if ($LicenseReason -EQ "0xC004F00F") {if ($null -NE $cKmsClient) {$LicenseMsg = $LicenseMsg + " (KMS license expired)."} else {$LicenseMsg = $LicenseMsg + " (hardware out of tolerance)."}} @@ -835,36 +780,35 @@ function GetResult($strSLP, $strApp, $entry) } if ($LicenseStatus -EQ 6 -And -Not $Vista -And -Not $NT5) { $LicenseInf = "Extended grace period" - if ($null -NE $_xpr) {$ExpireMsg = "Extended grace period ends $_xpr"} + if ($inGrace) {$ExpireMsg = "$LicenseInf ends $_xpr"} } - $pkid = $entry.pk - if ($null -NE $pkid) { + if ($isPPK) { $propPkey | foreach { set $_ (SlGetInfoPKey $pkid $_) } } - if ($winPR -And $null -NE $PartialProductKey -And -Not $NT8) { - $uxd = SlGetInfoSku $ID 'UXDifferentiator' + if ($winPR -And $isPPK -And -Not $NT8) { + $uxd = SlGetInfoSku $licID 'UXDifferentiator' $script:primary += @{ - aid = $ID; + aid = $licID; ppk = $PartialProductKey; chn = $Channel; lst = $LicenseStatus; - lcr = $hrReason; - ged = $GracePeriodRemaining; + lcr = $LicReason; + ged = $gprMnt; evl = $EvaluationEndDate; dff = $uxd } } - if ($IID -And $null -NE $PartialProductKey) { - $OfflineInstallationId = SlGetInfoIID $ID + if ($IID -And $isPPK) { + $OfflineInstallationId = SlGetInfoIID $licID } if ($Dlv) { - if ($strSLP -EQ $wslp -And $NT8) + if ($win8) { - $RemainingSkuReArmCount = SlGetInfoSku $ID 'RemainingRearmCount' + $RemainingSkuReArmCount = SlGetInfoSku $licID 'RemainingRearmCount' $RemainingAppReArmCount = SlGetInfoApp $strApp 'RemainingRearmCount' } else @@ -884,16 +828,10 @@ function GetResult($strSLP, $strApp, $entry) } } - if ($Dlv -Or $All.IsPresent) { - $gPHN = SlCheckInfo $ID "msft:sl/EUL/PHONE/PUBLIC" - } - - $add_on = $Name.IndexOf("add-on for", 5) - & $isAll - if ($add_on -EQ -1) {CONOUT "Name: $Name"} else {CONOUT "Name: $($Name.Substring(0, $add_on + 7))"} + CONOUT "Name: $Name" CONOUT "Description: $Description" - CONOUT "Activation ID: $ID" + CONOUT "Activation ID: $licID" if ($null -NE $DigitalPID) {CONOUT "Extended PID: $DigitalPID"} if ($null -NE $DigitalPID2 -And $Dlv) {CONOUT "Product ID: $DigitalPID2"} if ($null -NE $OfflineInstallationId -And $IID) {CONOUT "Installation ID: $OfflineInstallationId"} @@ -905,9 +843,9 @@ function GetResult($strSLP, $strApp, $entry) $EED = [DateTime]::FromFileTimeUtc($EvaluationEndDate).ToString('yyyy-MM-dd hh:mm:ss tt') CONOUT "Evaluation End Date: $EED UTC" } - if ($LicenseStatus -NE 1 -And $null -NE $gPHN) { - $gPHN = $gPHN.ToString() - CONOUT "Phone activatable: $gPHN" + if ($LicenseStatus -NE 1 -And $licPHN -NE "empty") { + $gPHN = [String]::IsNullOrEmpty($licPHN) -NE $true + CONOUT "Phone activatable: $($gPHN.ToString())" } if ($Dlv) { if ($null -NE $RemainingSLReArmCount) { @@ -922,11 +860,11 @@ function GetResult($strSLP, $strApp, $entry) CONOUT "Trusted time: $TTD" } } - if ($null -EQ $PartialProductKey) { + if (!$isPPK) { return } - if ($strSLP -EQ $wslp -And $NT8 -And $VLActivationType -EQ 1) { + if ($win8 -And $VLActivationType -EQ 1) { DetectAdbaClient } @@ -934,7 +872,7 @@ function GetResult($strSLP, $strApp, $entry) DetectAvmClient } - $chkSub = ($winPR -And $cSub) + $chkSub = ($winPR -And $isSub) $chkSLS = ($null -NE $cKmsClient -Or $null -NE $cKmsServer -Or $chkSub) @@ -943,15 +881,14 @@ function GetResult($strSLP, $strApp, $entry) return } - if ($null -NE $cKmsServer) { - DetectKmsHost - } - if ($null -NE $cKmsClient) { DetectKmsClient } - if ($null -EQ $cKmsServer) { + if ($null -NE $cKmsServer) { + if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} + DetectKmsHost + } else { if ($null -NE $ExpireMsg) {CONOUT "`n $ExpireMsg"} } @@ -1368,14 +1305,14 @@ function clcGetExpireKrn $cData = 0 $bData = 0 - $ret = $Win32::SLGetWindowsInformation( + $hrRet = $Win32::SLGetWindowsInformation( "Kernel-ExpirationDate", [ref]$tData, [ref]$cData, [ref]$bData ) - if ($ret -Or !$cData -Or $tData -NE 3) + if ($hrRet -Or !$cData -Or $tData -NE 3) { return $null } @@ -1390,7 +1327,7 @@ function clcGetExpireKrn $rData = '{0}/{1}/{2}:{3}:{4}:{5}' -f $year, $Marshal::ReadInt16($bData, 2), $Marshal::ReadInt16($bData, 4), $Marshal::ReadInt16($bData, 6), $Marshal::ReadInt16($bData, 8), $Marshal::ReadInt16($bData, 10) } - $Marshal::FreeHGlobal($bData) + #$Marshal::FreeHGlobal($bData) return $rData } @@ -1426,12 +1363,12 @@ function clcGetGenuineState($AppId) $dwGenuine = 0 if ($NT7) { - $ret = $Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine) + $hrRet = $Win32::SLIsWindowsGenuineLocal([ref]$dwGenuine) } else { - $ret = $Win32::SLIsGenuineLocal([ref][Guid]$AppId, [ref]$dwGenuine, 0) + $hrRet = $Win32::SLIsGenuineLocal([ref][Guid]$AppId, [ref]$dwGenuine, 0) } - if ($ret) + if ($hrRet) { $dwGenuine = 4 } @@ -1499,7 +1436,7 @@ $osls = "OfficeSoftwareProtectionService" $winApp = "55c92734-d682-4d71-983e-d6ec3f16059f" $o14App = "59a52881-a989-479d-af46-f275c6370663" $o15App = "0ff1ce15-a989-479d-af46-f275c6370663" -$cSub = ($winbuild -GE 26000) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType") +$isSub = ($winbuild -GE 26000) -And (Select-String -Path "$SysPath\wbem\sppwmi.mof" -Encoding unicode -Pattern "SubscriptionType") $DllDigital = ($winbuild -GE 14393) -And (Test-Path "$SysPath\EditionUpgradeManagerObj.dll") $DllSubscription = ($winbuild -GE 14393) -And (Test-Path "$SysPath\Clipc.dll") $VLActTypes = @("All", "AD", "KMS", "Token") diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd index 10030b1..7f6eb25 100644 --- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd +++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd @@ -1,4 +1,4 @@ -@set masver=3.0 +@set masver=3.1 @echo off diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd index 55a42ed..bc4d49d 100644 --- a/MAS/Separate-Files-Version/Troubleshoot.cmd +++ b/MAS/Separate-Files-Version/Troubleshoot.cmd @@ -1,4 +1,4 @@ -@set masver=3.0 +@set masver=3.1 @echo off diff --git a/README.md b/README.md index 0fca6c6..b3fdf00 100644 --- a/README.md +++ b/README.md @@ -6,43 +6,54 @@
-## Download / How to use it? +## How to Activate Windows / Office? ### Method 1 - PowerShell (Windows 8 and later) ❤️ -1. Open PowerShell (Not CMD). To do that, right-click on the Windows start menu and select PowerShell or Terminal. -2. Copy and paste the code below and press enter +1. **Open PowerShell** + To do that, press the Windows key + X, then select PowerShell or Terminal. + +2. **Copy and paste the code below, then press enter.** ``` irm https://get.activated.win | iex ``` -Alternatively, you can use the following (It will be deprecated in the future.) +Alternatively, you can use the following (this will be deprecated in the future): ``` irm https://massgrave.dev/get | iex ``` -3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation. -4. That's all. + +3. You will see the activation options. + Press 1 HWID for Windows activation. + Press 2 Ohook for Office activation. + +4. That's all --- -### Method 2 - Traditional (Windows 7 and later) +### Method 2 - Traditional (Windows Vista and later)
- Click here for info - -1. Download the file using the links provided below. + Click here to view + +1. Download the file using one of the links below: `https://github.com/massgravel/Microsoft-Activation-Scripts/archive/refs/heads/master.zip` or `https://git.activated.win/massgrave/Microsoft-Activation-Scripts/archive/master.zip` -2. Right-click on the downloaded zip file and extract -3. In the extracted folder, find the folder named `All-In-One-Version` -4. Run the file named `MAS_AIO.cmd` -5. You will see the activation options, follow the on-screen instructions. +2. Right-click on the downloaded zip file and extract it. +3. In the extracted folder, find the folder named `All-In-One-Version`. +4. Run the file named `MAS_AIO.cmd`. +5. You will see the activation options. Follow the on-screen instructions. 6. That's all.
--- +- **[Office for macOS](https://massgrave.dev/office_for_mac)** +- To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches). + +--- + ### Not working ❓ - If you are **unable to launch MAS** using the PowerShell method, please refer to **Method 2** listed above. @@ -59,11 +70,9 @@ or --- -To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches). - ``` -Latest Version: 3.0 -Release date: 14-Feb-2025 +Latest Version: 3.1 +Release date: 29-Apr-2025 ``` ### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)