1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
|
@setlocal DisableDelayedExpansion
@echo off
:: =======================================================================================================
::
:: This script is a part of 'Microsoft Activation Scripts' project.
::
:: 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
::
:: =======================================================================================================
::========================================================================================================================================
cls
title Extract $OEM$ Folder
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
set "_psc=powershell"
set "nul=1>nul 2>nul"
set "EchoRed=%_psc% write-host -back Black -fore Red"
set "EchoGreen=%_psc% write-host -back Black -fore Green"
set "ELine=echo: & %EchoRed% ==== ERROR ==== &echo:"
::========================================================================================================================================
for %%i in (powershell.exe) do if "%%~$path:i"=="" (
echo: &echo ==== ERROR ==== &echo:
echo Powershell is not installed in the system.
echo Aborting...
goto Done
)
::========================================================================================================================================
if %winbuild% LSS 7600 (
%ELine%
echo Unsupported OS version Detected.
echo Project is supported only for Windows 7/8/8.1/10 and their Server equivalent.
goto Done
)
::========================================================================================================================================
:: Fix for the special characters limitation in path name
:: Written by @abbodi1406
set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
set "_batf=%~f0"
set "_batp=%_batf:'=''%"
setlocal EnableDelayedExpansion
::========================================================================================================================================
mode con cols=98 lines=30
:: Get correct Desktop Location with powershell
:: Written by @dcshoecomp (superuser.com)
:: https://superuser.com/a/1413170
for /f "delims=" %%a in ('%_psc% "& {write-host $([Environment]::GetFolderPath('Desktop'))}"') do Set "desktop=%%a"
if exist "%desktop%\$OEM$\" (
echo _____________________________________________________
%ELine%
echo $OEM$ folder already exists on the Desktop.
echo _____________________________________________________
goto Done2
)
set "_dir=%desktop%\$OEM$\$$\Setup\Scripts"
set _nofile=
set "_fdir1=Activators\HWID-KMS38_Activation"
set "HWID_Activation.cmd=%_fdir1%\HWID_Activation.cmd"
set "KMS38_Activation.cmd=%_fdir1%\KMS38_Activation.cmd"
set "ClipUp.exe=%_fdir1%\BIN\ClipUp.exe"
set "gatherosstate.exe=%_fdir1%\BIN\gatherosstate.exe"
set "slc.dll=%_fdir1%\BIN\slc.dll"
set "ARM64_gatherosstate.exe=%_fdir1%\BIN\ARM64_gatherosstate.exe"
set "ARM64_slc.dll=%_fdir1%\BIN\ARM64_slc.dll"
set "_fdir2=Activators\Online_KMS_Activation"
set "Activate.cmd=%_fdir2%\Activate.cmd"
set "Renewal_Setup.cmd=%_fdir2%\Renewal_Setup.cmd"
set "cleanosppx64.exe=%_fdir2%\BIN\cleanosppx64.exe"
set "cleanosppx86.exe=%_fdir2%\BIN\cleanosppx86.exe"
cd /d "!_work!"
pushd "!_work!"
cd ..
cd ..
if not exist "%HWID_Activation.cmd%" set _nofile=1
if not exist "%KMS38_Activation.cmd%" set _nofile=1
if not exist "%ClipUp.exe%" set _nofile=1
if not exist "%gatherosstate.exe%" set _nofile=1
if not exist "%slc.dll%" set _nofile=1
if not exist "%ARM64_gatherosstate.exe%" set _nofile=1
if not exist "%ARM64_slc.dll%" set _nofile=1
if not exist "%Activate.cmd%" set _nofile=1
if not exist "%Renewal_Setup.cmd%" set _nofile=1
if not exist "%cleanosppx64.exe%" set _nofile=1
if not exist "%cleanosppx86.exe%" set _nofile=1
if defined _nofile (
echo _____________________________________________________
%ELine%
echo Some files are missing in the 'Activators' folder.
echo _____________________________________________________
goto Done
)
::========================================================================================================================================
:Menu
cls
echo:
echo:
echo Extract the $OEM$ Folder on your desktop.
echo For more details use Read me.
echo _______________________________________________________
echo ^| ^|
echo ^| ^|
echo ^| [1] HWID ^|
echo ^| ^|
echo ^| [2] KMS38 ^|
echo ^| ^|
echo ^| [3] HWID, Fallback to KMS38 ^|
echo ^| ^|
echo ^| [4] Online KMS ^|
echo ^| ^|
echo ^| [5] HWID ^+ Online KMS ^|
echo ^| ^|
echo ^| [6] KMS38 ^+ Online KMS ^|
echo ^| ^|
echo ^| [7] HWID, Fallback to KMS38 ^+ Online KMS ^|
echo ^| ^|
echo ^| [8] Exit ^|
echo ^| ^|
echo ^|_______________________________________________________^|
echo:
choice /C:12345678 /N /M "> Enter Your Choice [1,2,3,4,5,6,7,8] : "
if errorlevel 8 exit /b
if errorlevel 7 goto:$OEM$HWID_FB_KMS38-KMS
if errorlevel 6 goto:$OEM$KMS38KMS
if errorlevel 5 goto:$OEM$HWIDKMS
if errorlevel 4 goto:$OEM$KMS
if errorlevel 3 goto:$OEM$HWID_FB_KMS38
if errorlevel 2 goto:$OEM$KMS38
if errorlevel 1 goto:$OEM$HWID
::========================================================================================================================================
:$OEM$HWID
cls
call :Prep
call :HWIDPrep
call :export HWIDSetup "%_dir%\SetupComplete.cmd"
set error_=
call :HWIDPrep2
if defined error_ goto ErrorFound
set "_oem=HWID"
goto Done
:HWIDSetup:
@echo off
reg query HKU\S-1-5-19 1>nul 2>nul || (
echo ==== Error ====
echo Right click on this file and select 'Run as administrator'
echo Press any key to exit...
pause >nul
exit /b
)
call "%~dp0HWID_Activation.cmd" /u
cd /d "%SystemRoot%\Setup\"
if exist "%SystemRoot%\Setup\Scripts\" @RD /S /Q "%SystemRoot%\Setup\Scripts\"
exit /b
:HWIDSetup:
::========================================================================================================================================
:$OEM$KMS38
cls
call :Prep
call :KMS38Prep
call :export KMS38Setup "%_dir%\SetupComplete.cmd"
set error_=
call :KMS38Prep2
if defined error_ goto ErrorFound
set "_oem=KMS38"
goto Done
:KMS38Setup:
@echo off
reg query HKU\S-1-5-19 1>nul 2>nul || (
echo ==== Error ====
echo Right click on this file and select 'Run as administrator'
echo Press any key to exit...
pause >nul
exit /b
)
call "%~dp0KMS38_Activation.cmd" /u
cd /d "%SystemRoot%\Setup\"
if exist "%SystemRoot%\Setup\Scripts\" @RD /S /Q "%SystemRoot%\Setup\Scripts\"
exit /b
:KMS38Setup:
::========================================================================================================================================
:$OEM$HWID_FB_KMS38
cls
call :Prep
copy /y /b "%HWID_Activation.cmd%" "%_dir%\HWID_Activation.cmd" %nul%
call :KMS38Prep
call :export HWID_FB_KMS38 "%_dir%\SetupComplete.cmd"
set error_=
If not exist "%_dir%\HWID_Activation.cmd" (set error_=1)
call :KMS38Prep2
if defined error_ goto ErrorFound
set "_oem=HWID`, Fallback to KMS38"
goto Done
:HWID_FB_KMS38:
@echo off
setlocal EnableDelayedExpansion
reg query HKU\S-1-5-19 1>nul 2>nul || (
echo ==== Error ====
echo Right click on this file and select 'Run as administrator'
echo Press any key to exit...
pause >nul
exit /b
)
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
:: Check Windows Edition
set osedition=
for /f "tokens=2 delims==" %%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and PartialProductKey is not NULL) get LicenseFamily /VALUE" 2^>nul') do if not errorlevel 1 set "osedition=%%a"
if not defined osedition for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition 2^>nul ^| find /i "Current Edition :"') do set "osedition=%%a"
:: Check Installation type
set instype=
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v InstallationType 2^>nul') do if not errorlevel 1 set "instype=%%b"
set KMS38=
if "%winbuild%" GEQ "17763" if "%osedition%"=="EnterpriseS" set KMS38=1
if "%winbuild%" GEQ "17763" if "%osedition%"=="EnterpriseSN" set KMS38=1
if "%osedition%"=="EnterpriseG" set KMS38=1
if "%osedition%"=="EnterpriseGN" set KMS38=1
if not "%instype%"=="Client" echo %osedition%| findstr /I /B Server 1>nul && set KMS38=1
if defined KMS38 (
call "%~dp0KMS38_Activation.cmd" /u
) else (
call "%~dp0HWID_Activation.cmd" /u
)
cd /d "%SystemRoot%\Setup\"
if exist "%SystemRoot%\Setup\Scripts\" @RD /S /Q "%SystemRoot%\Setup\Scripts\"
exit /b
:HWID_FB_KMS38:
::========================================================================================================================================
:$OEM$KMS
cls
call :Prep
call :KMSPrep
call :export KMSSetup "%_dir%\SetupComplete.cmd"
set error_=
call :KMSPrep2
if defined error_ goto ErrorFound
set "_oem=Online KMS"
goto Done
:KMSSetup:
@echo off
============================================================================
:: Change value from 1 to 0 to disable KMS Renewal And Activation Task
set Renewal_And_Activation_Task=1
:: Change value from 1 to 0 to disable KMS activation desktop context menu
set Desktop_context_menu=1
============================================================================
reg query HKU\S-1-5-19 1>nul 2>nul || (
echo ==== Error ====
echo Right click on this file and select 'Run as administrator'
echo Press any key to exit...
pause >nul
exit /b
)
if %Renewal_And_Activation_Task% EQU 1 call "%~dp0Renewal_Setup.cmd" /rat
if %Desktop_context_menu% EQU 1 call "%~dp0Renewal_Setup.cmd" /dcm
cd /d "%SystemRoot%\Setup\"
if exist "%SystemRoot%\Setup\Scripts\" @RD /S /Q "%SystemRoot%\Setup\Scripts\"
exit /b
:KMSSetup:
::========================================================================================================================================
:$OEM$HWIDKMS
cls
call :Prep
call :HWIDPrep
call :KMSPrep
call :export HWIDKMSSetup "%_dir%\SetupComplete.cmd"
set error_=
call :HWIDPrep2
call :KMSPrep2
if defined error_ goto ErrorFound
set "_oem=HWID `+ Online KMS"
goto Done
:HWIDKMSSetup:
@echo off
============================================================================
:: Change value from 1 to 0 to disable KMS Renewal And Activation Task
set Renewal_And_Activation_Task=1
:: Change value from 1 to 0 to disable KMS activation desktop context menu
set Desktop_context_menu=1
============================================================================
reg query HKU\S-1-5-19 1>nul 2>nul || (
echo ==== Error ====
echo Right click on this file and select 'Run as administrator'
echo Press any key to exit...
pause >nul
exit /b
)
call "%~dp0HWID_Activation.cmd" /u
if defined HWIDAct set SkipWinAct=/swa
if %Renewal_And_Activation_Task% EQU 1 call "%~dp0Renewal_Setup.cmd" /rat %SkipWinAct%
if %Desktop_context_menu% EQU 1 call "%~dp0Renewal_Setup.cmd" /dcm %SkipWinAct%
cd /d "%SystemRoot%\Setup\"
if exist "%SystemRoot%\Setup\Scripts\" @RD /S /Q "%SystemRoot%\Setup\Scripts\"
exit /b
:HWIDKMSSetup:
::========================================================================================================================================
:$OEM$KMS38KMS
cls
call :Prep
call :KMS38Prep
call :KMSPrep
call :export KMS38KMSSetup "%_dir%\SetupComplete.cmd"
set error_=
call :KMS38Prep2
call :KMSPrep2
if defined error_ goto ErrorFound
set "_oem=KMS38 `+ Online KMS"
goto Done
:KMS38KMSSetup:
@echo off
============================================================================
:: Change value from 1 to 0 to disable KMS Renewal And Activation Task
set Renewal_And_Activation_Task=1
:: Change value from 1 to 0 to disable KMS activation desktop context menu
set Desktop_context_menu=1
============================================================================
reg query HKU\S-1-5-19 1>nul 2>nul || (
echo ==== Error ====
echo Right click on this file and select 'Run as administrator'
echo Press any key to exit...
pause >nul
exit /b
)
call "%~dp0KMS38_Activation.cmd" /u
if %Renewal_And_Activation_Task% EQU 1 call "%~dp0Renewal_Setup.cmd" /rat
if %Desktop_context_menu% EQU 1 call "%~dp0Renewal_Setup.cmd" /dcm
cd /d "%SystemRoot%\Setup\"
if exist "%SystemRoot%\Setup\Scripts\" @RD /S /Q "%SystemRoot%\Setup\Scripts\"
exit /b
:KMS38KMSSetup:
::========================================================================================================================================
:$OEM$HWID_FB_KMS38-KMS
cls
call :Prep
copy /y /b "%HWID_Activation.cmd%" "%_dir%\HWID_Activation.cmd" %nul%
call :KMS38Prep
call :KMSPrep
call :export HWID_FB_KMS38-KMSSetup "%_dir%\SetupComplete.cmd"
set error_=
If not exist "%_dir%\HWID_Activation.cmd" (set error_=1)
call :KMS38Prep2
call :KMSPrep2
if defined error_ goto ErrorFound
set "_oem=HWID`, Fallback to KMS38 `+ Online KMS"
goto Done
:HWID_FB_KMS38-KMSSetup:
@echo off
============================================================================
:: Change value from 1 to 0 to disable KMS Renewal And Activation Task
set Renewal_And_Activation_Task=1
:: Change value from 1 to 0 to disable KMS activation desktop context menu
set Desktop_context_menu=1
============================================================================
setlocal EnableDelayedExpansion
reg query HKU\S-1-5-19 1>nul 2>nul || (
echo ==== Error ====
echo Right click on this file and select 'Run as administrator'
echo Press any key to exit...
pause >nul
exit /b
)
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
:: Check Windows Edition
set osedition=
for /f "tokens=2 delims==" %%a in ('"wmic path SoftwareLicensingProduct where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and PartialProductKey is not NULL) get LicenseFamily /VALUE" 2^>nul') do if not errorlevel 1 set "osedition=%%a"
if not defined osedition for /f "tokens=3 delims=: " %%a in ('DISM /English /Online /Get-CurrentEdition 2^>nul ^| find /i "Current Edition :"') do set "osedition=%%a"
:: Check Installation type
set instype=
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v InstallationType 2^>nul') do if not errorlevel 1 set "instype=%%b"
set KMS38=
if "%winbuild%" GEQ "17763" if "%osedition%"=="EnterpriseS" set KMS38=1
if "%winbuild%" GEQ "17763" if "%osedition%"=="EnterpriseSN" set KMS38=1
if "%osedition%"=="EnterpriseG" set KMS38=1
if "%osedition%"=="EnterpriseGN" set KMS38=1
if not "%instype%"=="Client" echo %osedition%| findstr /I /B Server 1>nul && set KMS38=1
if defined KMS38 (
call "%~dp0KMS38_Activation.cmd" /u
) else (
call "%~dp0HWID_Activation.cmd" /u
if defined HWIDAct set SkipWinAct=/swa
)
if %Renewal_And_Activation_Task% EQU 1 call "%~dp0Renewal_Setup.cmd" /rat %SkipWinAct%
if %Desktop_context_menu% EQU 1 call "%~dp0Renewal_Setup.cmd" /dcm %SkipWinAct%
cd /d "%SystemRoot%\Setup\"
if exist "%SystemRoot%\Setup\Scripts\" @RD /S /Q "%SystemRoot%\Setup\Scripts\"
exit /b
:HWID_FB_KMS38-KMSSetup:
::========================================================================================================================================
:ErrorFound
%ELine%
echo $OEM$ Folder was not created successfully...
goto :Done2
:Done
echo ________________________________________________________________________________________________
echo:
%EchoGreen% %_oem% `$OEM`$ folder is successfully created on the Desktop.
echo ________________________________________________________________________________________________
:Done2
echo:
echo Press any key to exit...
pause >nul
exit /b
::========================================================================================================================================
:Prep
cd /d "%desktop%"
md "%desktop%\$OEM$\$$\Setup\Scripts\"
md "%desktop%\$OEM$\$$\Setup\Scripts\BIN"
cd /d "!_work!"
pushd "!_work!"
cd ..
cd ..
exit /b
:HWIDPrep
copy /y /b "%HWID_Activation.cmd%" "%_dir%\HWID_Activation.cmd" %nul%
copy /y /b "%gatherosstate.exe%" "%_dir%\BIN\gatherosstate.exe" %nul%
copy /y /b "%slc.dll%" "%_dir%\BIN\slc.dll" %nul%
copy /y /b "%ARM64_gatherosstate.exe%" "%_dir%\BIN\ARM64_gatherosstate.exe" %nul%
copy /y /b "%ARM64_slc.dll%" "%_dir%\BIN\ARM64_slc.dll" %nul%
exit /b
:KMS38Prep
copy /y /b "%KMS38_Activation.cmd%" "%_dir%\KMS38_Activation.cmd" %nul%
copy /y /b "%ClipUp.exe%" "%_dir%\BIN\ClipUp.exe" %nul%
copy /y /b "%gatherosstate.exe%" "%_dir%\BIN\gatherosstate.exe" %nul%
copy /y /b "%slc.dll%" "%_dir%\BIN\slc.dll" %nul%
copy /y /b "%ARM64_gatherosstate.exe%" "%_dir%\BIN\ARM64_gatherosstate.exe" %nul%
copy /y /b "%ARM64_slc.dll%" "%_dir%\BIN\ARM64_slc.dll" %nul%
exit /b
:KMSPrep
copy /y /b "%Activate.cmd%" "%_dir%\Activate.cmd" %nul%
copy /y /b "%Renewal_Setup.cmd%" "%_dir%\Renewal_Setup.cmd" %nul%
copy /y /b "%cleanosppx64.exe%" "%_dir%\BIN\cleanosppx64.exe" %nul%
copy /y /b "%cleanosppx86.exe%" "%_dir%\BIN\cleanosppx86.exe" %nul%
exit /b
:HWIDPrep2
If not exist "%_dir%\HWID_Activation.cmd" (set error_=1)
If not exist "%_dir%\BIN\gatherosstate.exe" (set error_=1)
If not exist "%_dir%\BIN\slc.dll" (set error_=1)
If not exist "%_dir%\BIN\ARM64_gatherosstate.exe" (set error_=1)
If not exist "%_dir%\BIN\ARM64_slc.dll" (set error_=1)
If not exist "%_dir%\SetupComplete.cmd" (set error_=1)
exit /b
:KMS38Prep2
If not exist "%_dir%\KMS38_Activation.cmd" (set error_=1)
If not exist "%_dir%\BIN\ClipUp.exe" (set error_=1)
If not exist "%_dir%\BIN\gatherosstate.exe" (set error_=1)
If not exist "%_dir%\BIN\slc.dll" (set error_=1)
If not exist "%_dir%\BIN\ARM64_gatherosstate.exe" (set error_=1)
If not exist "%_dir%\BIN\ARM64_slc.dll" (set error_=1)
If not exist "%_dir%\SetupComplete.cmd" (set error_=1)
exit /b
:KMSPrep2
If not exist "%_dir%\Activate.cmd" (set error_=1)
If not exist "%_dir%\Renewal_Setup.cmd" (set error_=1)
If not exist "%_dir%\BIN\cleanosppx64.exe" (set error_=1)
If not exist "%_dir%\BIN\cleanosppx86.exe" (set error_=1)
If not exist "%_dir%\SetupComplete.cmd" (set error_=1)
exit /b
::========================================================================================================================================
:: Extract the text from batch script without character and file encoding issue
:: Thanks to @abbodi1406
:export
%nul% %_psc% "$f=[io.file]::ReadAllText('!_batp!') -split \":%~1\:.*`r`n\"; [io.file]::WriteAllText('%~2',$f[1].Trim(),[System.Text.Encoding]::ASCII);" &exit/b
::========================================================================================================================================
|