Difference between revisions of "Windows Activation"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
m
Line 21: Line 21:
  
 
</source>
 
</source>
 +
 +
Batch file for activation via key lists for Windows 7, 8 and 8.1:
 +
<code>
 +
 +
@echo off
 +
 +
set WPKG_DIR=\\your_server\wpkg
 +
 +
REM Check Windows Version
 +
ver | find "5.1." > nul
 +
IF %ERRORLEVEL% EQU 0 goto WIN_XP
 +
ver | find "6.1." > nul
 +
IF %ERRORLEVEL% EQU 0 goto WIN_7
 +
ver | find "6.2." > nul
 +
IF %ERRORLEVEL% EQU 0 goto WIN_8
 +
ver | find "6.3." > nul
 +
IF %ERRORLEVEL% EQU 0 goto WIN_81
 +
goto WARNING
 +
 +
:WIN_XP
 +
echo XP volume license used
 +
exit /b
 +
goto ACTIVATE
 +
 +
:WIN_7
 +
set KEY_FILE=%WPKG_DIR%\packages\WinActivator\win_7_pro.txt
 +
set USED_KEY_FILE=%WPKG_DIR%\packages\WinActivator\used_win_7_pro.txt
 +
goto ACTIVATE
 +
 +
:WIN_8
 +
:WIN_81
 +
set KEY_FILE=%WPKG_DIR%\packages\WinActivator\win_8_pro.txt
 +
set USED_KEY_FILE=%WPKG_DIR%\packages\WinActivator\used_win_8_pro.txt
 +
goto ACTIVATE
 +
 +
:WARNING
 +
echo Unsupported machine OS.
 +
exit /b
 +
 +
:ACTIVATE 
 +
REM Noch X Tage bis Ende der vorläufigen Aktivierung
 +
cscript /nologo slmgr.vbs /dli | find "Lizenziert" > NUL
 +
if not errorlevel 1 (
 +
echo Windows ist aktiviert.
 +
exit /b
 +
) else (
 +
echo Windows ist nicht aktiviert.
 +
for /F "tokens=*" %%K in (%KEY_FILE%) do (
 +
findstr /m "%%K" %USED_KEY_FILE% > NUL
 +
if errorlevel 1 (
 +
echo found unused key: %%K
 +
cscript /nologo slmgr.vbs /ipk %%K
 +
if not errorlevel 1 (
 +
echo set key successfully.
 +
cscript /nologo slmgr.vbs /ato
 +
if not errorlevel 1 (
 +
echo successfully activated.
 +
echo %%K %COMPUTERNAME% >> %USED_KEY_FILE%
 +
exit /b
 +
)
 +
)
 +
)
 +
)
 +
)
 +
 +
echo something went wrong.
 +
exit /b 1
 +
 +
</code>
  
 
[[Category:Silent Installers]]
 
[[Category:Silent Installers]]
 
[[Category:Changing Windows settings]]
 
[[Category:Changing Windows settings]]

Revision as of 11:21, 7 August 2014

Windows 7 Activation via Multiple Activation Key (MAK)

<?xml version="1.0" encoding="UTF-8"?>

<packages>

<package
  id="win7_activation"
  name="Windows 7 Activation"
  revision="20100302"
  reboot="false"
  priority="100"
  notify="false"
  execute="once">
  <install cmd="cscript slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" />
  <install cmd="cscript slmgr.vbs -ato" />
</package>

</packages>

Batch file for activation via key lists for Windows 7, 8 and 8.1:

@echo off

set WPKG_DIR=\\your_server\wpkg

REM Check Windows Version ver | find "5.1." > nul IF %ERRORLEVEL% EQU 0 goto WIN_XP ver | find "6.1." > nul IF %ERRORLEVEL% EQU 0 goto WIN_7 ver | find "6.2." > nul IF %ERRORLEVEL% EQU 0 goto WIN_8 ver | find "6.3." > nul IF %ERRORLEVEL% EQU 0 goto WIN_81 goto WARNING

WIN_XP

echo XP volume license used exit /b goto ACTIVATE

WIN_7

set KEY_FILE=%WPKG_DIR%\packages\WinActivator\win_7_pro.txt set USED_KEY_FILE=%WPKG_DIR%\packages\WinActivator\used_win_7_pro.txt goto ACTIVATE

WIN_8
WIN_81

set KEY_FILE=%WPKG_DIR%\packages\WinActivator\win_8_pro.txt set USED_KEY_FILE=%WPKG_DIR%\packages\WinActivator\used_win_8_pro.txt goto ACTIVATE

WARNING

echo Unsupported machine OS. exit /b

ACTIVATE

REM Noch X Tage bis Ende der vorläufigen Aktivierung cscript /nologo slmgr.vbs /dli | find "Lizenziert" > NUL if not errorlevel 1 ( echo Windows ist aktiviert. exit /b ) else ( echo Windows ist nicht aktiviert. for /F "tokens=*" %%K in (%KEY_FILE%) do ( findstr /m "%%K" %USED_KEY_FILE% > NUL if errorlevel 1 ( echo found unused key: %%K cscript /nologo slmgr.vbs /ipk %%K if not errorlevel 1 ( echo set key successfully. cscript /nologo slmgr.vbs /ato if not errorlevel 1 ( echo successfully activated. echo %%K %COMPUTERNAME% >> %USED_KEY_FILE% exit /b ) ) ) ) )

echo something went wrong. exit /b 1