105 lines
2.1 KiB
Batchfile
105 lines
2.1 KiB
Batchfile
@echo off
|
|
setlocal
|
|
REM TNG Microsoft Office Activate
|
|
|
|
REM Initial checks
|
|
echo Checking if you're connected to the Technolog internal network...
|
|
REM ping 10.0.1.1
|
|
REM ping 10.0.1.2
|
|
if %errorlevel% neq 0 goto oops1
|
|
ping technologsvr.technolog.net
|
|
|
|
echo Checking for elevation
|
|
net config server
|
|
if %errorlevel% neq 0 goto oops2
|
|
|
|
cd %systemroot%\system32
|
|
goto officepicker
|
|
|
|
:officepicker
|
|
if exist "c:\program files (x86)\microsoft office\office12" goto office2007
|
|
if exist "c:\program files (x86)\microsoft office\office14" goto office2010
|
|
if exist "c:\program files (x86)\microsoft office\office15" goto office2013
|
|
if exist "c:\program files (x86)\microsoft office\office16" goto office2016
|
|
goto oops3
|
|
|
|
|
|
:office2007
|
|
set ofver=of2007
|
|
set ofpath=office12
|
|
echo %ofver% %ofpath%
|
|
goto activate
|
|
|
|
:office2010
|
|
set ofver=of2010
|
|
set ofpath=office14
|
|
echo %ofver% %ofpath%
|
|
goto activate
|
|
|
|
:office2013
|
|
set ofver=of2013
|
|
set ofpath=office15
|
|
echo %ofver% %ofpath%
|
|
goto activate
|
|
|
|
:office2016
|
|
set ofver=of2016
|
|
set ofpath=office16
|
|
echo %ofver% %ofpath%
|
|
echo why the fuck are you using this? LOL
|
|
goto activate
|
|
|
|
:activate
|
|
REM activation portion
|
|
REM timeout 5
|
|
|
|
cscript "c:\program files (x86)\microsoft office\%ofpath%\ospp.vbs" /sethst:technologsvr.technolog.net
|
|
|
|
cscript "c:\program files (x86)\microsoft office\%ofpath%\ospp.vbs" /act
|
|
if %errorlevel% neq 0 goto oops4
|
|
|
|
REM timeout 15
|
|
echo TNG Office Activated, %ofver% - %computername% %date% %time% with %logondomain%_%username% >> "\\technologsvr\batchlogs$\officeactlog"
|
|
|
|
endlocal
|
|
goto :eof
|
|
|
|
REM Functions
|
|
|
|
:oops1
|
|
REM Network Fail
|
|
|
|
cls
|
|
color c
|
|
echo You don't seem to be conneted to the TNG Network.
|
|
echo Please connect to it to continue.
|
|
timeout 5
|
|
goto :eof
|
|
|
|
:oops2
|
|
REM Elevation Fail
|
|
|
|
color c
|
|
echo You don't seem to be elevated, you twat. XD
|
|
echo Elevation is required. Right click and run as admin, or contact your sysadmin.
|
|
timeout 5
|
|
goto :eof
|
|
|
|
:oops3
|
|
REM OS Unsupported
|
|
|
|
cls
|
|
color c
|
|
echo Your office isn't recognized or supported.
|
|
echo am confuse.
|
|
timeout 5
|
|
goto :eof
|
|
|
|
:oops4
|
|
REM Activation Fail
|
|
|
|
echo An error has occurred- please refer to the above for more information.
|
|
echo Send to your local sysadmin if necesssary.
|
|
pause
|
|
goto :eof
|