Commit 1f665ba9 authored by Windows_Addict's avatar Windows_Addict

1.3

parent 185e0bb9
This diff is collapsed.
@setlocal DisableDelayedExpansion
@echo off
@cls
:: ==================================================
:: Check-Activation-Status-Alternative.cmd
:: Written by @abbodi1406 (MDL)
:: https://forums.mydigitallife.net/posts/838808
:: ==================================================
color 07
title Check Activation Status [wmic]
set wspp=SoftwareLicensingProduct
set wsps=SoftwareLicensingService
set ospp=OfficeSoftwareProtectionProduct
set osps=OfficeSoftwareProtectionService
set winApp=55c92734-d682-4d71-983e-d6ec3f16059f
set o14App=59a52881-a989-479d-af46-f275c6370663
set o15App=0ff1ce15-a989-479d-af46-f275c6370663
for %%# in (spp_get,ospp_get,cW1nd0ws,sppw,c0ff1ce15,sppo,osppsvc,ospp14,ospp15) do set "%%#="
for /f "tokens=6 delims=[]. " %%# in ('ver') do set winbuild=%%#
set "spp_get=Description, DiscoveredKeyManagementServiceMachineName, DiscoveredKeyManagementServiceMachinePort, EvaluationEndDate, GracePeriodRemaining, ID, KeyManagementServiceMachine, KeyManagementServicePort, KeyManagementServiceProductKeyID, LicenseStatus, LicenseStatusReason, Name, PartialProductKey, ProductKeyID, VLActivationInterval, VLRenewalInterval"
set "ospp_get=%spp_get%"
if %winbuild% geq 9200 set "spp_get=%spp_get%, DiscoveredKeyManagementServiceMachineIpAddress, KeyManagementServiceLookupDomain, ProductKeyChannel, VLActivationTypeEnabled"
set "SysPath=%Windir%\System32"
if exist "%Windir%\Sysnative\reg.exe" (set "SysPath=%Windir%\Sysnative")
set "Path=%SysPath%;%Windir%;%SysPath%\Wbem;%SysPath%\WindowsPowerShell\v1.0\"
set "line2=************************************************************"
set "line3=____________________________________________________________"
call :casWpkey %wspp% %winApp% cW1nd0ws sppw
if %winbuild% geq 9200 call :casWpkey %wspp% %o15App% c0ff1ce15 sppo
wmic path %osps% get Version 1>nul 2>nul && (
call :casWpkey %ospp% %o14App% osppsvc ospp14
if %winbuild% lss 9200 call :casWpkey %ospp% %o15App% osppsvc ospp15
)
echo %line2%
echo *** Windows Status ***
echo %line2%
if not defined cW1nd0ws (
echo:
echo Error: product key not found.
goto :casWcon
)
set winID=1
for /f "tokens=2 delims==" %%# in ('"wmic path %wspp% where (ApplicationID='%winApp%' and PartialProductKey is not null) get ID /value"') do (
set "chkID=%%#"
call :casWdet "%wspp%" "%wsps%" "%spp_get%"
call :casWout
echo %line3%
echo:
)
:casWcon
set winID=0
set verbose=1
if not defined c0ff1ce15 (
if defined osppsvc goto :casWospp
goto :casWend
)
echo %line2%
echo *** Office Status ***
echo %line2%
for /f "tokens=2 delims==" %%# in ('"wmic path %wspp% where (ApplicationID='%o15App%' and PartialProductKey is not null) get ID /value"') do (
set "chkID=%%#"
call :casWdet "%wspp%" "%wsps%" "%spp_get%"
call :casWout
echo %line3%
echo:
)
set verbose=0
if defined osppsvc goto :casWospp
goto :casWend
:casWospp
if %verbose%==1 (
echo %line2%
echo *** Office Status ***
echo %line2%
)
if defined ospp15 for /f "tokens=2 delims==" %%# in ('"wmic path %ospp% where (ApplicationID='%o15App%' and PartialProductKey is not null) get ID /value"') do (
set "chkID=%%#"
call :casWdet "%ospp%" "%osps%" "%ospp_get%"
call :casWout
echo %line3%
echo:
)
if defined ospp14 for /f "tokens=2 delims==" %%# in ('"wmic path %ospp% where (ApplicationID='%o14App%' and PartialProductKey is not null) get ID /value"') do (
set "chkID=%%#"
call :casWdet "%ospp%" "%osps%" "%ospp_get%"
call :casWout
echo %line3%
echo:
)
goto :casWend
:casWpkey
wmic path %1 where (ApplicationID='%2' and PartialProductKey is not null) get ID /value 2>nul | findstr /i ID 1>nul && (set %3=1&set %4=1)
exit /b
:casWdet
for %%# in (%~3) do set "%%#="
if %~1 equ %ospp% for %%# in (DiscoveredKeyManagementServiceMachineIpAddress, KeyManagementServiceLookupDomain, ProductKeyChannel, VLActivationTypeEnabled) do set "%%#="
set "cKmsClient="
set "cTblClient="
set "cAvmClient="
set "ExpireMsg="
set "_xpr="
for /f "tokens=* delims=" %%# in ('"wmic path %~1 where ID='%chkID%' get %~3 /value" ^| findstr ^=') do set "%%#"
set /a _gpr=(GracePeriodRemaining+1440-1)/1440
echo %Description%| findstr /i VOLUME_KMSCLIENT 1>nul && (set cKmsClient=1&set _mTag=Volume)
echo %Description%| findstr /i TIMEBASED_ 1>nul && (set cTblClient=1&set _mTag=Timebased)
echo %Description%| findstr /i VIRTUAL_MACHINE_ACTIVATION 1>nul && (set cAvmClient=1&set _mTag=Automatic VM)
cmd /c exit /b %LicenseStatusReason%
set "LicenseReason=%=ExitCode%"
set "LicenseMsg=Time remaining: %GracePeriodRemaining% minute(s) (%_gpr% day(s))"
if %_gpr% GEQ 1 for /f "tokens=* delims=" %%# in ('powershell -nop -ep bypass -c "$([DateTime]::Now.addMinutes(%GracePeriodRemaining%)).ToString('yyyy-MM-dd HH:mm:ss')" 2^>nul') do set "_xpr=%%#"
if %LicenseStatus% EQU 0 (
set "License=Unlicensed"
set "LicenseMsg="
)
if %LicenseStatus% EQU 1 (
set "License=Licensed"
set "LicenseMsg="
if %GracePeriodRemaining% EQU 0 (
if %winID% EQU 1 (set "ExpireMsg=The machine is permanently activated.") else (set "ExpireMsg=The product is permanently activated.")
) else (
set "LicenseMsg=%_mTag% activation expiration: %GracePeriodRemaining% minute(s) (%_gpr% day(s))"
if defined _xpr set "ExpireMsg=%_mTag% activation will expire %_xpr%"
)
)
if %LicenseStatus% EQU 2 (
set "License=Initial grace period"
if defined _xpr set "ExpireMsg=Initial grace period ends %_xpr%"
)
if %LicenseStatus% EQU 3 (
set "License=Additional grace period (KMS license expired or hardware out of tolerance)"
if defined _xpr set "ExpireMsg=Additional grace period ends %_xpr%"
)
if %LicenseStatus% EQU 4 (
set "License=Non-genuine grace period."
if defined _xpr set "ExpireMsg=Non-genuine grace period ends %_xpr%"
)
if %LicenseStatus% EQU 6 (
set "License=Extended grace period"
if defined _xpr set "ExpireMsg=Extended grace period ends %_xpr%"
)
if %LicenseStatus% EQU 5 (
set "License=Notification"
if "%LicenseReason%"=="C004F200" (set "LicenseMsg=Notification Reason: 0xC004F200 (non-genuine)."
) else if "%LicenseReason%"=="C004F009" (set "LicenseMsg=Notification Reason: 0xC004F009 (grace time expired)."
) else (set "LicenseMsg=Notification Reason: 0x%LicenseReason%"
)
)
if %LicenseStatus% GTR 6 (
set "License=Unknown"
set "LicenseMsg="
)
if not defined cKmsClient exit /b
if %KeyManagementServicePort%==0 set KeyManagementServicePort=1688
set "KmsReg=Registered KMS machine name: %KeyManagementServiceMachine%:%KeyManagementServicePort%"
if "%KeyManagementServiceMachine%"=="" set "KmsReg=Registered KMS machine name: KMS name not available"
if %DiscoveredKeyManagementServiceMachinePort%==0 set DiscoveredKeyManagementServiceMachinePort=1688
set "KmsDns=KMS machine name from DNS: %DiscoveredKeyManagementServiceMachineName%:%DiscoveredKeyManagementServiceMachinePort%"
if "%DiscoveredKeyManagementServiceMachineName%"=="" set "KmsDns=DNS auto-discovery: KMS name not available"
for /f "tokens=* delims=" %%# in ('"wmic path %~2 get ClientMachineID, KeyManagementServiceHostCaching /value" ^| findstr ^=') do set "%%#"
if /i %KeyManagementServiceHostCaching%==True (set KeyManagementServiceHostCaching=Enabled) else (set KeyManagementServiceHostCaching=Disabled)
if %winbuild% lss 9200 exit /b
if %~1 equ %ospp% exit /b
if "%DiscoveredKeyManagementServiceMachineIpAddress%"=="" set "DiscoveredKeyManagementServiceMachineIpAddress=not available"
if "%KeyManagementServiceLookupDomain%"=="" set "KeyManagementServiceLookupDomain="
if %VLActivationTypeEnabled% EQU 3 (
set VLActivationType=Token
) else if %VLActivationTypeEnabled% EQU 2 (
set VLActivationType=KMS
) else if %VLActivationTypeEnabled% EQU 1 (
set VLActivationType=AD
) else (
set VLActivationType=All
)
exit /b
:casWout
echo:
echo Name: %Name%
echo Description: %Description%
echo Activation ID: %ID%
echo Extended PID: %ProductKeyID%
if defined ProductKeyChannel echo Product Key Channel: %ProductKeyChannel%
echo Partial Product Key: %PartialProductKey%
echo License Status: %License%
if defined LicenseMsg echo %LicenseMsg%
if not %LicenseStatus%==0 if not %EvaluationEndDate:~0,8%==16010101 echo Evaluation End Date: %EvaluationEndDate:~0,4%-%EvaluationEndDate:~4,2%-%EvaluationEndDate:~6,2% %EvaluationEndDate:~8,2%:%EvaluationEndDate:~10,2% UTC
if not defined cKmsClient (
if defined ExpireMsg echo:&echo: %ExpireMsg%
exit /b
)
if defined VLActivationTypeEnabled echo Configured Activation Type: %VLActivationType%
echo:
if not %LicenseStatus%==1 (
echo Please activate the product in order to update KMS client information values.
exit /b
)
echo Most recent activation information:
echo Key Management Service client information
echo: Client Machine ID (CMID): %ClientMachineID%
echo: %KmsDns%
echo: %KmsReg%
if defined DiscoveredKeyManagementServiceMachineIpAddress echo: KMS machine IP address: %DiscoveredKeyManagementServiceMachineIpAddress%
echo: KMS machine extended PID: %KeyManagementServiceProductKeyID%
echo: Activation interval: %VLActivationInterval% minutes
echo: Renewal interval: %VLRenewalInterval% minutes
echo: KMS host caching: %KeyManagementServiceHostCaching%
if defined KeyManagementServiceLookupDomain echo: KMS SRV record lookup domain: %KeyManagementServiceLookupDomain%
if defined ExpireMsg echo:&echo: %ExpireMsg%
exit /b
:casWend
echo:
echo Press any key to exit.
pause >nul
exit /b
\ No newline at end of file
====================================================================================================
File Details:
====================================================================================================
fabb5a0fc1e6a372219711152291339af36ed0b5 *gatherosstate.exe Virus Total = 0/71
ca3a51fdfc8749b8be85f7904b1c238a6dfba135 *slc.dll Virus Total = 0/68
578364cb2319da7999acd8c015b4ce8da8f1b282 *ARM64_gatherosstate.exe Virus Total = 0/69
5dbea3a580cf60391453a04a5c910a3ceca2b810 *ARM64_slc.dll Virus Total = 0/67
48d928b1bec25a56fe896c430c2c034b7866aa7a *ClipUp.exe Virus Total = 0/68
Virus Total Report Date: 2020-01-21
- File Sources:
- ClipUp.exe (Original):
From Windows server 2016 x64 ISO
- gatherosstate.exe (Original):
From Windows 10 x86 14393 ADK
- ARM64_gatherosstate.exe (Original):
From Windows 10 ARM64 18362 ISO
- ARM64_slc.dll and slc.dll:
Original slshim
https://github.com/vyvojar/slshim
Improved by @mspaintmsi
https://www.nsaneforums.com/topic/316668--/?do=findComment&comment=1497887
https://github.com/massgravel/MASSGRAVE
https://gitlab.com/massgrave/massgrave
Source code is included.
slc.dll is based on Integrated_Patcher_2 method.
It is currently in use in HWID/KMS38 Activation script.
____________________________________________________________________________________________________
You can safely delete the following files if it's not required for you.
ClipUp.exe - Required to KMS38 activate Server Cor and Acor editions.
ARM64_gatherosstate.exe and ARM64_slc.dll - Required to activate ARM64 Arch Windows 10.
====================================================================================================
\ No newline at end of file
====================================================================================================
File Details:
====================================================================================================
d30a0e4e5911d3ca705617d17225372731c770e2 *cleanosppx64.exe Virus Total = 0/66
39ed8659e7ca16aaccb86def94ce6cec4c847dd6 *cleanosppx86.exe Virus Total = 1/66
Virus Total Report Date: 12-11-2019
These files are official Microsoft files and in this script, these are used in
cleaning office license in C2R Retail office to VL conversion process.
The source of these files is the 'old' version of Microsoft Tool O15CTRRemove.diagcab
You can get the original file here https://s.put.re/WFuXpyWA.zip
====================================================================================================
\ No newline at end of file
----------------------------------------------------------------------------------------------
Activation Type Supported Product Activation Period
----------------------------------------------------------------------------------------------
Digital License - Windows 10 - Permanent
KMS38 - Windows 10 / Server - Until the year 2038
Online KMS - Windows / Server / Office - For 180 Days, renewal task needs to be
created for lifetime auto activation.
----------------------------------------------------------------------------------------------
* For more details, use the ReadMe.txt included in the respective activation folders.
\ No newline at end of file
====================================================================================================
Credits:
====================================================================================================
Microsoft Activation Scripts (MAS):
A collection of scripts for activating Microsoft products using HWID / KMS38 / Online KMS
activation methods with a focus on open-source code, less antivirus detection and user-friendliness.
These scripts are mostly a fork of other honourable developer's tools and scripts.
Homepages-
NsaneForums: (Login Required) https://www.nsaneforums.com/topic/316668-microsoft-activation-scripts/
GitHub: https://github.com/massgravel/Microsoft-Activation-Scripts
GitLab: https://gitlab.com/massgrave/microsoft-activation-scripts
Maintained by @WindowsAddict
To achieve this I have used the following projects as the base of this activator.
I would like to say thanks to the following authors for making such awesome projects.
====================================
HWID and KMS38 Activation:
====================================
@mspaintmsi Original co-authors of HWID/KMS38 Activation without KMS or predecessor install/upgrade.
and Created various methods for HWID/KMS38 Activation
*Anonymous https://www.nsaneforums.com/topic/316668--/?do=findComment&comment=1497887
https://github.com/massgravel/MASSGRAVE
https://gitlab.com/massgrave/massgrave
@vyvojar Original slshim (slc.dll)
https://github.com/vyvojar/slshim/releases
====================================
HWID/KMS38 methods Suggestions and improvements:-
@sponpa New ideas for the HWID/KM38 Generation
https://www.nsaneforums.com/topic/316668--/page/21/?tab=comments#comment-1431257
@leitek8 Improvements for the slc.dll
https://www.nsaneforums.com/topic/316668--/page/22/?tab=comments#comment-1438005
====================================
Online KMS Activation:
====================================
@abbodi1406 Activate.cmd (KMS_VL_ALL)
https://forums.mydigitallife.net/posts/838808
(* With the great help from @RPO, Forked it to work with Multi KMS Servers,
Renewal task, Desktop context menu, $OEM$, etc for Online KMS)
Clear-KMS-Cache.cmd
https://forums.mydigitallife.net/posts/1511883
(*Applied it as it is)
Check-Activation-Status-wmic.cmd
https://forums.mydigitallife.net/posts/838808
(*Applied it as it is)
====================================
Online Public KMS Servers:
kms.srv.crsoo.com
kms.loli.beer
kms8.MSGuides.com
kms9.MSGuides.com
kms.zhuxiaole.org
kms.lolico.moe
kms.moeclub.org
====================================
Useful scripts and ideas I used :
====================================
@AveYo (@BAU) Compressed2TXT
https://github.com/AveYo/Compressed2TXT
(For storing the files in text format)
Reg_takeownership snippet
pastebin.com/XTPt0JSC
(*Applied in KMS38 Protection)
@hearywarlot Elevate program as admin with vbs method
https://forums.mydigitallife.net/threads/.74332/
@dbenham Set buffer height independently of window height
https://stackoverflow.com/a/13351373
@Ratiborus Ratiborus Tools
http://forum.ru-board.com/topic.cgi?forum=2&topic=5734#1
@abbodi1406 Continuously providing best solutions for tons of issues.
abbodi1406's Batch Scripts Repo
https://forums.mydigitallife.net/threads/74197/
@s1ave77 slave77s S-M-R-T JATDevice MkIII
https://forums.mydigitallife.net/threads/44717/
====================================
Kind Help:
====================================
Thanks to the following people for answering all of my queries. (In no particular order)
@AveYo aka @BAU, @sponpa, @mspaintmsi @RPO, @leitek8, @mxman2k, @Yen, @abbodi1406
@BorrowedWifi for providing support in fixing English grammar errors in the Read Me.
@Chibi ANUBIS for testing scripts for ARM64 system.
----------------------------------------------------------------------------------------------------
Special thanks to @RPO and @abbodi1406,
For providing great support and solving countless issues in this tool.
====================================================================================================
\ No newline at end of file
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://pastebin.com/raw/jduBSazJ
HotKey=0
====================================================================================================
$OEM$ Folders [Windows Pre-Activation]:
====================================================================================================
- To create a Preactivated Windows installation .iso, do the following things:
Copy the "$OEM$" folder to the "sources" folder in the Windows installation media (.iso or USB).
The directory will appear like this: \sources\$OEM$ in your altered .iso or on your bootable
USB drive.
Now use this .iso or bootable USB drive to install Windows and it will either already be activated
(KMS38) as soon as it boots, or will self-activate at first internet contact.
----------------------------------------------------------------------------------------------------
HWID:
----------------------------------------------------------------------------------------------------
- When using Digital License (HWID), no files are stored on the system, and when connected to the
internet for the first time, the system will self-activate at that time.
----------------------------------------------------------------------------------------------------
KMS38:
----------------------------------------------------------------------------------------------------
- When using KMS38, no files are stored on the system, and Windows becomes activated immediately
without further actions or connectivity of any kind being required.
----------------------------------------------------------------------------------------------------
Online KMS (separately, or in combination with HWID or KMS38):
----------------------------------------------------------------------------------------------------
- It creates the following 2 Activation/Renewal Methods. You can turn off any of them in
setupcomplete.cmd file
----------------------------------------------------------
1- Automatic Renewal via Task Scheduler---
It creates following files and tasks,
Files:
C:\ProgramData\Online_KMS_Activation\BIN\cleanosppx64.exe
C:\ProgramData\Online_KMS_Activation\BIN\cleanosppx86.exe
C:\ProgramData\Online_KMS_Activation\Activate.cmd
C:\ProgramData\Online_KMS_Activation\Info.txt
Scheduled Tasks:
\Online_KMS_Activation_Script-Renewal (Weekly)
\Online_KMS_Activation_Script-Run_Once (Activation Task)
The scheduled task runs only if the system is connected to the Internet.
Activation Task will run on the system login and after successful activation and registering
online KMS server, this task will delete itself. leaving behind only one task to run weekly
for the lifetime of the system.
----------------------------------------------------------
2- Manual Renewal via Desktop Context Menu---
It creates Desktop context Menu for manual activation and renewal.
It creates the following files and registry entries.
Files:
C:\ProgramData\Online_KMS_Activation\BIN\cleanosppx64.exe
C:\ProgramData\Online_KMS_Activation\BIN\cleanosppx86.exe
C:\ProgramData\Online_KMS_Activation\Activate.cmd
C:\ProgramData\Online_KMS_Activation\Info.txt
Registry entries:
HKCR\DesktopBackground\shell\Activate Windows - Office
HKCR\DesktopBackground\shell\Activate Windows - Office\command
It creates an easy to reach the Desktop context menu for the manual activation renewal.
----------------------------------------------------------
d30a0e4e5911d3ca705617d17225372731c770e2 *cleanosppx64.exe Virus Total = 0/66
39ed8659e7ca16aaccb86def94ce6cec4c847dd6 *cleanosppx86.exe Virus Total = 1/66
Virus Total Report Date: 12-11-2019
These files are official Microsoft files and in this script, these are used in
cleaning office license in C2R Retail office to VL conversion process.
The source of these files is the 'old' version of Microsoft Tool O15CTRRemove.diagcab
You can get the original file here https://s.put.re/WFuXpyWA.zip
----------------------------------------------------------
IMPORTANT NOTE - Some sensitive AV's may flag the Automatic Renewal via the Task, and not
because of KMS, because for them it's suspicious to run long scripts in the background as Tasks.
It's recommended to set exclusions in Antivirus for
C:\ProgramData\Online_KMS_Activation\Activate.cmd
----------------------------------------------------------
- When using Online KMS plus HWID Digital License, Online KMS script will be set to skip Windows
activation (if the HWID activation was applied but was not successful due to lack of internet
at the time of installation of Windows) but will register the KMS for other products, and all
later installed Volume License (VL) products (MS Office) will self-activate when going online.
- When using Online KMS plus KMS38, Online KMS will not skip Windows activation but skip KMS38
activation and will register the KMS for other products, and all subsequently-installed Volume
License (VL) products (MS Office) will self-activate when going online.
----------------------------------------------------------------------------------------------------
HWID (Fallback to KMS38):
----------------------------------------------------------------------------------------------------
- In this method, KMS38 will be used for the activation in case the Windows version is not
supported by HWID. For example, Windows 10 LTSC and Windows server.
----------------------------------------------------------------------------------------------------
Activation Type Supported Product Activation Period
----------------------------------------------------------------------------------------------------
Digital License - Windows 10 - Permanent
KMS38 - Windows 10 / Server - Until the year 2038
Online KMS - Windows / Server / Office - For 180 Days, renewal task needs to be
created for lifetime auto-activation.
----------------------------------------------------------------------------------------------------
* For more details, use the ReadMe.txt included in the respective activation folders.
\ No newline at end of file
====================================================================================================
KMS38 Protection:
====================================================================================================
- If you don't know what KMS38 is, then first check it in the Read Me.
- By default, a KMS38 Activation is vulnerable to unintended overwriting/replacement and
neutralization by a 180-Day KMS Activator (non-KMS38 Activator).
However, with a few tricks you can ensure that no alternative KMS Activator can replace KMS38
Activation by accident or even on purpose. This script demonstrate how to do/undo that.
- Protect KMS38:
- How does KMS38 Protection work?
In the KMS activation method, the Windows Operating System first checks the KMS IP registered
as a specific KMS, and if that is not defined then it checks the Global KMS IP.
Another fact is that if LocalHost (127.0.0.2) is defined as KMS IP in the Windows 8.1 and 10 OS's
then Windows will not accept it as a valid KMS IP.
This script simply utilizes the above facts to protect the KMS38 activation from being
overwritten by any alternative 'normal' 180-Day KMS Activation.
Script steps-
- Check if Windows is activated with KMS38, if yes,
- Set that Windows edition specific KMS IP to LocalHost (127.0.0.2),
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f\XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
where X is Windows edition Activation ID.
- Lock this Registry with Reg_takeownership snippet by @AveYo aka @BAU
pastebin.com/XTPt0JSC
- Done.
- Unprotect KMS38:
- Just undo above steps,
- Give administrator full control of that mentioned registry key.
- Delete that registry key.
- Done.
=======================================================================================================