mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2025-05-29 14:35:24 -04:00
Add TSforge and Online KMS support for Vista/Server2008
This commit is contained in:
parent
172fd7b1c5
commit
98ef9db3ce
11 changed files with 1211 additions and 281 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue