1
- @ set masver = 2.4
1
+ @ set masver = 2.5
2
2
@ setlocal DisableDelayedExpansion
3
3
@ echo off
4
4
5
5
6
- ::
6
+
7
7
:: ============================================================================
8
8
::
9
9
:: This script is a part of 'Microsoft_Activation_Scripts' (MAS) project.
@@ -230,7 +230,7 @@ echo ________________________________________________
230
230
echo You are running outdated version MAS %masver%
231
231
echo ________________________________________________
232
232
echo :
233
- echo [1] Download Latest MAS
233
+ echo [1] Get Latest MAS
234
234
echo [0] Continue Anyway
235
235
echo :
236
236
call :dk_color %_Green% " Enter a menu option in the Keyboard [1,0] :"
@@ -282,24 +282,7 @@ goto ced_done
282
282
283
283
:: ========================================================================================================================================
284
284
285
- :: Check SKU value
286
-
287
- set osSKU =
288
- set slcSKU =
289
- set wmiSKU =
290
-
291
- if %winbuild% GEQ 14393 (set info=Kernel-BrandingInfo) else (set info=Kernel-ProductInfo)
292
- set d1 = %ref% [void]$TypeBuilder.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 'Public, Static', 1, [int], @ ([String], [int].MakeByRefType()), 1, 3);
293
- set d1 = %d1% $Sku = 0; [void]$TypeBuilder.CreateType()::SLGetWindowsInformationDWORD('%info% ', [ref]$Sku); $Sku
294
- for /f " delims=" %%s in ('" %psc% %d1% " ') do if not errorlevel 1 (set slcSKU=%%s )
295
- if " %slcSKU% " == " 0" set slcSKU =
296
- if 1%slcSKU% NEQ +1%slcSKU% set slcSKU =
297
-
298
- if %_wmic% EQU 1 for /f " tokens=2 delims==" %%a in ('" wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6% ') do if not errorlevel 1 set " wmiSKU = %%a "
299
- if %_wmic% EQU 0 for /f " tokens=1" %%a in ('%psc% " ([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6% ') do if not errorlevel 1 set " wmiSKU = %%a "
300
-
301
- set osSKU = %slcSKU%
302
- if not defined osSKU set osSKU = %wmiSKU%
285
+ call :dk_checksku
303
286
304
287
if not defined osSKU (
305
288
%eline%
@@ -324,7 +307,7 @@ if not defined osedition (
324
307
for /f " skip=2 tokens=3" %%a in ('reg query " HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6% ') do set " osedition = %%a "
325
308
)
326
309
327
- :: Workaround for a Windows bug in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
310
+ :: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
328
311
329
312
if %osSKU% == 164 set osedition = ProfessionalEducation
330
313
if %osSKU% == 165 set osedition = ProfessionalEducationN
@@ -354,7 +337,10 @@ for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT
354
337
355
338
%psc% $ExecutionContext.SessionState.LanguageMode %nul2% | find /i " Full" %nul1% || (
356
339
%eline%
357
- echo PowerShell is not responding properly. Aborting...
340
+ %psc% $ExecutionContext.SessionState.LanguageMode
341
+ echo :
342
+ echo PowerShell is not working. Aborting...
343
+ echo If you have applied restrictions on Powershell then undo those changes.
358
344
echo :
359
345
echo Check this page for help. %mas% troubleshoot
360
346
goto ced_done
@@ -654,6 +640,31 @@ exit /b
654
640
655
641
:: ========================================================================================================================================
656
642
643
+ :: Check SKU value
644
+
645
+ :dk_checksku
646
+
647
+ set osSKU =
648
+ set slcSKU =
649
+ set wmiSKU =
650
+ set regSKU =
651
+
652
+ if %winbuild% GEQ 14393 (set info=Kernel-BrandingInfo) else (set info=Kernel-ProductInfo)
653
+ set d1 = %ref% [void]$TypeBuilder.DefinePInvokeMethod('SLGetWindowsInformationDWORD', 'slc.dll', 'Public, Static', 1, [int], @ ([String], [int].MakeByRefType()), 1, 3);
654
+ set d1 = %d1% $Sku = 0; [void]$TypeBuilder.CreateType()::SLGetWindowsInformationDWORD('%info% ', [ref]$Sku); $Sku
655
+ for /f " delims=" %%s in ('" %psc% %d1% " ') do if not errorlevel 1 (set slcSKU=%%s )
656
+ if " %slcSKU% " == " 0" set slcSKU =
657
+ if 1%slcSKU% NEQ +1%slcSKU% set slcSKU =
658
+
659
+ for /f " tokens=3 delims=." %%a in ('reg query " HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions" /v OSProductPfn %nul6% ') do set " regSKU = %%a "
660
+ if %_wmic% EQU 1 for /f " tokens=2 delims==" %%a in ('" wmic Path Win32_OperatingSystem Get OperatingSystemSKU /format:LIST" %nul6% ') do if not errorlevel 1 set " wmiSKU = %%a "
661
+ if %_wmic% EQU 0 for /f " tokens=1" %%a in ('%psc% " ([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6% ') do if not errorlevel 1 set " wmiSKU = %%a "
662
+
663
+ set osSKU = %slcSKU%
664
+ if not defined osSKU set osSKU = %wmiSKU%
665
+ if not defined osSKU set osSKU = %regSKU%
666
+ exit /b
667
+
657
668
:: Refresh license status
658
669
659
670
:dk_refresh
0 commit comments