-
Notifications
You must be signed in to change notification settings - Fork 5
/
Backup Activation.bat
134 lines (131 loc) · 7 KB
/
Backup Activation.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@echo off&set local&color 0f&mode con cols=64 lines=25&title Backup Restore Activations 1.1
::--------------------------------------------------------------------------------------------------------------------------------------------------------
::--------------------------------------------------------------------------------------------------------------------------------------------------------
:: Elevating UAC Administrator Privileges
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if "%errorlevel%" NEQ "0" (
echo: Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo: UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs" & exit
)
if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"
) else if "%errorlevel%" NEQ "1" (
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && ""%~s0""", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
)
if exist "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" set folder="%ProgramFiles%\Microsoft Office\Office14"& set /a ver=4
if exist "%ProgramFiles(x86)%\Microsoft Office\Office14\ospp.vbs" set folder="%ProgramFiles(x86)%\Microsoft Office\Office14"& set /a ver=4
if exist "%ProgramFiles%\Microsoft Office\Office15\ospp.vbs" set folder="%ProgramFiles%\Microsoft Office\Office15"& set /a ver=5
if exist "%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs" set folder="%ProgramFiles(x86)%\Microsoft Office\Office15"& set /a ver=5
if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" set folder="%ProgramFiles%\Microsoft Office\Office16"& set /a ver=6
if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" set folder="%ProgramFiles(x86)%\Microsoft Office\Office16"& set /a ver=6
::--------------------------------------------------------------------------------------------------------------------------------------------------------
:start
cls&color 0f&mode con cols=66 lines=25
echo ================================================================
echo ^| ^|
echo ^| BACKUP AND RESTORE ACTIVATION ^|
echo ^| ^|
echo ================================================================
echo ^| ^| ^|
echo ^| [1] BACKUP ACTIVATION ^| [2] RESTORE ACTIVATION ^|
echo ^| ^| ^|
echo ================================================================
echo ^| ^|
echo ^| [3] EXIT AND THANK YOU FOR USING THIS TOOL ^|
echo ^| ^|
echo ================================================================
echo.&echo.
echo ==========================Coded by Kaz==========================
echo Thanks to Nguyen Viet Hoang, Le Quang Dat, Tran Vinh Trung
echo support me to make this tool
echo My Name: Huynh Danh Dat
echo Any problems please inbox this facebook:fb.com/dat.huynhdanh
echo ================================================================
echo.&CHOICE /C 123 /N /M " YOUR CHOICE: "
IF ERRORLEVEL == 3 exit
IF ERRORLEVEL == 2 GOTO:RESTORE
IF ERRORLEVEL == 1 GOTO:BACKUP
:BACKUP
cls
echo This Tool will delete all old backup !!!. Do you want to continue ??
CHOICE /C yn /N /M "Your choice (Y/N): "
IF ERRORLEVEL == 2 GOTO:start
IF ERRORLEVEL == 1 GOTO:BACKUP1
:BACKUP1
for /f "tokens=6 delims=[.] " %%a in ('ver') do set ver1=%%a
if %ver1% LEQ 7601 (
XCOPY C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\* Backup\SoftwareProtectionPlatform /s /i /y >nul
if %ver% LEQ 4 (
goto:start
goto:BACKUP
) else (
XCOPY C:\ProgramData\Microsoft\OfficeSoftwareProtectionPlatform\* Backup\OfficeSoftwareProtectionPlatform /s /i /y>nul
goto:start
goto:BACKUP
)
) else (
attrib -s -h “C:\Windows\System32\spp\store\2.0\data.dat” /s /d
XCOPY C:\Windows\System32\spp\store\* Backup\store /s /i /y>nul
if %ver% LEQ 4 (
XCOPY C:\ProgramData\Microsoft\OfficeSoftwareProtectionPlatform Backup\OfficeSoftwareProtectionPlatform /s /i /y>nul
goto:start
goto:BACKUP
) else (
goto:start
goto:BACKUP
)
)
:RESTORE
cls
echo STOPPING SOME SERVICES FOR RESTORE ACTIVATION ...
net stop sppsvc>nul 2>nul
net stop osppsvc>nul 2>nul
echo Done.
for /f "tokens=6 delims=[.] " %%a in ('ver') do set ver1=%%a
if %ver1% LEQ 7601 (
echo RESTORING WINDOWS AND OFFICE LICENSE FILES ...
XCOPY Backup\SoftwareProtectionPlatform\* C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform /s /i /y
if %ver% LEQ 4 (
echo Done.
goto:restore1
) else (
XCOPY Backup\OfficeSoftwareProtectionPlatform\* C:\ProgramData\Microsoft\OfficeSoftwareProtectionPlatform /s /i /y
echo Done.
goto:restore1
)
) else (
echo RESTORING WINDOWS AND OFFICE LICENSE FILES ...
if %ver% LEQ 4 (
XCOPY Backup\store\* C:\Windows\System32\spp\store /s /i /y
XCOPY Backup\OfficeSoftwareProtectionPlatform\* C:\ProgramData\Microsoft\OfficeSoftwareProtectionPlatform /s /i /y
echo Done.
goto:restore1
) else (
XCOPY Backup\store\* C:\Windows\System32\spp\store /s /i /y
echo Done.
goto:restore1
)
)
:restore1
echo ACTIVATING WINDOWS AND OFFICE ...
sc config sppsvc start= auto >nul 2>nul& net start sppsvc >nul 2>nul
sc config osppsvc start= auto >nul 2>nul& net start osppsvc >nul 2>nul
sc config wuauserv start= auto >nul 2>nul& net start wuauserv >nul 2>nul
sc config LicenseManager start= auto >nul 2>nul& net start LicenseManager >nul 2>nul
cscript /nologo %windir%\system32\slmgr.vbs -rilc >nul 2>nul
cscript /nologo %windir%\system32\slmgr.vbs -dli >nul 2>nul
cscript /nologo %windir%\system32\slmgr.vbs -ato
cd C:\ >nul 2>nul
if exist "%ProgramFiles%\Microsoft Office\Office14\ospp.vbs" set folder="%ProgramFiles%\Microsoft Office\Office14"
if exist "%ProgramFiles(x86)%\Microsoft Office\Office14\ospp.vbs" set folder="%ProgramFiles(x86)%\Microsoft Office\Office14"
if exist "%ProgramFiles%\Microsoft Office\Office15\ospp.vbs" set folder="%ProgramFiles%\Microsoft Office\Office15"
if exist "%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs" set folder="%ProgramFiles(x86)%\Microsoft Office\Office15"
if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" set folder="%ProgramFiles%\Microsoft Office\Office16"
if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" set folder="%ProgramFiles(x86)%\Microsoft Office\Office16"
cscript //Nologo %folder%\ospp.vbs /act
cscript //Nologo %folder%\ospp.vbs /dstatus
echo Done.
echo Press any button to go restart...
pause>nul
shutdown.exe /r /t 00
goto:start