mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2025-04-21 16:12:57 +00:00
Use wmic.exe on builds below 9200
This commit is contained in:
parent
af18bd773c
commit
5090cde0a0
@ -1374,6 +1374,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -1687,7 +1688,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
|
||||||
|
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
||||||
set error_code=%errorlevel%
|
set error_code=%errorlevel%
|
||||||
cmd /c exit /b %error_code%
|
cmd /c exit /b %error_code%
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
@ -10978,12 +10980,6 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
|||||||
|
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
|
|
||||||
sc query sppsvc | find /i "STOPPED" %nul% && (
|
|
||||||
echo Stopping sppsvc Service [Successful]
|
|
||||||
) || (
|
|
||||||
call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
|
||||||
)
|
|
||||||
|
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
%_xmlexist% timeout /t 2 %nul%
|
%_xmlexist% timeout /t 2 %nul%
|
||||||
@ -12431,6 +12427,7 @@ set _wmic=0
|
|||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1
|
||||||
)
|
)
|
||||||
|
if %winbuild% LSS 9200 set _wmic=1
|
||||||
|
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
if exist "%ProgramFiles%\Activation-Renewal\" call :_taskstart>>"%ProgramFiles%\Activation-Renewal\Logs.txt"
|
if exist "%ProgramFiles%\Activation-Renewal\" call :_taskstart>>"%ProgramFiles%\Activation-Renewal\Logs.txt"
|
||||||
|
@ -1072,6 +1072,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -1385,7 +1386,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
|
||||||
|
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
||||||
set error_code=%errorlevel%
|
set error_code=%errorlevel%
|
||||||
cmd /c exit /b %error_code%
|
cmd /c exit /b %error_code%
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
|
@ -718,12 +718,6 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
|||||||
|
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
|
|
||||||
sc query sppsvc | find /i "STOPPED" %nul% && (
|
|
||||||
echo Stopping sppsvc Service [Successful]
|
|
||||||
) || (
|
|
||||||
call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
|
||||||
)
|
|
||||||
|
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
%_xmlexist% timeout /t 2 %nul%
|
%_xmlexist% timeout /t 2 %nul%
|
||||||
@ -1176,6 +1170,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -1534,7 +1529,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
|
||||||
|
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
||||||
set error_code=%errorlevel%
|
set error_code=%errorlevel%
|
||||||
cmd /c exit /b %error_code%
|
cmd /c exit /b %error_code%
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
|
@ -1495,6 +1495,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -1793,7 +1794,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
|
||||||
|
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
||||||
set error_code=%errorlevel%
|
set error_code=%errorlevel%
|
||||||
cmd /c exit /b %error_code%
|
cmd /c exit /b %error_code%
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
|
@ -1686,6 +1686,7 @@ set _wmic=0
|
|||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" 2>nul | find /i "computersystem" 1>nul && set _wmic=1
|
||||||
)
|
)
|
||||||
|
if %winbuild% LSS 9200 set _wmic=1
|
||||||
|
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
if exist "%ProgramFiles%\Activation-Renewal\" call :_taskstart>>"%ProgramFiles%\Activation-Renewal\Logs.txt"
|
if exist "%ProgramFiles%\Activation-Renewal\" call :_taskstart>>"%ProgramFiles%\Activation-Renewal\Logs.txt"
|
||||||
@ -2739,6 +2740,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -3097,7 +3099,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
|
||||||
|
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
||||||
set error_code=%errorlevel%
|
set error_code=%errorlevel%
|
||||||
cmd /c exit /b %error_code%
|
cmd /c exit /b %error_code%
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
|
@ -2400,6 +2400,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
@ -2712,8 +2713,8 @@ call :dk_color %Red% "Checking Package Files [Not Found] [%osed
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if %_wmic% EQU 1 wmic path %sps% get Version %nul%
|
||||||
%psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
|
||||||
set error_code=%errorlevel%
|
set error_code=%errorlevel%
|
||||||
cmd /c exit /b %error_code%
|
cmd /c exit /b %error_code%
|
||||||
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
|
||||||
@ -2850,7 +2851,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=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses"
|
%psc% "if (-not $env:_vis) {Start-Job { Stop-Service %_slser% -force } | Wait-Job -Timeout 20 | Out-Null}; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($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"
|
||||||
|
@ -1408,6 +1408,7 @@ exit /b
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
|
@ -910,6 +910,7 @@ exit /b
|
|||||||
|
|
||||||
:dk_ckeckwmic
|
:dk_ckeckwmic
|
||||||
|
|
||||||
|
if %winbuild% LSS 9200 (set _wmic=1&exit /b)
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
|
Loading…
Reference in New Issue
Block a user