Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mosesIRL committed Mar 3, 2017
2 parents ff70e5c + c94d936 commit 870fbe5
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 31 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Windows-7-Activator
# Windows-7-Activator (dev)
This is a batch script for activating Windows 7 using an OEM certificate. For computers that come with a Windows 8/10 sticker but have downgrade rights to Windows 7 Pro. This allows you activate it after doing a clean install. It's useful in conjunction with SetupComplete.cmd if you're setting up a Windows 7 deployment image.

You can also use it to install a retail or volume license key.

***This branch is in development and contains many bugs. If you want a working version, check the master or FOG-Edition branches.***

# Roadmap

The following features were added as of version 1.0.0:
The following features are planned for version 1.0.1:

- Multiple edition support (Starter, Home Prem/Basic and Ultimate) ✔
- Detect incompatible Windows versions or editions ✔
- Autodetect failed activation and alternative certificate attempt ✔
- Automatic/unattended mode (autodetect manufacturer and Windows edition)
- Command switches for unattended/manual modes

Please suggest any features you'd like to see.

Expand Down
38 changes: 27 additions & 11 deletions Win7_OEM_Activator.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas",

:ExecElevation
"%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %*
exit /b
exit

:gotPrivileges
setlocal & cd /d %~dp0
Expand All @@ -47,7 +47,7 @@ if exist %~dp0log.txt del /f /q %~dp0log.txt

REM **************************************************************************************************************************************

:CheckWinVersion
:CHECKWINVERSION
for /f "tokens=4-5 delims=. " %%i in ('ver') do set WINVERSION=%%i.%%j
if NOT "%version%" == "6.1" (
echo.
Expand All @@ -61,7 +61,7 @@ if NOT "%version%" == "6.1" (
exit /b
)

:GetCurrentEdition
:GETCURRENTEDITION
cls
mode con: cols=100 lines=35
type "%~dp0lib\agreement.txt"
Expand All @@ -85,6 +85,19 @@ if "%EDITION%" == "Enterprise" (
exit /b
)

:GETMANUFACTURER
for /f "usebackq tokens=2 delims==" %%A IN (`wmic csproduct get vendor /value`) DO SET VENDOR=%%A
if "%~1"=="auto" (
call "%~dp0lib\installcert.bat" VALIDATEVENDOR
exit /b
)
if "%~1"=="retail" (
goto INSTALLRETAIL
)
if "%~1"=="manual" (
goto manualinstall
)

:SELECTOPTION
cls
echo.
Expand All @@ -98,17 +111,20 @@ echo.
echo.
echo. Select license type:
echo.
echo. 1) Install OEM MS Windows 7 License
echo. 2) Install retail, volume or sticker product key
echo. 3) Cancel/Exit
echo. 1) Automatic Activation
echo. 2) Manual activation (select manufacturer and Windows edition)
echo. 3) Install retail, volume or sticker product key
echo. 4) Cancel/Exit
echo.
set /P LICENSETYPE="Enter selection: "
if /i "%LICENSETYPE:~,1%" EQU "1" goto installoem
if /i "%LICENSETYPE:~,1%" EQU "2" goto installretail
if /i "%LICENSETYPE:~,1%" EQU "3" exit /b
goto SELECTOPTION
if /i "%LICENSETYPE:~,1%" EQU "1" call "%~dp0lib\installcert.bat" VALIDATEVENDOR
exit
if /i "%LICENSETYPE:~,1%" EQU "2" goto manualinstall
if /i "%LICENSETYPE:~,1%" EQU "3" goto installretail
if /i "%LICENSETYPE:~,1%" EQU "4" exit /b
goto MANUALINSTALL

:INSTALLOEM
:MANUALINSTALL
echo OEM installation selected. >> %~dp0log.txt
cls
type "%~dp0lib\headertitle.txt"
Expand Down
8 changes: 6 additions & 2 deletions lib/checkstatus.bat
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ if /i TRYAGAIN=="y" call "%~dp0Win7_OEM_Activator.bat"
if /i TRYAGAIN=="n" exit

:ACTIVATIONCOMPLETE
@echo on
echo.
echo.
set /P RESTART="Restart the computer? (Y/N) "
if /i RESTART=="y" "shutdown /f /r /t 0"
if /i RESTART=="n" exit /b
if /i "%RESTART%" EQU "Y" cmd /c "shutdown /f /r /t 0"
if /i "%RESTART%" EQU "y" cmd /c "shutdown /f /r /t 0"
if /i "%RESTART%" EQU "N" exit /b
if /i "%RESTART%" EQU "n" exit /b
pause
49 changes: 49 additions & 0 deletions lib/installcert.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,55 @@ if "%~1"=="" (
) else (
goto %~1
)
:VALIDATEVENDOR
FOR %%G IN ("Acer"
"Gateway"
"Packard"
"Alienware"
"ASUS"
"Dell Inc."
"Fujitsu"
"HP"
"Compaq"
"Lenovo"
"IBM"
"Samsung"
"Sony"
"Toshiba") DO (
IF /I "%vendor%"=="%%~G" GOTO AUTOMATCHMANU
)

:INVALIDVENDOR
type "%~dp0lib\agreement.txt"
echo.
echo. Your PC reported that it's manufacturer is "%VENDOR%".
echo.
echo. This was not recognized by the activator script.
echo. If you believe this is an error, restart the script
echo. and use the manual mode to select the vendor.
echo.
echo.
echo Press any key to exit...
pause >nul
exit /b

:AUTOMATCHMANU
if /i %VENDOR% EQU "Acer" DO SET MANU=AcerGatewayPackard
if /i %VENDOR% EQU "Gateway" DO SET MANU=AcerGatewayPackard
if /i %VENDOR% EQU "Packard" DO SET MANU=AcerGatewayPackard
if /i %VENDOR% EQU "Alienware" DO SET MANU=Alienware
if /i %VENDOR% EQU "ASUS" DO SET MANU=ASUS
if /i %VENDOR% EQU "Dell Inc." DO SET MANU=Dell
if /i %VENDOR% EQU "Fujitsu" DO SET MANU=Fujitsu
if /i %VENDOR% EQU "HP" DO SET MANU=HPCompaq
if /i %VENDOR% EQU "Compaq" DO SET MANU=HPCompaq
if /i %VENDOR% EQU "Lenovo" DO SET MANU=LenovoIBM
if /i %VENDOR% EQU "IBM" DO SET MANU=LenovoIBM
if /i %VENDOR% EQU "Samsung" DO SET MANU=Samsung
if /i %VENDOR% EQU "Sony" DO SET MANU=Sony
if /i %VENDOR% EQU "Toshiba" DO SET MANU=Toshiba
goto INSTALLA

:MATCHMANU
if /i "%MANUFACTURER:~,1%" EQU "1" SET MANU=AcerGatewayPackard
if /i "%MANUFACTURER:~,1%" EQU "2" SET MANU=Alienware
Expand Down
18 changes: 6 additions & 12 deletions lib/log.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
Manufacturer selected: AcerGatewayPackard
Manufacturer selected:
Manufacturer selected:
Manufacturer selected:
License A activation check failed.
License variant not found.
License A activation check successful
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
Manufacturer selected: AcerGatewayPackard
License A activation check successful
1 change: 0 additions & 1 deletion log.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Installed edition of Windows 7: Pro
OEM installation selected.

0 comments on commit 870fbe5

Please sign in to comment.