-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathEzWindSLIC_3.62f_AIO.cmd
8561 lines (8544 loc) · 525 KB
/
EzWindSLIC_3.62f_AIO.cmd
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
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- : Begin batch script
@echo off
color 0f
setlocal EnableDelayedExpansion
:: Fix for special characters in file name by @abbodi1406
setlocal DisableDelayedExpansion
set "work=%~dp0"
if [%work:~-1%]==[\] set "work=%work:~0,-1%"
setlocal EnableDelayedExpansion
pushd "!work!"
(
echo Set strArg=WScript.Arguments.Named
echo Set strRdlproc = CreateObject^("WScript.Shell"^).Exec^("rundll32 kernel32,Sleep"^)
echo With GetObject^("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" ^& strRdlproc.ProcessId ^& "'"^)
echo With GetObject^("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" ^& .ParentProcessId ^& "'"^)
echo If InStr ^(.CommandLine, WScript.ScriptName^) ^<^> 0 Then
echo strLine = Mid^(.CommandLine, InStr^(.CommandLine , "/File:"^) + Len^(strArg^("File"^)^) + 8^)
echo End If
echo End With
echo .Terminate
echo End With
echo CreateObject^("Shell.Application"^).ShellExecute "cmd.exe", "/c " ^& chr^(34^) ^& chr^(34^) ^& strArg^("File"^) ^& chr^(34^) ^& strLine ^& chr^(34^), "", "runas", 1
)>"%temp%\elev.vbs"
%systemroot%\system32\fsutil.exe dirty query %systemdrive% >nul 2>&1 || (
%systemroot%\System32\cscript.exe //nologo "%temp%\elev.vbs" /File:"!work!\%~nx0"
del "%temp%\elev.vbs" /f /q >nul 2>nul
exit /b
)
set "_path=!work!"
set "uiver=3.62f AIO"
set "batf=!work!\%~nx0"
if not exist "%systemroot%\temp" md "%systemroot%\temp" >nul 2>&1
if exist "%systemroot%\temp\ezwork" rd "%systemroot%\temp\ezwork" /s /q >nul 2>&1
md "%systemroot%\temp\ezwork" >nul 2>&1
set "work=%systemroot%\temp\ezwork"
title EzWindSLIC %uiver% by Dir3ctr1x
echo:
mode con cols=83 lines=34
:: Detect switches
set _args=%*
if not defined _args goto :noargs
set _args=%_args:"=%
set "install="
set "uninstall="
set "silent="
set "force="
set "profile="
set "norestart="
for %%A in (%_args%) do (
if /i "%%A"=="/install" (
set install=1
) else if /i "%%A"=="/uninstall" (
set uninstall=1
) else if /i "%%A"=="/silent" (
set silent=1
) else if /i "%%A"=="/force" (
set force=1
) else if /i "%%A"=="/norestart" (
set norestart=1
) else if /i "%%A"=="/profile" (
set profile=1
) else if /i "%%A"=="/version" (
set version=1
) else if /i "%%A"=="/pkey" (
set pkey=1
) else if /i "%%A"=="-install" (
set install=1
) else if /i "%%A"=="-uninstall" (
set uninstall=1
) else if /i "%%A"=="-silent" (
set silent=1
) else if /i "%%A"=="-force" (
set force=1
) else if /i "%%A"=="-norestart" (
set norestart=1
) else if /i "%%A"=="-profile" (
set profile=1
) else if /i "%%A"=="-version" (
set version=1
) else if /i "%%A"=="-pkey" (
set pkey=1
) else (
if defined profile (
echo %%A | find /i "." || (
echo %%A | find /i "-" || (
set "_customprofile=%%A"
)
)
)
if defined version (
echo %%A | find /i "." && set "_customver=%%A"
)
if defined pkey (
echo %%A | find /i "-" && set "_customkey=%%A"
)
)
)
cls
:noargs
for %%# in (powershell.exe) do if [%%~$PATH:#]==[] if not exist "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" (
call :colortxt 0c ERROR: /n
echo PowerShell is not installed in your system.
echo Install PowerShell and run this script again.
echo Would you like to install PowerShell?
echo Choose an option:
echo [Y]es
echo [N]o
choice /c yn /n /m "Enter your choice: "
set _errtemp=!errorlevel!
if /i [!_errtemp!]==[1] (
start "" https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
) else (
echo Press any key to exit...
pause >nul
)
exit /b
)
for %%# in (powershell.exe) do if not [%%~$PATH:#]==[] (
set "_psc="%%~$PATH:#" -nop -c"
set "_ps=%%~$PATH:#"
)
if not defined _psc (
set "_psc="%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -nop -c"
set "_ps=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"
)
:: Set buffer height
%_psc% "&{$H=get-host;$W=$H.ui.rawui;$B=$W.buffersize;$B.height=250;$W.buffersize=$B;}"
:: Declare some variables for convenience
set "red=0c"
set "green=0a"
set "_csc=%systemroot%\System32\cscript.exe //nologo"
set "_slm=%_csc% %systemroot%\System32\slmgr.vbs"
set "_wmi=%_csc% //job:WMI"
set "_wmi1=%_csc% //job:WMI1"
set "_wact=%_csc% //job:ATO"
set "_ipk=%_csc% //job:IPK"
set "_ilc=%_csc% //job:ILC"
set "_refrsh=%_csc% //job:refresh"
set "_xpr=%_csc% //job:XPR"
set "_nul=1>nul 2>nul"
set "_eline=call :colortxt %red% ERROR: /n"
set "_bcd=%systemroot%\System32\bcdedit.exe"
set "_pak=echo Press any key to exit... & pause %_nul% & goto exit"
set "_reb=%systemroot%\System32\shutdown.exe -r -t 00 %_nul%"
set "_sht=%systemroot%\System32\shutdown.exe -s -t 00 %_nul%"
set "_slp=SoftwareLicensingProduct"
set "_sls=SoftwareLicensingService"
set "_wApp=55c92734-d682-4d71-983e-d6ec3f16059f"
if defined silent set "_pak=goto exit"
if defined norestart set "_reb=echo You selected no restart option. Windows will not be rebooted"
echo Please wait...
echo Extracting files...
call :export "wsf" > "!work!\file.wsf"
set "batw=!work!\file.wsf"
%_csc% "!batw!" //job:B64DEC %_nul%
%_csc% "!batw!" //job:B64DEC /id:"base64cab" /InFile:"!batf!" /OutFile:"!work!\files.cab" %_nul%
%systemroot%\system32\expand.exe -r "!work!\files.cab" -F:* "!work!" %_nul%
echo Running WMI queries...
call :chkvalues
if not exist "!work!\bin" (
%_eline%
echo Failed to extract files.
%_pak%
)
if defined install (
call :install
goto exit
)
if defined uninstall (
call :uninstall
goto exit
)
:mainmenu
cls
if not defined install if not defined uninstall (
echo:
echo:
echo:
echo EzWindSLIC %uiver% by Dir3ctr1x
echo _______________________________________________________________
echo ^| Installation options: ^|
echo ^| [I] Install ^|
echo ^| ^|
echo ^| [U] Uninstall ^|
echo ^|_______________________________________________________________^|
echo ^| Help and support: ^|
echo ^| [R] Read-me ^|
echo ^| ^|
echo ^| [S] Support thread on MDL ^|
echo ^| ^|
echo ^| [X] Discord Server ^|
echo ^| ^|
echo ^| [G] Github repo ^|
echo ^|_______________________________________________________________^|
echo ^| Configuration: ^|
if defined force (
call :colortxt 0f " |"
call :colortxt 0e " [F] Forceful mode: [On] "
call :colortxt 0f "|" /n
) else (
echo ^| [F] Forceful mode: [Off] ^|
)
echo ^|_______________________________________________________________^|
echo ^| Miscellaneous: ^|
echo ^| [D] Display Activation Status ^|
echo ^| ^|
echo ^| [C] Create $OEM$ Folder ^|
echo ^| ^|
echo ^| [V] View SLIC table ^|
echo ^|_______________________________________________________________^|
echo:
set "_errtemp="
choice /c iursxgfdcve /n /m "Enter your choice, or press E to exit: "
set _errtmp=!errorlevel!
if /i [!_errtmp!]==[1] call :install
if /i [!_errtmp!]==[2] call :uninstall
if /i [!_errtmp!]==[3] start "%systemroot%\notepad.exe" "!work!\bin\readme.txt"
if /i [!_errtmp!]==[4] start "" https://forums.mydigitallife.net/threads/tool-ezwindslic-easily-activate-windows-7-vista-server-2008-2019-on-uefi-gpt.83357/
if /i [!_errtmp!]==[5] start "" https://discord.gg/gyhtVhhwnN
if /i [!_errtmp!]==[6] start "" https://www.github.com/Dir3ctr1x/EzWindSLIC
if /i [!_errtmp!]==[7] call :toggleforce
if /i [!_errtmp!]==[8] call :dispstat2usr
if /i [!_errtmp!]==[9] call :createoem
if /i [!_errtmp!]==[10] call :view
if /i [!_errtmp!]==[11] goto fullexit
) else exit /b
goto mainmenu
:toggleforce
if defined force (
set "force="
) else (
set "force=1
)
exit /b
:install
cls
set "_missingfiles="
for %%# in (WindSLIC.efi fallbackkeys.ini keys.ini acpidump.exe key.txt sku.ini translate.ini grkeys.ini nt10keys.ini nt10grkeys.ini readme.txt) do (if not exist "!work!\bin\%%#" (if defined _missingfiles (set "_missingfiles=!_missingfiles!, %%#") else (set "_missingfiles=%%#")))
if defined _missingfiles (
%_eline%
echo Failed to extract the following files:
echo %_missingfiles%
%_pak%
)
set "_slictobeinstalled=DELL"
call :chkvalues
call :dispstat
if /i [%LicenseStatus%]==[1] if /i [%GracePeriodRemaining%]==[0] if not defined force (
call :colortxt %green% "Windows is already permanently activated." /n
echo Running this script is unnecessary.
if defined silent goto exit
set "_errtemp="
echo Choose an option:
echo [C]ontinue
echo [E]xit
choice /c ce /n /m "Enter your choice: "
set _errtemp=!errorlevel!
if /i [!_errtemp!]==[2] (
goto mainmenu
)
)
%_bcd% -enum {current} | find /i ".efi" %_nul% || (
%_eline%
echo Your system is booted into BIOS/MBR mode.
echo Please use alternative activation exploits, such as Windows Loader by Daz to activate.
%_pak%
)
if not [%PROCESSOR_ARCHITECTURE%]==[AMD64] (
%_eline%
echo Your OS architecture is not AMD64.
echo Install 64-bit Windows and try again.
%_pak%
)
if defined _secuboot (
%_eline%
echo Secure boot is enabled.
echo Disable it and then run the script again.
%_pak%
)
for /f "usebackq eol=; delims=" %%# in ("!work!\bin\fallbackkeys.ini") do for /f "tokens=1-4 delims=:" %%A in ("%%#") do if /i [%osver%]==[%%A] if /i [%ostype%]==[%%B] if /i [%osedition%]==[%%C] set "key=%%D"
for /f "usebackq eol=; delims=" %%# in ("!work!\bin\nt10keys.ini") do for /f "tokens=1-5 delims=:" %%A in ("%%#") do if /i [%osver%]==[%%A] if /i %osbuild% GEQ %%B if /i [%ostype%]==[%%C] if /i [%osedition%]==[%%D] set "key=%%E"
echo:
if [%_eval%]==[1] (
%_eline%
echo Your OS is an evaluation copy.
echo Activating evaluation OSes is not supported.
echo Please reinstall a non-evaluation OS.
echo Would you like to download genuine installation media for non-evaluation Windows?
if defined silent goto exit
set "_errtemp="
echo Choose an option:
echo [Y]es
echo [N]o
choice /c yn /n /m "Enter your choice: "
set _errtemp=!errorlevel!
if /i [!_errtemp!]==[1] (
start "" https://pastebin.com/raw/jduBSazJ
)
%_pak%
)
if not defined key (
%_eline%
echo Your OS isn't supported.
echo Please use alternative activation exploits.
echo Would you like to see a list of all operating systems and their possible activation exploits?
if defined silent goto exit
set "_errtemp="
echo Choose an option:
echo [Y]es
echo [N]o
choice /c yn /n /m "Enter your choice: "
set _errtemp=!errorlevel!
if /i [!_errtemp!]==[1] (
start "" https://forums.mydigitallife.net/threads/windows-10-activation-in-vm.80712/#post-1656042
)
%_pak%
)
call :mntesp
if exist "%_ltr%\EFI\WindSLIC" (
echo WindSLIC is already installed.
echo If you are facing trouble activating your OS, choose the Uninstall option to uninstall WindSLIC before trying again.
%_pak%
)
if defined _slicexist (
for %%# in (
6.0:0
6.1:1
6.2:2
6.3:3
) do for /f "tokens=1-2 delims=:" %%A in ("%%#") do if /i [!osver!]==[%%A] set "_expctslicveroffst=%%B"
for %%# in (
10.0:14393:4
10.0:17763:5
10.0:20348:6
) do for /f "tokens=1-3 delims=:" %%A in ("%%#") do if /i [!osver!]==[%%A] if !osbuild! GEQ %%B set "_expctslicveroffst=%%C"
if /i !_slicveroffset! GEQ !_expctslicveroffst! if exist "!work!\bin\!_detectedslicver!\!_slicvendor!\cert.xrm-ms" if not defined force call :insert & exit /b
)
if defined _slicexist if defined _slicinvalid if not defined force (
%_eline%
echo SLIC found, but the SLIC is invalid.
echo You can try to enable forceful mode through the main menu and choose the install option again, but it will probably not work.
echo Alternatively, you can try a BIOS mod to unlock the full SLIC.
echo Would you like to open the BIOS mods forum on MDL to make a request to have your BIOS modded?
if defined silent goto exit
set "_errtemp="
echo Choose an option:
echo [Y]es
echo [N]o
choice /c yn /n /m "Enter your choice: "
set _errtemp=!errorlevel!
if /i [!_errtemp!]==[1] (
start "" https://forums.mydigitallife.net/forums/bios-mod-requests-post-requests-only.33
)
%_pak%
)
if defined _slicexist if not exist "!work!\bin\!_detectedslicver!\!_slicvendor!\cert.xrm-ms" if not defined force (
%_eline%
echo SLIC found, but there is no certificate present for it.
echo You can try to enable forceful mode through the main menu and choose the install option again, but it will probably not work.
echo Alternatively, you can try a BIOS mod to add a supported SLIC to your motherboard.
echo Would you like to open the BIOS mods forum on MDL to make a request to have your BIOS modded?
if defined silent goto exit
set "_errtemp="
echo Choose an option:
echo [Y]es
echo [N]o
choice /c yn /n /m "Enter your choice: "
set _errtemp=!errorlevel!
if /i [!_errtemp!]==[1] (
start "" https://forums.mydigitallife.net/forums/bios-mod-requests-post-requests-only.33
)
%_pak%
)
if defined _slicexist if exist "!work!\bin\!_detectedslicver!\!_slicvendor!\cert.xrm-ms" if !_slicveroffset! LSS !_expctslicveroffst! if not defined force (
%_eline%
echo SLIC found, but SLIC version is too low.
echo You can try to enable forceful mode through the main menu and choose the install option again, but it will probably not work.
echo Alternatively, you can try a BIOS mod to have the SLIC upgraded to version 2.!_expctslicveroffst!.
echo Would you like to open the BIOS mods forum on MDL to make a request to have your BIOS modded?
if defined silent goto exit
set "_errtemp="
echo Choose an option:
echo [Y]es
echo [N]o
choice /c yn /n /m "Enter your choice: "
set _errtemp=!errorlevel!
if /i [!_errtemp!]==[1] (
start "" https://forums.mydigitallife.net/forums/bios-mod-requests-post-requests-only.33
)
%_pak%
)
for %%# in (
6.0:2.0
6.1:2.1
6.2:2.2
6.3:2.3
) do for /f "tokens=1-2 delims=:" %%A in ("%%#") do if /i [%osver%]==[%%A] set "_slicvertobeinstalled=%%B"
for %%# in (
10.0:14393:2.4
10.0:17763:2.5
10.0:20348:2.6
) do for /f "tokens=1-3 delims=:" %%A in ("%%#") do if /i [%osver%]==[%%A] if %osbuild% GEQ %%B set "_slicvertobeinstalled=%%C"
if defined _customver if exist "!work!\bin\%_customver%\DELL" set "_slicvertobeinstalled=%_customver%"
if not defined _slicvertobeinstalled (
%_eline%
echo Your OS isn't supported.
echo Please use alternative activation exploits.
%_pak%
)
if exist "!work!\bin\%_slicvertobeinstalled%\%_facp%\slic.bin" if exist "!work!\bin\%_slicvertobeinstalled%\%_facp%\cert.xrm-ms" set "_slictobeinstalled=%_facp%"
if defined _customprofile (
if exist "!work!\bin\%_slicvertobeinstalled%\%_customprofile%\slic.bin" set "_slictobeinstalled=%_customprofile%"
)
echo:
echo The following profile will be installed: [%_slictobeinstalled%]
if not defined silent if not defined _customprofile (
set "_errtemp="
echo Choose an option:
echo [U]se this profile
echo [C]hoose another profile
choice /c uc /n /m "Enter your choice: "
set "_errtemp=!errorlevel!"
if [!_errtemp!]==[2] call :askslic
)
set "_slictobeinstalledcompany=%_slictobeinstalled%"
for /f "usebackq eol=;" %%# in ("!work!\bin\translate.ini") do for /f "tokens=1-2 eol=; delims=:" %%A in ("%%#") do if /i [%_slictobeinstalled%]==[%%A] set _slictobeinstalledcompany=%%B
if not [%_channel%]==[OEM_SLP] call :instkey
if [%_channel%]==[OEM_SLP] if defined force call :instkey
echo Installing certificate...
%_ilc% "!batw!" "!work!\bin\%_slicvertobeinstalled%\%_slictobeinstalled%\cert.xrm-ms" %_nul%
if [%errorlevel%]==[0] (
call :colortxt %green% "Successful" /n
) else (
call :colortxt %red% "Unsuccessful" /n
)
echo:
echo Copying files...
md %_ltr%\EFI\WindSLIC %_nul%
copy /y "!work!\bin\WindSLIC.efi" %_ltr%\EFI\WindSLIC %_nul%
copy /y "!work!\bin\%_slicvertobeinstalled%\%_slictobeinstalled%\slic.BIN" %_ltr%\EFI\WindSLIC %_nul%
copy /y "!work!\bin\key.txt" %_ltr%\EFI\WindSLIC %_nul%
echo:
echo Installing bootloader...
%_bcd% /store "%_ltr%\EFI\Microsoft\Boot\BCD" /set {bootmgr} PATH \EFI\WindSLIC\WindSLIC.efi %_nul%
%_bcd% /set {bootmgr} PATH \EFI\WindSLIC\WindSLIC.efi
if defined silent %_reb% & goto exit
if defined norestart goto exit
echo:
echo [R]eboot
echo [S]hutdown
echo [E]xit
set "_errtemp="
choice /c rse /n /m "Enter your choice: "
set "_errtemp=!errorlevel!"
if /i [!_errtemp!]==[1] %_reb%
if /i [!_errtemp!]==[2] %_sht%
if /i [!_errtemp!]==[3] goto mainmenu
exit /b
:uninstall
cls
call :dispstat
call :mntesp
if not exist "%_ltr%\EFI\WindSLIC" (
echo WindSLIC is not installed.
%_pak%
)
for /f "usebackq eol=; delims=" %%# in ("!work!\bin\grkeys.ini") do for /f "tokens=1-4 delims=:" %%A in ("%%#") do if /i [%osver%]==[%%A] if /i [%ostype%]==[%%B] if /i [%osedition%]==[%%C] set "grkey=%%D"
for /f "usebackq eol=; delims=" %%# in ("!work!\bin\nt10grkeys.ini") do for /f "tokens=1-5 delims=:" %%A in ("%%#") do if /i [%osver%]==[%%A] if /i %osbuild% GEQ %%B if /i [%ostype%]==[%%C] if /i [%osedition%]==[%%D] set "grkey=%%E"
if defined grkey call :grkey
echo Uninstalling bootloader...
%_bcd% /store "%_ltr%\EFI\Microsoft\Boot\BCD" /set {bootmgr} PATH \EFI\Microsoft\Boot\bootmgfw.efi %_nul%
%_bcd% /set {bootmgr} PATH \EFI\Microsoft\Boot\bootmgfw.efi
echo Removing WindSLIC...
rd %_ltr%\EFI\WindSLIC /s /q %_nul%
if defined silent %_reb% & goto exit
if defined norestart goto exit
echo:
echo [R]eboot
echo [S]hutdown
echo [E]xit
set "_errtemp="
choice /c rse /n /m "Enter your choice: "
set "_errtemp=!errorlevel!"
if /i [!_errtemp!]==[1] %_reb%
if /i [!_errtemp!]==[2] %_sht%
if /i [!_errtemp!]==[3] goto mainmenu
exit /b
:dispstat2usr
call :dispstat
%_pak%
:createoem
cls
if exist "!_path!\$OEM$" (
%_eline%
echo $OEM$ folder already exists in the current directory.
%_pak%
)
md "!_path!\$OEM$\$$\Setup\Scripts" %_nul%
copy "!batf!" "!_path!\$OEM$\$$\Setup\Scripts" %_nul%
copy "!work!\bin\setupcomplete.cmd" "!_path!\$OEM$\$$\Setup\Scripts" %_nul%
if not exist "!_path!\$OEM$" (
%_eline%
echo Failed creating $OEM$ folder.
) else (
echo $OEM$ was successfully created in the current directory.
echo You can place the folder in the "sources" directory of Windows installation media/ISO to pre-activate.
)
%_pak%
:view
cls
pushd "!work!\bin"
acpidump.exe -s | find /i "ACPI: SLIC" || (
%_eline%
echo No SLIC found.
popd
%_pak%
)
set "slicnum=0"
for /f "tokens=* delims=" %%a in ('acpidump.exe -s ^| find /i "ACPI: SLIC"') do (
set /a slicnum=!slicnum!+1
)
echo %slicnum% SLIC(s) found.
if %slicnum% GTR 1 (
echo More than one SLIC table detected.
echo Due to limitations, information will only be printed for the first SLIC table.
)
for /f "tokens=4 delims=: " %%A in ('acpidump.exe -n SLIC 2^>nul ^| find /i "00E0:"') do set _svo=%%A
set dsv=2.!_svo:~-1!
if [%_svo:~0,1%]==[0] (
echo SLIC version is !dsv!.
) else (
echo Detected SLIC is invalid
)
echo Please wait, printing SLIC tables...
acpidump.exe -n SLIC
popd
%_pak%
:insert
echo:
pushd "%~dp0"
set "_slictobeinstalledcompany=%_slicvendor%"
for /f "usebackq eol=;" %%# in ("!work!\bin\translate.ini") do for /f "tokens=1-2 eol=; delims=:" %%A in ("%%#") do if /i [%_slicvendor%]==[%%A] set _slictobeinstalledcompany=%%B
echo Installing certificate...
%_ilc% "!batw!" "!work!\bin\!_detectedslicver!\%_slictobeinstalled%\cert.xrm-ms" %_nul%
if [%errorlevel%]==[0] (
call :colortxt %green% "Successful" /n
) else (
call :colortxt %red% "Unsuccessful" /n
)
call :instkey
echo Activating...
%_wact% "!batw!" %_nul%
if [%errorlevel%]==[0] (
call :colortxt %green% "Product activation successful." /n
) else (
call :colortxt %red% "Product activation failed." /n
)
popd
%_pak%
:dispstat
cls
echo Operating System: [%fullosname%]
echo OS Version: [%osver%]
echo OS Type: [%ostype%]
echo Architecture: [%PROCESSOR_ARCHITECTURE%]
echo OS Edition: [%osedition%]
echo OS Build: [%osbuildstr%]
if defined _channel echo Channel: [%_channel%]
call :colortxt 0f "License Status: ["
call :colortxt %_clr% "%_licstat%"
echo ]
if not [%LicenseStatusReason%]==[0] (
echo License Status Reason: [%_licreas%]
)
if defined _licstatmsg echo %_licstatmsg:}= %.
if not [%GracePeriodRemaining%]==[0] (
if not [%LicenseStatus%]==[1] (
echo Grace Period Remaining: [%GracePeriodRemaining% minute^(s^)/%_gprdays% day^(s^)]
) else (
echo Activation Expiration: [%GracePeriodRemaining% minute^(s^)/%_gprdays% day^(s^)]
)
)
if not [%GracePeriodRemaining%]==[0] (
if not [%LicenseStatus%]==[1] (
echo Grace Period Expires on: [%xpr%]
) else (
echo Activation Expires on: [%xpr%]
)
)
echo SKU Value: [%OperatingSystemSKU%]
if defined ID echo SKU ID: [%ID%]
echo Partial Product Key: [%_ppk%]
if [%_eval%]==[1] (
echo Evaluation: [Yes]
) else (
echo Evaluation: [No]
)
if defined _slicexist (
if defined _slicinvalid (
call :colortxt 0f "SLIC: [%_slicvendor% - "
call :colortxt 0c "INVALID"
echo ]
) else (
echo SLIC: [%_slicvendor% - v%_detectedslicver%]
)
)
echo Motherboard: [%_mobo%]
if defined _secuboot (
call :colortxt 0f "Secure Boot: ["
call :colortxt 0c "Enabled"
echo ]
)
echo:
exit /b
:chkvalues
:: Detect OS version
for /f "tokens=4,5 delims=[]. " %%G in ('ver') do set osver=%%G.%%H
:: Detect OS build
for /f "tokens=6 delims=[]. " %%L in ('ver') do set osbuild=%%L
if %osbuild% LSS 6000 (
%_eline%
echo You must be running minimum Windows Vista {build 6000} or Server 2008 RTM {build 6001} to use this script.
%_pak%
)
:: Detect if SLIC is already present (thanks to @Tito for great tip)
pushd "!work!"
".\bin\acpidump.exe" -s 2>nul | find /i "ACPI: SLIC" %_nul% && set _slicexist=1
cd ".\bin"
if defined _slicexist (
for /f "usebackq tokens=6 delims=(): " %%A in (`acpidump.exe -s 2^>nul ^| find "ACPI: SLIC"`) do set _slicvendor=%%A
)
if defined _slicexist (
for /f "tokens=4 delims=: " %%A in ('acpidump.exe -n SLIC 2^>nul ^| find /i "00E0:"') do set _slicveroffset=%%A
set _detectedslicver=2.!_slicveroffset:~-1!
)
set "_slicinvalid=1"
set "_slicfirstbyte=!_slicveroffset:~0,1!"
if defined _slicveroffset if [!_slicfirstbyte!]==[0] set "_slicinvalid="
for /f "usebackq tokens=6 delims=(): " %%A in (`acpidump.exe -s 2^>nul ^| find "ACPI: FACP"`) do set _facp=%%A
if /i [%_facp%]==[MSI] set "_facp=MSI_NB"
:: Detect OS edition
for /f "skip=2 tokens=2*" %%G in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID 2^>nul') do set "oseditionreg=%%H"
:: Detect OS name
for /f "skip=2 tokens=2*" %%G in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName 2^>nul') do set "fullosname=%%H"
:: Detect full build string
for /f "skip=2 tokens=2*" %%G in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v BuildLabEx 2^>nul') do set "osbuildstr=%%H"
:: Detect OS type by @abbodi1406
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
set ostype=Server
)
if not defined ostype set ostype=Client
:: Check if OS is evaluation by @abbodi1406
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" (
set _eval=1
)
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*EvalEdition~*.mum" (
set _eval=1
)
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*EvalCorEdition~*.mum" (
set _eval=1
)
pushd "%~dp0"
for /f "tokens=2 delims==" %%# in ('%_wmi1% "!batw!" "%_slp%" "ApplicationID='%_wApp%' and PartialProductKey is not null" "ID"') do set "ID=%%#"
if not defined ID (
set "LicenseStatus=0"
set "PartialProductKey=N/A"
set "_ppk=N/A"
set "LicenseStatusReason=3221549076"
set "GracePeriodRemaining=0"
set "Description=N/A"
)
for %%# in (LicenseStatus PartialProductKey LicenseStatusReason GracePeriodRemaining Description) do (
if not defined %%# (
for /f "tokens=* delims=" %%# in ('%_wmi1% "!batw!" "%_slp%" "ID='%ID%'" "%%#"') do set "%%#"
)
)
for %%# in (OperatingSystemSKU Caption) do (
for /f "tokens=* delims=" %%# in ('%_wmi% "!batw!" "Win32_OperatingSystem" "%%#"') do set "%%#"
)
if defined Caption set "fullosname=%Caption%"
if %osbuild% LSS 7600 (
set "fullosname=!fullosname:Microsoftr=Microsoft!"
set "fullosname=!fullosname:VistaT=Vista!"
set "fullosname=!fullosname:Serverr=Server!"
)
set "space= "
if [!fullosname:~-1!]==[!space!] set "fullosname=!fullosname:~0,-1!"
popd
for /f "usebackq eol=; delims=" %%# in ("!work!\bin\sku.ini") do for /f "tokens=1-2 delims=:" %%A in ("%%#") do if /i [%OperatingSystemSKU%]==[%%A] set "osedition=%%B"
if %osbuild% LSS 7600 if /i [%OperatingSystemSKU%]==[33] set "osedition=ServerSBSPrime"
for /f "delims=" %%# in ('dir /b %systemroot%\System32\??-??') do if exist "%systemroot%\System32\%%#\Licenses\_Default" set "locale=%%#"
if [%LicenseStatus%]==[0] (
set "_licstat=Unlicensed"
set "_clr=0c"
)
if [%LicenseStatus%]==[1] (
set "_licstat=Licensed"
set "_clr=0a"
)
if [%LicenseStatus%]==[2] (
set "_licstat=Initial grace period"
set "_clr=0e"
)
if [%LicenseStatus%]==[3] (
set "_licstat=Additional grace period"
set "_clr=0e"
)
if [%LicenseStatus%]==[4] (
set "_licstat=Non-genuine grace period"
set "_clr=0e"
)
if [%LicenseStatus%]==[5] (
set "_licstat=Notification"
set "_clr=0c"
)
if [%LicenseStatus%]==[6] (
set "_licstat=Extended grace period"
set "_clr=0e"
)
if not defined _licstat (
set "_licstat=Unavailable"
set "_clr=08"
)
set /a _gprdays=(GracePeriodRemaining+1440-1)/1440
cmd /c exit /b %LicenseStatusReason%
set _licreas=0x%=ExitCode%
for %%# in (
0x4004F00C:The}Software}Licensing}Service}reported}that}the}application}is}running}within}the}valid}grace}period
0x4004F00D:The}Software}Licensing}Service}reported}that}the}application}is}running}within}the}valid}out}of}tolerance}grace}period
0x4004F040:The}Software}Licensing}Service}reported}that}the}product}was}activated}but}the}owner}should}verify}the}Product}Use}Rights
0x4004F401:The}Software}Licensing}Service}reported}that}the}application}has}a}store}license
0xC004F001:The}Software}Licensing}Service}reported}an}internal}error
0xC004F007:The}Software}Licensing}Service}reported}that}the}license}could}not}be}found
0xC004F008:The}Software}Licensing}Service}reported}that}the}license}could}not}be}found
0xC004F009:The}Software}Licensing}Service}reported}that}the}grace}period}has}expired
0xC004F014:The}Software}Licensing}Service}reported}that}the}product}key}is}not}available
0xC004F035:The}Software}Licensing}Service}reported}that}the}computer}could}not}be}activated}with}a}Volume}license}product}key
0xC004F057:The}Software}Licensing}Service}reported}that}the}computer}BIOS}is}missing}a}required}license
0xC004F058:The}Software}Licensing}Service}reported}that}the}computer}BIOS}is}missing}a}required}license
0xC004F059:The}Software}Licensing}Service}reported}that}a}license}in}the}computer}BIOS}is}invalid
0xC004F200:The}Software}Licensing}Service}reported}that}current}state}is}not}genuine
) do for /f "delims=: tokens=1-2" %%A in ("%%#") do if /i [%_licreas%]==[%%A] set "_licstatmsg=%%B"
if not defined _ppk set _ppk=*****-*****-*****-*****-%PartialProductKey%
for /f "tokens=2 delims=," %%A in ("%Description%") do set "_channel=%%A"
for /f "tokens=1 delims= " %%A in ("%_channel%") do set "_channel=%%A"
if [%LicenseStatus%]==[0] set "_channel="
:: Detect motherboard
pushd "%~dp0"
for %%# in (manufacturer product) do (
for /f "tokens=* delims=" %%# in ('%_wmi% "!batw!" "Win32_BaseBoard" "%%#"') do set "%%#"
)
set "_mobo=%manufacturer% %product%"
if !osbuild! GEQ 9200 (
%_psc% Confirm-SecureBootUEFI 2>nul | find /i "True" %_nul% && (
set "_secuboot=1"
)
)
if not [%GracePeriodRemaining%]==0 for /f "tokens=* delims=" %%# in ('%_xpr% "!batw!" %GracePeriodRemaining%') do set "xpr=%%#"
popd
exit /b
:mntesp
echo:
for /f %%# in ('mountvol /? ^| find ":\"') do if exist %%#EFI\Microsoft\Boot\en-US\*.mui set _espalreadymount=%%#
if defined _espalreadymount (
echo EFI System Partition already mounted at %_espalreadymount%:
set _ltr=%_espalreadymount%
)
if not defined _espalreadymount for %%# in (Q W E R T Y U I O P A S D F G H J K L Z X C V B N M) do (mountvol /? | find /i "%%#:" %_nul% || set "_ltr=%%#:")
if not defined _espalreadymount (
mountvol %_ltr% /s %_nul%
if exist %_ltr%\EFI (
echo EFI System Partition successfully mounted at %_ltr%.
) else (
%_eline%
echo Failed to mount EFI System Partition at %_ltr%.
%_pak%
)
)
exit /b
:askslic
echo:
echo Available profiles:
for /f %%# in ('dir /b "!work!\bin\%_slicvertobeinstalled%" /o:N') do echo [%%#]
echo:
echo Refer to read-me to know which profile belongs to which brand.
echo:
set /p "_slicchc=Enter your choice, without brackets; for instance type ACRSYS to access the Acer profile: "
if [%_slicchc%]==[] set "_slicchc=blank"
if exist "!work!\bin\%_slicvertobeinstalled%\%_slicchc%" (
set "_slictobeinstalled=!_slicchc!"
) else (
echo Invalid selection; falling back to %_slictobeinstalled% profile.
)
echo:
exit /b
:instkey
pushd "%~dp0"
for /f "usebackq eol=; delims=" %%# in ("!work!\bin\fallbackkeys.ini") do for /f "tokens=1-4 delims=:" %%A in ("%%#") do if /i [%osver%]==[%%A] if /i [%ostype%]==[%%B] if /i [%osedition%]==[%%C] set "key=%%D"
for /f "usebackq eol=; delims=" %%# in ("!work!\bin\keys.ini") do for /f "tokens=1-5 delims=:" %%A in ("%%#") do if /i [%_slictobeinstalledcompany%]==[%%A] if /i [%osver%]==[%%B] if /i [%ostype%]==[%%C] if /i [%osedition%]==[%%D] set "key=%%E"
for /f "usebackq eol=; delims=" %%# in ("!work!\bin\nt10keys.ini") do for /f "tokens=1-5 delims=:" %%A in ("%%#") do if /i [%osver%]==[%%A] if /i %osbuild% GEQ %%B if /i [%ostype%]==[%%C] if /i [%osedition%]==[%%D] set "key=%%E"
if defined _customkey set "key=%_customkey%"
echo Installing OEM:SLP key [%key%]...
%_ipk% "!batw!" "%key%" %_nul%
if [%errorlevel%]==[0] (
call :colortxt %green% "Successful" /n
%_refrsh% "!batw!" %_nul%
) else (
call :colortxt %red% "Unsuccessful" /n
)
exit /b
:grkey
echo Installing generic key [!grkey!]...
pushd "%~dp0"
%_ipk% "!batw!" "%grkey%" %_nul%
if [%errorlevel%]==[0] (
call :colortxt %green% "Successful" /n
!_refrsh! "!batf!.wsf" %_nul%
) else (
call :colortxt %red% "Unsuccessful" /n
)
popd
exit /b
:colortxt
setlocal enabledelayedexpansion
set "hsh=%~2{#}"
if [%~3]==[/n] (
"!work!\bin\cecho.exe" {%~1}!hsh!{\n}
) else (
"!work!\bin\cecho.exe" {%~1}!hsh!
)
exit /b
:fullexit
rd "!work!" /s /q %_nul%
:exit
if not defined _espalreadymount (
cd /d %systemroot% >nul 2>&1
mountvol %_ltr% /d >nul 2>&1
)
if defined install rd "!work!" /s /q %_nul%
if defined uninstall rd "!work!" /s /q %_nul%
exit /b
:export
setlocal enabledelayedexpansion
set [=&for /f "delims=:" %%s in ('findstr/nbrc:":%~1:\[" /c:":%~1:\]" "%~f0"') do if defined [ (set/a ]=%%s-3) else set/a [=%%s-1
<"%~fs0" ((for /l %%i in (0 1 %[%) do set /p =)&for /l %%i in (%[% 1 %]%) do (set txt=&set /p txt=&echo(!txt!)) &exit/b
:wsf:[
<package>
<job id="WMI">
<script language="VBScript">
wExc = "Select " & WScript.Arguments.Item(1) & " from " & WScript.Arguments.Item(0)
Set objCol = GetObject("winmgmts:\\.\root\cimv2").ExecQuery(wExc,,48)
For Each objItm in objCol
For each Prop in objItm.Properties_
Wscript.Echo Prop.Name & "=" & Prop.Value
Next
Next
</script>
</job>
<job id="WMI1">
<script language="VBScript">
wExc = "Select " & WScript.Arguments.Item(2) & " from " & WScript.Arguments.Item(0) & " where " & WScript.Arguments.Item(1)
Set objCol = GetObject("winmgmts:\\.\root\cimv2").ExecQuery(wExc,,48)
For Each objItm in objCol
For each Prop in objItm.Properties_
Wscript.Echo Prop.Name & "=" & Prop.Value
Next
Next
</script>
</job>
<job id="ATO">
<script language="VBScript">
Set objCol = GetObject("WinMgmts:").ExecQuery("Select * From SoftwareLicensingProduct Where ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' And PartialProductKey is not NULL")
For Each objItm in objCol
objItm.ExecMethod_("Activate")
Next
WScript.Quit Err.Number
</script>
</job>
<job id="IPK">
<script language="VBScript">
On error resume next
pkey = Wscript.Arguments.Item(0)
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2").ExecQuery("SELECT Version FROM SoftwareLicensingService")
For each colService in objWMIService
Exit For
Next
set objService = colService
objService.InstallProductKey(pkey)
WScript.Quit Err.Number
</script>
</job>
<job id="ILC">
<script language="VBScript">
On error resume next
input = WScript.Arguments.Item(0)
strData = CreateObject("Scripting.FileSystemObject").OpenTextFile(input,1).ReadAll
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2").ExecQuery("SELECT Version FROM SoftwareLicensingService")
For each colService in objWMIService
Exit For
Next
set objService = colService
objService.InstallLicense(strData)
WScript.Quit Err.Number
</script>
</job>
<job id="refresh">
<script language="VBScript">
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set objCol = GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select Version from SoftwareLicensingService")
For Each objItm in objCol
slsver = objItm.Version
Next
qry = "SoftwareLicensingService.Version='" & slsver & "'"
Set objShare = objWMIService.Get(qry)
Set objOutParams = objWMIService.ExecMethod(qry, "RefreshLicenseStatus")
WScript.Quit Err.Number
</script>
</job>
<job id="XPR">
<script language="VBScript">
Wscript.Echo DateAdd("n", WScript.Arguments.Item(0), Now)
</script>
</job>
<job id="B64DEC">
<script language="VBScript">
Set strArg=WScript.Arguments.Named
colNamedArg= WScript.Arguments.Count
if colNamedArg < 1 then
Wscript.Echo "Switches:",vbCrLf,"/ID:<'<Identifier>'>",vbCrLf,"/InFile:<Source File>",vbCrLf,"/OutFile:[Output File]"
WScript.Quit 1
ElseIf Not strArg.Exists("ID") Then
Wscript.Echo "ERROR: Switch /ID:<'<Identifier>'> is missing."
WScript.Quit 1
ElseIf Not strArg.Exists("InFile") Then
Wscript.Echo "ERROR: Switch /InFile:<Source File> is missing."
WScript.Quit 1
ElseIf colNamedArg > 3 And Not strArg.Exists("OutFile") Then
WScript.Echo "Invalid parameters"
WScript.Quit 1
End If
Set outStream=CreateObject("ADODB.Stream") : outStream.Type = 1 : outStream.Open
Set oFS=CreateObject("Scripting.FileSystemObject")
Set inStream=oFS.OpenTextFile(strArg("InFile"),1,0,0)
Set oXML=CreateObject("MSXml2.DOMDocument")
Set oItem=oXML.createElement("tmp") : oItem.DataType="bin.base64"
Do Until inStream.AtEndOfStream
tmpStr = inStream.readline
If InStr(tmpStr, "<" & strArg("ID") & ">") > 0 Then
i=i+1
If i = 2 Then
Exit do
End If
Elseif i = 1 Then
oItem.text=tmpStr
decodedBytes=oItem.NodeTypedValue
outStream.Write decodedBytes
End If
Loop
If IsEmpty(decodedBytes) Then
If IsEmpty(i) Then
Wscript.Echo "ERROR: Identifier:'<" & strArg("ID") & ">' could not be found."
Else
Wscript.Echo "ERROR: Identifier:'<" & strArg("ID") & ">' seems to be empty."
End If
WScript.Quit 1
End if
If strArg.Exists("OutFile") Then
outStream.SaveToFile strArg("OutFile"),2
Else
outStream.Position = 0 : outStream.Type = 2 : outStream.CharSet = "us-ascii"
WScript.Echo outStream.ReadText
End If
inStream.close
outStream.close
</script>
</job>
</package>
:wsf:]
<base64cab>
TVNDRgAAAAACigUAAAAAACwAAAAAAAAAAwEBAHgCAAD6BwAAkmQAACwAAxUAVAUA
AAAAAAAAf1LBaCAAYmluXGFjcGlkdW1wLmV4ZQAAZgAAAFQFAAAAFz0ojyAAYmlu
XGNlY2hvLmV4ZQDWCQAAALoFAAAAwVLmWCAAYmluXGZhbGxiYWNra2V5cy5pbmkA