@ECHO OFF

ECHO Stopping Windows Update Serivce
START /WAIT /MIN NET STOP wuauserv
START /WAIT /MIN NET STOP bits

ECHO Killing WGA Process
TASKKILL /F /IM wgatray.exe

ECHO Deleting old Files
IF EXIST %windir%\system32\LegitCheckControl.dll DEL /F /Q %windir%\system32\LegitCheckControl.dll
IF EXIST %windir%\system32\WgaLogon.dll DEL /F /Q %windir%\system32\WgaLogon.dll
IF EXIST %windir%\system32\WgaTray.exe DEL /F /Q %windir%\system32\WgaTray.exe

ECHO Moving old Files which could not be deleted
IF EXIST %windir%\system32\LegitCheckControl.dll MOVE %windir%\system32\LegitCheckControl.dll %TEMP%\LegitCheckControl.dll
IF EXIST %windir%\system32\WgaLogon.dll MOVE %windir%\system32\WgaLogon.dll %TEMP%\WgaLogon.dll
IF EXIST %windir%\system32\WgaTray.exe MOVE %windir%\system32\WgaTray.exe %TEMP%\WgaTray.exe

ECHO Installing WGA
COPY LegitCheckControl.dll %windir%\system32\LegitCheckControl.dll
COPY WgaLogon.dll %windir%\system32\WgaLogon.dll
COPY WgaTray.exe %windir%\system32\WgaTray.exe

ECHO Registering WGA
IF EXIST %windir%\system32\LegitCheckControl.dll REGSVR32 /s %windir%\system32\LegitCheckControl.dll
IF EXIST %windir%\system32\WgaLogon.dll REGSVR32 /s %windir%\system32\WgaLogon.dll
REG ADD "HKLM\SOFTWARE\Microsoft\Windows Genuine Advantage" /v "InstallID" /t REG_SZ /d "{30F230D0-7940-499e-8A01-748682288985}" /f

ECHO Starting Windows Update Serivce
START /WAIT /MIN NET START wuauserv
START /WAIT /MIN NET START bits
