dot-source scriptblock
This commit is contained in:
		| @@ -215,7 +215,7 @@ goto dk_done | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
| @@ -811,7 +811,7 @@ set notworking= | |||||||
| call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if defined allapps call :hwiddata key | if defined allapps call :hwiddata key | ||||||
| if not defined key ( | if not defined key ( | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';& ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';. ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a) | ||||||
| if defined altapplist call :hwiddata key | if defined altapplist call :hwiddata key | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -1225,7 +1225,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con | |||||||
| 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" | 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" | ||||||
| if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | ||||||
|  |  | ||||||
| if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | ||||||
| if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | ||||||
| set winsub=1 | set winsub=1 | ||||||
| set osSKU=%regSKU% | set osSKU=%regSKU% | ||||||
| @@ -1672,7 +1672,7 @@ call :dk_color2 %Red% "Checking WinPE                          " %Blue% "[WinPE | |||||||
|  |  | ||||||
| set wpainfo= | set wpainfo= | ||||||
| set wpaerror= | set wpaerror= | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | ||||||
| echo "%wpainfo%" | find /i "Error Found" %nul% && ( | echo "%wpainfo%" | find /i "Error Found" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set wpaerror=1 | set wpaerror=1 | ||||||
| @@ -1768,7 +1768,7 @@ call :dk_color %Gray% "Checking SLC/WMI SKU                    [Difference Found | |||||||
| reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set showfix=1 | set showfix=1 | ||||||
| call :dk_color %Red% "Checking Rearm                          [System is ReArmed]" | call :dk_color %Red% "Checking Rearm                          [System is Rearmed]" | ||||||
| call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -1864,7 +1864,7 @@ set showfix=1 | |||||||
| if not defined notwinact ( | if not defined notwinact ( | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| set "_notfoundids=Key Not Installed / Act ID Not Found" | set "_notfoundids=Key Not Installed / Act ID Not Found" | ||||||
| @@ -2898,7 +2898,7 @@ for %%# in ("!_oLPath!\%_License%*.xrm-ms") do ( | |||||||
| if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") | if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") | ||||||
| ) | ) | ||||||
|  |  | ||||||
| %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% | %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% | ||||||
|  |  | ||||||
| call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 | call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 | ||||||
| echo "!allapps!" | find /i "!_actid!" %nul1% || ( | echo "!allapps!" | find /i "!_actid!" %nul1% || ( | ||||||
| @@ -3410,8 +3410,8 @@ exit /b | |||||||
| :oh_licrefresh | :oh_licrefresh | ||||||
|  |  | ||||||
| if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( | if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( | ||||||
| %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| ) | ) | ||||||
| exit /b | exit /b | ||||||
|  |  | ||||||
| @@ -3747,7 +3747,7 @@ exit /b | |||||||
| :oh_extractdll | :oh_extractdll | ||||||
|  |  | ||||||
| set b= | set b= | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[System.IO.File]::ReadAllText('!_batp!') -split ':hexedit\:.*';& ([scriptblock]::Create($m[1]))" %nul2% | find /i "Error found" %nul1% && set hasherror=1 | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[System.IO.File]::ReadAllText('!_batp!') -split ':hexedit\:.*';. ([scriptblock]::Create($m[1]))" %nul2% | find /i "Error found" %nul1% && set hasherror=1 | ||||||
| exit /b | exit /b | ||||||
|  |  | ||||||
| :hexedit: | :hexedit: | ||||||
| @@ -4386,7 +4386,7 @@ if defined _vis goto :ts_winvista | |||||||
|  |  | ||||||
| set tempid= | set tempid= | ||||||
| if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero) | if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero) | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( | ||||||
| echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) | echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -4676,7 +4676,7 @@ goto :ts_esu | |||||||
| ) | ) | ||||||
|  |  | ||||||
| set resetstuff=1 | set resetstuff=1 | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
| set resetstuff= | set resetstuff= | ||||||
| if !errorlevel!==3 ( | if !errorlevel!==3 ( | ||||||
| set error=1 | set error=1 | ||||||
| @@ -5160,10 +5160,10 @@ if %winbuild% GEQ 10586 ( | |||||||
| for %%# in ("%SysPath%\spp\tokens\skus\%tsedition%\*CSVLK*.xrm-ms") do ( | for %%# in ("%SysPath%\spp\tokens\skus\%tsedition%\*CSVLK*.xrm-ms") do ( | ||||||
| if defined _arr (set "_arr=!_arr!;"%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") else (set "_arr="%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") | if defined _arr (set "_arr=!_arr!;"%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") else (set "_arr="%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") | ||||||
| ) | ) | ||||||
| if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul% | if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul% | ||||||
| ) | ) | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( | ||||||
| echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) | echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -5357,7 +5357,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock... | |||||||
| echo: | echo: | ||||||
|  |  | ||||||
| set resetstuff=1 | set resetstuff=1 | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
|  |  | ||||||
| if %errorlevel%==3 ( | if %errorlevel%==3 ( | ||||||
| call :dk_color %Red% "Reset Failed." | call :dk_color %Red% "Reset Failed." | ||||||
| @@ -5405,7 +5405,7 @@ if %errorlevel%==1 exit /b | |||||||
| echo: | echo: | ||||||
| echo Fetching Supported Activation IDs list. Please wait... | echo Fetching Supported Activation IDs list. Please wait... | ||||||
|  |  | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
| if %errorlevel%==3 ( | if %errorlevel%==3 ( | ||||||
| call :dk_color %Gray% "No supported activation ID found, aborting..." | call :dk_color %Gray% "No supported activation ID found, aborting..." | ||||||
| goto :dk_done | goto :dk_done | ||||||
| @@ -5554,7 +5554,7 @@ echo Writing TrustedStore data... | |||||||
| if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) | if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) | ||||||
| ) | ) | ||||||
| echo: | echo: | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids%" | ||||||
| if !errorlevel!==3 ( | if !errorlevel!==3 ( | ||||||
| if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") | if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") | ||||||
| set fixes=%fixes% %mas%troubleshoot | set fixes=%fixes% %mas%troubleshoot | ||||||
| @@ -5748,7 +5748,7 @@ echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=k | |||||||
| set keytype=zero | set keytype=zero | ||||||
| ) | ) | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( | ||||||
| echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) | echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) | ||||||
| ) | ) | ||||||
| set "_allactid=!tsids!" | set "_allactid=!tsids!" | ||||||
| @@ -14774,7 +14774,7 @@ mode 100, 36 | |||||||
| %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=35;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% | %psc% "&{$W=$Host.UI.RawUI.WindowSize;$B=$Host.UI.RawUI.BufferSize;$W.Height=35;$B.Height=300;$Host.UI.RawUI.WindowSize=$W;$Host.UI.RawUI.BufferSize=$B;}" %nul% | ||||||
| ) | ) | ||||||
|  |  | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
| goto dk_done | goto dk_done | ||||||
|  |  | ||||||
| :sppmgr: | :sppmgr: | ||||||
| @@ -16652,7 +16652,7 @@ call :_taskclear-cache | |||||||
|  |  | ||||||
| %nul% reg query "HKLM\%SPPk%\%_wApp%" && ( | %nul% reg query "HKLM\%SPPk%\%_wApp%" && ( | ||||||
| echo Removing KMS38 protection... | echo Removing KMS38 protection... | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
| %nul% reg delete "HKLM\%SPPk%\%_wApp%" /f | %nul% reg delete "HKLM\%SPPk%\%_wApp%" /f | ||||||
| %nul% reg query "HKLM\%SPPk%\%_wApp%" && ( | %nul% reg query "HKLM\%SPPk%\%_wApp%" && ( | ||||||
| call :dk_color %Red% "Failed to remove KMS38 protection." | call :dk_color %Red% "Failed to remove KMS38 protection." | ||||||
| @@ -16690,7 +16690,7 @@ echo Checking SPP permission related issues... | |||||||
| call :checkperms | call :checkperms | ||||||
| if defined permerror ( | if defined permerror ( | ||||||
| call :dk_color %Red% "[!permerror!]" | call :dk_color %Red% "[!permerror!]" | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';& ([scriptblock]::Create($f[1]))" %nul% | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';. ([scriptblock]::Create($f[1]))" %nul% | ||||||
| call :checkperms | call :checkperms | ||||||
| if defined permerror ( | if defined permerror ( | ||||||
| call :dk_color %Red% "[!permerror!] [Failed To Fix]" | call :dk_color %Red% "[!permerror!] [Failed To Fix]" | ||||||
| @@ -16760,8 +16760,8 @@ if defined _vis ( | |||||||
|  |  | ||||||
| echo: | echo: | ||||||
| echo Reinstalling system licenses... | echo Reinstalling system licenses... | ||||||
| %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| if %errorlevel% EQU 0 ( | if %errorlevel% EQU 0 ( | ||||||
| echo [Successful] | echo [Successful] | ||||||
| ) else ( | ) else ( | ||||||
| @@ -17380,7 +17380,7 @@ exit /b | |||||||
|  |  | ||||||
| :regownstart | :regownstart | ||||||
|  |  | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';& ([scriptblock]::Create($f[1]));" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';. ([scriptblock]::Create($f[1]));" | ||||||
| exit /b | exit /b | ||||||
|  |  | ||||||
| ::  Below code takes ownership of a volatile registry key and deletes it | ::  Below code takes ownership of a volatile registry key and deletes it | ||||||
| @@ -17553,7 +17553,7 @@ set _ntarget= | |||||||
| set _wtarget= | set _wtarget= | ||||||
|  |  | ||||||
| if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-TargetEditions ^| findstr /i /c:"Target Edition : "') do (if defined _dtarget (set "_dtarget= !_dtarget! %%a ") else (set "_dtarget= %%a ")) | if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-TargetEditions ^| findstr /i /c:"Target Edition : "') do (if defined _dtarget (set "_dtarget= !_dtarget! %%a ") else (set "_dtarget= %%a ")) | ||||||
| if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a ")) | if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a ")) | ||||||
|  |  | ||||||
| if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" ( | if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" ( | ||||||
| if %winbuild% GEQ 17063 call :ced_edilist | if %winbuild% GEQ 17063 call :ced_edilist | ||||||
| @@ -17759,7 +17759,7 @@ echo: | |||||||
| call :ced_prep | call :ced_prep | ||||||
| if defined preperror goto dk_done | if defined preperror goto dk_done | ||||||
|  |  | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';. ([scriptblock]::Create($f[1])) %targetedition% %key%" | ||||||
| call :ced_postprep | call :ced_postprep | ||||||
| ) | ) | ||||||
| %line% | %line% | ||||||
| @@ -17797,7 +17797,7 @@ call :ced_prep | |||||||
| if defined preperror goto dk_done | if defined preperror goto dk_done | ||||||
|  |  | ||||||
| if %_stg%==0 (set stage=) else (set stage=-StageCurrent) | if %_stg%==0 (set stage=) else (set stage=-StageCurrent) | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -SetEdition %targetedition% %stage%" | ||||||
| call :ced_postprep | call :ced_postprep | ||||||
| %line% | %line% | ||||||
|  |  | ||||||
| @@ -18541,7 +18541,7 @@ goto :oe_edition | |||||||
| cls | cls | ||||||
| call :ch_getinfo | call :ch_getinfo | ||||||
| call :oe_tempcleanup | call :oe_tempcleanup | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
|  |  | ||||||
| :oe_editionchange | :oe_editionchange | ||||||
|  |  | ||||||
| @@ -18615,7 +18615,7 @@ cls | |||||||
| set suites= | set suites= | ||||||
| echo %list% | find /i "Suites" %nul1% && ( | echo %list% | find /i "Suites" %nul1% && ( | ||||||
| set suites=1 | set suites=1 | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
| if not exist %SystemRoot%\Temp\getAppIds.txt ( | if not exist %SystemRoot%\Temp\getAppIds.txt ( | ||||||
| %eline% | %eline% | ||||||
| echo Failed to generate available apps list. | echo Failed to generate available apps list. | ||||||
| @@ -19093,7 +19093,7 @@ if not defined terminal mode 105, 32 | |||||||
| ::  Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results | ::  Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results | ||||||
|  |  | ||||||
| set build= | set build= | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a) | ||||||
| echo "%build%" | find /i "16." %nul% || set build= | echo "%build%" | find /i "16." %nul% || set build= | ||||||
|  |  | ||||||
| echo: | echo: | ||||||
|   | |||||||
| @@ -237,7 +237,7 @@ goto dk_done | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
| @@ -511,7 +511,7 @@ set notworking= | |||||||
| call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if defined allapps call :hwiddata key | if defined allapps call :hwiddata key | ||||||
| if not defined key ( | if not defined key ( | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';& ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getactivationid\:.*';. ([scriptblock]::Create($f[1]))"') do (set altapplist=%%a) | ||||||
| if defined altapplist call :hwiddata key | if defined altapplist call :hwiddata key | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -925,7 +925,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con | |||||||
| 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" | 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" | ||||||
| if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | ||||||
|  |  | ||||||
| if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | ||||||
| if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | ||||||
| set winsub=1 | set winsub=1 | ||||||
| set osSKU=%regSKU% | set osSKU=%regSKU% | ||||||
| @@ -1356,7 +1356,7 @@ call :dk_color2 %Red% "Checking WinPE                          " %Blue% "[WinPE | |||||||
|  |  | ||||||
| set wpainfo= | set wpainfo= | ||||||
| set wpaerror= | set wpaerror= | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | ||||||
| echo "%wpainfo%" | find /i "Error Found" %nul% && ( | echo "%wpainfo%" | find /i "Error Found" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set wpaerror=1 | set wpaerror=1 | ||||||
| @@ -1452,7 +1452,7 @@ call :dk_color %Gray% "Checking SLC/WMI SKU                    [Difference Found | |||||||
| reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set showfix=1 | set showfix=1 | ||||||
| call :dk_color %Red% "Checking Rearm                          [System is ReArmed]" | call :dk_color %Red% "Checking Rearm                          [System is Rearmed]" | ||||||
| call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -1548,7 +1548,7 @@ set showfix=1 | |||||||
| if not defined notwinact ( | if not defined notwinact ( | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| set "_notfoundids=Key Not Installed / Act ID Not Found" | set "_notfoundids=Key Not Installed / Act ID Not Found" | ||||||
|   | |||||||
| @@ -236,7 +236,7 @@ goto dk_done | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
| @@ -976,7 +976,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con | |||||||
| 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" | 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" | ||||||
| if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | ||||||
|  |  | ||||||
| if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | ||||||
| if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | ||||||
| set winsub=1 | set winsub=1 | ||||||
| set osSKU=%regSKU% | set osSKU=%regSKU% | ||||||
| @@ -1450,7 +1450,7 @@ call :dk_color2 %Red% "Checking WinPE                          " %Blue% "[WinPE | |||||||
|  |  | ||||||
| set wpainfo= | set wpainfo= | ||||||
| set wpaerror= | set wpaerror= | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | ||||||
| echo "%wpainfo%" | find /i "Error Found" %nul% && ( | echo "%wpainfo%" | find /i "Error Found" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set wpaerror=1 | set wpaerror=1 | ||||||
| @@ -1546,7 +1546,7 @@ call :dk_color %Gray% "Checking SLC/WMI SKU                    [Difference Found | |||||||
| reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set showfix=1 | set showfix=1 | ||||||
| call :dk_color %Red% "Checking Rearm                          [System is ReArmed]" | call :dk_color %Red% "Checking Rearm                          [System is Rearmed]" | ||||||
| call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -1642,7 +1642,7 @@ set showfix=1 | |||||||
| if not defined notwinact ( | if not defined notwinact ( | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| set "_notfoundids=Key Not Installed / Act ID Not Found" | set "_notfoundids=Key Not Installed / Act ID Not Found" | ||||||
|   | |||||||
| @@ -245,7 +245,7 @@ goto dk_done | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
| @@ -1074,7 +1074,7 @@ for %%# in ("!_oLPath!\%_License%*.xrm-ms") do ( | |||||||
| if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") | if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") | ||||||
| ) | ) | ||||||
|  |  | ||||||
| %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% | %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% | ||||||
|  |  | ||||||
| call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 | call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 | ||||||
| echo "!allapps!" | find /i "!_actid!" %nul1% || ( | echo "!allapps!" | find /i "!_actid!" %nul1% || ( | ||||||
| @@ -1586,8 +1586,8 @@ exit /b | |||||||
| :oh_licrefresh | :oh_licrefresh | ||||||
|  |  | ||||||
| if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( | if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( | ||||||
| %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| ) | ) | ||||||
| exit /b | exit /b | ||||||
|  |  | ||||||
| @@ -2038,7 +2038,7 @@ call :dk_color2 %Red% "Checking WinPE                          " %Blue% "[WinPE | |||||||
|  |  | ||||||
| set wpainfo= | set wpainfo= | ||||||
| set wpaerror= | set wpaerror= | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | ||||||
| echo "%wpainfo%" | find /i "Error Found" %nul% && ( | echo "%wpainfo%" | find /i "Error Found" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set wpaerror=1 | set wpaerror=1 | ||||||
| @@ -2134,7 +2134,7 @@ call :dk_color %Gray% "Checking SLC/WMI SKU                    [Difference Found | |||||||
| reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set showfix=1 | set showfix=1 | ||||||
| call :dk_color %Red% "Checking Rearm                          [System is ReArmed]" | call :dk_color %Red% "Checking Rearm                          [System is Rearmed]" | ||||||
| call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -2230,7 +2230,7 @@ set showfix=1 | |||||||
| if not defined notwinact ( | if not defined notwinact ( | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| set "_notfoundids=Key Not Installed / Act ID Not Found" | set "_notfoundids=Key Not Installed / Act ID Not Found" | ||||||
| @@ -2905,7 +2905,7 @@ exit /b | |||||||
| :oh_extractdll | :oh_extractdll | ||||||
|  |  | ||||||
| set b= | set b= | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[System.IO.File]::ReadAllText('!_batp!') -split ':hexedit\:.*';& ([scriptblock]::Create($m[1]))" %nul2% | find /i "Error found" %nul1% && set hasherror=1 | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':%_hook%\:.*';$encoded = ($f[1]) -replace '-', 'A' -replace '_', 'a';$bytes = [Con%b%vert]::FromBas%b%e64String($encoded); $PePath='%1'; $offset='%2'; $m=[System.IO.File]::ReadAllText('!_batp!') -split ':hexedit\:.*';. ([scriptblock]::Create($m[1]))" %nul2% | find /i "Error found" %nul1% && set hasherror=1 | ||||||
| exit /b | exit /b | ||||||
|  |  | ||||||
| :hexedit: | :hexedit: | ||||||
|   | |||||||
| @@ -276,7 +276,7 @@ goto dk_done | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
| @@ -1359,7 +1359,7 @@ for %%# in ("!_oLPath!\%_License%*.xrm-ms") do ( | |||||||
| if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") | if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") | ||||||
| ) | ) | ||||||
|  |  | ||||||
| %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% | %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% | ||||||
|  |  | ||||||
| call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 | call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 | ||||||
| echo "!allapps!" | find /i "!_actid!" %nul1% || ( | echo "!allapps!" | find /i "!_actid!" %nul1% || ( | ||||||
| @@ -1564,8 +1564,8 @@ exit /b | |||||||
| :oh_licrefresh | :oh_licrefresh | ||||||
|  |  | ||||||
| if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( | if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( | ||||||
| %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| ) | ) | ||||||
| exit /b | exit /b | ||||||
|  |  | ||||||
| @@ -2623,7 +2623,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con | |||||||
| 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" | 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" | ||||||
| if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | ||||||
|  |  | ||||||
| if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | ||||||
| if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | ||||||
| set winsub=1 | set winsub=1 | ||||||
| set osSKU=%regSKU% | set osSKU=%regSKU% | ||||||
| @@ -3094,7 +3094,7 @@ call :dk_color2 %Red% "Checking WinPE                          " %Blue% "[WinPE | |||||||
|  |  | ||||||
| set wpainfo= | set wpainfo= | ||||||
| set wpaerror= | set wpaerror= | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | ||||||
| echo "%wpainfo%" | find /i "Error Found" %nul% && ( | echo "%wpainfo%" | find /i "Error Found" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set wpaerror=1 | set wpaerror=1 | ||||||
| @@ -3190,7 +3190,7 @@ call :dk_color %Gray% "Checking SLC/WMI SKU                    [Difference Found | |||||||
| reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set showfix=1 | set showfix=1 | ||||||
| call :dk_color %Red% "Checking Rearm                          [System is ReArmed]" | call :dk_color %Red% "Checking Rearm                          [System is Rearmed]" | ||||||
| call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -3286,7 +3286,7 @@ set showfix=1 | |||||||
| if not defined notwinact ( | if not defined notwinact ( | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| set "_notfoundids=Key Not Installed / Act ID Not Found" | set "_notfoundids=Key Not Installed / Act ID Not Found" | ||||||
|   | |||||||
| @@ -303,7 +303,7 @@ goto dk_done | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
| @@ -747,7 +747,7 @@ if defined _vis goto :ts_winvista | |||||||
|  |  | ||||||
| set tempid= | set tempid= | ||||||
| if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero) | if /i %tsmethod%==KMS4k (set keytype=ks) else (set keytype=zero) | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( | ||||||
| echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) | echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -1037,7 +1037,7 @@ goto :ts_esu | |||||||
| ) | ) | ||||||
|  |  | ||||||
| set resetstuff=1 | set resetstuff=1 | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
| set resetstuff= | set resetstuff= | ||||||
| if !errorlevel!==3 ( | if !errorlevel!==3 ( | ||||||
| set error=1 | set error=1 | ||||||
| @@ -1521,10 +1521,10 @@ if %winbuild% GEQ 10586 ( | |||||||
| for %%# in ("%SysPath%\spp\tokens\skus\%tsedition%\*CSVLK*.xrm-ms") do ( | for %%# in ("%SysPath%\spp\tokens\skus\%tsedition%\*CSVLK*.xrm-ms") do ( | ||||||
| if defined _arr (set "_arr=!_arr!;"%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") else (set "_arr="%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") | if defined _arr (set "_arr=!_arr!;"%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") else (set "_arr="%SysPath%\spp\tokens\skus\%tsedition%\%%~nx#"") | ||||||
| ) | ) | ||||||
| if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul% | if defined _arr %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'" %nul% | ||||||
| ) | ) | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wintsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( | ||||||
| echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) | echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set tempid=%%a) | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -1718,7 +1718,7 @@ echo Processing Reset of Rearm / Timers / Tamper / Lock... | |||||||
| echo: | echo: | ||||||
|  |  | ||||||
| set resetstuff=1 | set resetstuff=1 | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
|  |  | ||||||
| if %errorlevel%==3 ( | if %errorlevel%==3 ( | ||||||
| call :dk_color %Red% "Reset Failed." | call :dk_color %Red% "Reset Failed." | ||||||
| @@ -1766,7 +1766,7 @@ if %errorlevel%==1 exit /b | |||||||
| echo: | echo: | ||||||
| echo Fetching Supported Activation IDs list. Please wait... | echo Fetching Supported Activation IDs list. Please wait... | ||||||
|  |  | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':listactids\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
| if %errorlevel%==3 ( | if %errorlevel%==3 ( | ||||||
| call :dk_color %Gray% "No supported activation ID found, aborting..." | call :dk_color %Gray% "No supported activation ID found, aborting..." | ||||||
| goto :dk_done | goto :dk_done | ||||||
| @@ -1915,7 +1915,7 @@ echo Writing TrustedStore data... | |||||||
| if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) | if /i %tsmethod%==StaticCID (echo Depositing Static Confirmation ID...) else (echo Depositing Zero Confirmation ID...) | ||||||
| ) | ) | ||||||
| echo: | echo: | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';& ([ScriptBlock]::Create($f[1])) %tsids%" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':tsforge\:.*';. ([scriptblock]::Create($f[1])) %tsids%" | ||||||
| if !errorlevel!==3 ( | if !errorlevel!==3 ( | ||||||
| if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") | if %_actman%==0 (if not defined error call :dk_color %Blue% "%_fixmsg%") | ||||||
| set fixes=%fixes% %mas%troubleshoot | set fixes=%fixes% %mas%troubleshoot | ||||||
| @@ -2191,7 +2191,7 @@ echo !_License! | find /i "Retail" %nul% && (set keytype=zero) || (set keytype=k | |||||||
| set keytype=zero | set keytype=zero | ||||||
| ) | ) | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do ( | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':offtsid\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do ( | ||||||
| echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) | echo "%%a" | findstr /r ".*-.*-.*-.*-.*" %nul1% && (set tsids=!tsids! %%a& set _actid=%%a) | ||||||
| ) | ) | ||||||
| set "_allactid=!tsids!" | set "_allactid=!tsids!" | ||||||
| @@ -2312,7 +2312,7 @@ for %%# in ("!_oLPath!\%_License%*.xrm-ms") do ( | |||||||
| if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") | if defined _arr (set "_arr=!_arr!;"!_oLPath!\%%~nx#"") else (set "_arr="!_oLPath!\%%~nx#"") | ||||||
| ) | ) | ||||||
|  |  | ||||||
| %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% | %psc% "$sls = Get-WmiObject %sps%; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); InstallLicenseArr '!_arr!'; InstallLicenseFile '"!_oLPath!\pkeyconfig-office.xrm-ms"'" %nul% | ||||||
|  |  | ||||||
| call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 | call :dk_actids 0ff1ce15-a989-479d-af46-f275c6370663 | ||||||
| echo "!allapps!" | find /i "!_actid!" %nul1% || ( | echo "!allapps!" | find /i "!_actid!" %nul1% || ( | ||||||
| @@ -2517,8 +2517,8 @@ exit /b | |||||||
| :oh_licrefresh | :oh_licrefresh | ||||||
|  |  | ||||||
| if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( | if exist "%SysPath%\spp\store_test\2.0\tokens.dat" ( | ||||||
| %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | %psc% "Stop-Service sppsvc -force; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | if !errorlevel! NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| ) | ) | ||||||
| exit /b | exit /b | ||||||
|  |  | ||||||
| @@ -2673,7 +2673,7 @@ for /f "tokens=3 delims=." %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Con | |||||||
| 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" | 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" | ||||||
| if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | if %_wmic% EQU 0 for /f "tokens=1" %%a in ('%psc% "([WMI]'Win32_OperatingSystem=@').OperatingSystemSKU" %nul6%') do if not errorlevel 1 set "wmiSKU=%%a" | ||||||
|  |  | ||||||
| if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';& ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | if %winbuild% GEQ 15063 %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':winsubstatus\:.*';. ([scriptblock]::Create($f[1]))" %nul2% | find /i "Subscription_is_activated" %nul% && ( | ||||||
| if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | if defined regSKU if defined slcSKU if not "%regSKU%"=="%slcSKU%" ( | ||||||
| set winsub=1 | set winsub=1 | ||||||
| set osSKU=%regSKU% | set osSKU=%regSKU% | ||||||
| @@ -3101,7 +3101,7 @@ call :dk_color2 %Red% "Checking WinPE                          " %Blue% "[WinPE | |||||||
|  |  | ||||||
| set wpainfo= | set wpainfo= | ||||||
| set wpaerror= | set wpaerror= | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':wpatest\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set wpainfo=%%a) | ||||||
| echo "%wpainfo%" | find /i "Error Found" %nul% && ( | echo "%wpainfo%" | find /i "Error Found" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set wpaerror=1 | set wpaerror=1 | ||||||
| @@ -3197,7 +3197,7 @@ call :dk_color %Gray% "Checking SLC/WMI SKU                    [Difference Found | |||||||
| reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\PersistedTSReArmed" %nul% && ( | ||||||
| set error=1 | set error=1 | ||||||
| set showfix=1 | set showfix=1 | ||||||
| call :dk_color %Red% "Checking Rearm                          [System is ReArmed]" | call :dk_color %Red% "Checking Rearm                          [System is Rearmed]" | ||||||
| call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | call :dk_color %Blue% "Reboot your machine using the restart option to fix this error." | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -3293,7 +3293,7 @@ set showfix=1 | |||||||
| if not defined notwinact ( | if not defined notwinact ( | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| %psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($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=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f | ||||||
| if not defined apps ( | if not defined apps ( | ||||||
| set "_notfoundids=Key Not Installed / Act ID Not Found" | set "_notfoundids=Key Not Installed / Act ID Not Found" | ||||||
|   | |||||||
| @@ -190,7 +190,7 @@ goto dk_done | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
| @@ -551,7 +551,7 @@ goto :oe_edition | |||||||
| cls | cls | ||||||
| call :ch_getinfo | call :ch_getinfo | ||||||
| call :oe_tempcleanup | call :oe_tempcleanup | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getlist\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
|  |  | ||||||
| :oe_editionchange | :oe_editionchange | ||||||
|  |  | ||||||
| @@ -625,7 +625,7 @@ cls | |||||||
| set suites= | set suites= | ||||||
| echo %list% | find /i "Suites" %nul1% && ( | echo %list% | find /i "Suites" %nul1% && ( | ||||||
| set suites=1 | set suites=1 | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getappnames\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
| if not exist %SystemRoot%\Temp\getAppIds.txt ( | if not exist %SystemRoot%\Temp\getAppIds.txt ( | ||||||
| %eline% | %eline% | ||||||
| echo Failed to generate available apps list. | echo Failed to generate available apps list. | ||||||
| @@ -1103,7 +1103,7 @@ if not defined terminal mode 105, 32 | |||||||
| ::  Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results | ::  Get build number for the target FFN, using build number with OfficeC2RClient.exe command to trigger updates provides accurate results | ||||||
|  |  | ||||||
| set build= | set build= | ||||||
| for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';& ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a) | for /f "delims=" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':getbuild\:.*';. ([scriptblock]::Create($f[1]))" %nul6%') do (set build=%%a) | ||||||
| echo "%build%" | find /i "16." %nul% || set build= | echo "%build%" | find /i "16." %nul% || set build= | ||||||
|  |  | ||||||
| echo: | echo: | ||||||
|   | |||||||
| @@ -195,7 +195,7 @@ goto dk_done | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
| @@ -451,7 +451,7 @@ set _ntarget= | |||||||
| set _wtarget= | set _wtarget= | ||||||
|  |  | ||||||
| if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-TargetEditions ^| findstr /i /c:"Target Edition : "') do (if defined _dtarget (set "_dtarget= !_dtarget! %%a ") else (set "_dtarget= %%a ")) | if %winbuild% GEQ 10240 for /f "tokens=4" %%a in ('dism /online /english /Get-TargetEditions ^| findstr /i /c:"Target Edition : "') do (if defined _dtarget (set "_dtarget= !_dtarget! %%a ") else (set "_dtarget= %%a ")) | ||||||
| if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a ")) | if %winbuild% LSS 10240 for /f "tokens=4" %%a in ('%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -GetTargetEditions;" ^| findstr /i /c:"Target Edition : "') do (if defined _ptarget (set "_ptarget= !_ptarget! %%a ") else (set "_ptarget= %%a ")) | ||||||
|  |  | ||||||
| if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" ( | if %winbuild% GEQ 10240 if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" ( | ||||||
| if %winbuild% GEQ 17063 call :ced_edilist | if %winbuild% GEQ 17063 call :ced_edilist | ||||||
| @@ -657,7 +657,7 @@ echo: | |||||||
| call :ced_prep | call :ced_prep | ||||||
| if defined preperror goto dk_done | if defined preperror goto dk_done | ||||||
|  |  | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';& ([ScriptBlock]::Create($f[1])) %targetedition% %key%" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':dismapi\:.*';. ([scriptblock]::Create($f[1])) %targetedition% %key%" | ||||||
| call :ced_postprep | call :ced_postprep | ||||||
| ) | ) | ||||||
| %line% | %line% | ||||||
| @@ -695,7 +695,7 @@ call :ced_prep | |||||||
| if defined preperror goto dk_done | if defined preperror goto dk_done | ||||||
|  |  | ||||||
| if %_stg%==0 (set stage=) else (set stage=-StageCurrent) | if %_stg%==0 (set stage=) else (set stage=-StageCurrent) | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';& ([ScriptBlock]::Create($f[1])) -SetEdition %targetedition% %stage%" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':cbsxml\:.*';. ([scriptblock]::Create($f[1])) -SetEdition %targetedition% %stage%" | ||||||
| call :ced_postprep | call :ced_postprep | ||||||
| %line% | %line% | ||||||
|  |  | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ goto :E_Exit | |||||||
| set "_batf=%~f0" | set "_batf=%~f0" | ||||||
| set "_batp=%_batf:'=''%" | set "_batp=%_batf:'=''%" | ||||||
| setlocal EnableDelayedExpansion | setlocal EnableDelayedExpansion | ||||||
| %_psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';& ([scriptblock]::Create($f[1]))" | %_psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sppmgr\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
|  |  | ||||||
| :E_Exit | :E_Exit | ||||||
| echo. | echo. | ||||||
|   | |||||||
| @@ -206,7 +206,7 @@ goto done2 | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
|   | |||||||
| @@ -207,7 +207,7 @@ goto dk_done | |||||||
|  |  | ||||||
| ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ::pstst $ExecutionContext.SessionState.LanguageMode :pstst | ||||||
|  |  | ||||||
| for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';& ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[System.IO.File]::ReadAllText('!_batp!') -split ':pstst';. ([scriptblock]::Create($f[1]))}" %nul6%') do (set tstresult=%%a) | ||||||
|  |  | ||||||
| if /i not "%tstresult%"=="FullLanguage" ( | if /i not "%tstresult%"=="FullLanguage" ( | ||||||
| %eline% | %eline% | ||||||
| @@ -703,7 +703,7 @@ call :_taskclear-cache | |||||||
|  |  | ||||||
| %nul% reg query "HKLM\%SPPk%\%_wApp%" && ( | %nul% reg query "HKLM\%SPPk%\%_wApp%" && ( | ||||||
| echo Removing KMS38 protection... | echo Removing KMS38 protection... | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([scriptblock]::Create($f[1]))" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regdel\:.*';. ([scriptblock]::Create($f[1]))" | ||||||
| %nul% reg delete "HKLM\%SPPk%\%_wApp%" /f | %nul% reg delete "HKLM\%SPPk%\%_wApp%" /f | ||||||
| %nul% reg query "HKLM\%SPPk%\%_wApp%" && ( | %nul% reg query "HKLM\%SPPk%\%_wApp%" && ( | ||||||
| call :dk_color %Red% "Failed to remove KMS38 protection." | call :dk_color %Red% "Failed to remove KMS38 protection." | ||||||
| @@ -741,7 +741,7 @@ echo Checking SPP permission related issues... | |||||||
| call :checkperms | call :checkperms | ||||||
| if defined permerror ( | if defined permerror ( | ||||||
| call :dk_color %Red% "[!permerror!]" | call :dk_color %Red% "[!permerror!]" | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';& ([scriptblock]::Create($f[1]))" %nul% | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':fixsppperms\:.*';. ([scriptblock]::Create($f[1]))" %nul% | ||||||
| call :checkperms | call :checkperms | ||||||
| if defined permerror ( | if defined permerror ( | ||||||
| call :dk_color %Red% "[!permerror!] [Failed To Fix]" | call :dk_color %Red% "[!permerror!] [Failed To Fix]" | ||||||
| @@ -811,8 +811,8 @@ if defined _vis ( | |||||||
|  |  | ||||||
| echo: | echo: | ||||||
| echo Reinstalling system licenses... | echo Reinstalling system licenses... | ||||||
| %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';& ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | if %errorlevel% NEQ 0 %psc% "$sls = Get-WmiObject SoftwareLicensingService; $f=[System.IO.File]::ReadAllText('!_batp!') -split ':xrm\:.*';. ([scriptblock]::Create($f[1])); ReinstallLicenses" %nul% | ||||||
| if %errorlevel% EQU 0 ( | if %errorlevel% EQU 0 ( | ||||||
| echo [Successful] | echo [Successful] | ||||||
| ) else ( | ) else ( | ||||||
| @@ -1511,7 +1511,7 @@ exit /b | |||||||
|  |  | ||||||
| :regownstart | :regownstart | ||||||
|  |  | ||||||
| %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';& ([scriptblock]::Create($f[1]));" | %psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':regown\:.*';. ([scriptblock]::Create($f[1]));" | ||||||
| exit /b | exit /b | ||||||
|  |  | ||||||
| ::  Below code takes ownership of a volatile registry key and deletes it | ::  Below code takes ownership of a volatile registry key and deletes it | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user