Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- :: Created by [173rd]D.Dodson for the 173rd Airborne Brigade - 173rd.us"
- :: Myself and the 173rd are not liable for data loss. It should not happen with this script but with technology it may. You use this at your own risk.
- :: Last revised 06/13/2017 @ 4:59 PM
- :: Revision 1.0.0
- :: Changes - Designed challenges prior to system changes for public release
- :: Needed - 1: A lot more tacos in my life
- :adminCheck
- SET BatDirectory=%~dp0
- NET FILE 1>NUL 2>NUL
- if '%errorlevel%' == '0' ( goto challenge ) else ( goto getPrivileges )
- :getPrivileges
- if '%1'=='ELEV' (shift & goto challenge )
- setlocal DisableDelayedExpansion
- set "batchPath=%~0"
- setlocal EnableDelayedExpansion
- ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
- ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
- "%temp%\OEgetPrivileges.vbs"
- EXIT /B
- :challenge
- CLS
- TITLE Squad Server Creator by [173rd]D.Dodson for the 173rd Airborne Brigade - 173rd.us
- ECHO ############################################################################
- ECHO # 173rd Airborne Brigade Squad Server Creator #
- ECHO # Created by [173rd]D.Dodson #
- ECHO # Version 1.0.0 #
- ECHO # This will setup the Squad server for you. #
- ECHO # #
- ECHO # Please ensure you have the following installed: #
- ECHO # 1: DirectX End-User Runtimes #
- ECHO # 2: Visual C++ Redistributable for Visual Studio 2013 and 2015 #
- ECHO # #
- ECHO # WARNING: NOT responsible for data loss - use at your own risk #
- ECHO ############################################################################
- ECHO Do you want to continue?
- ECHO.
- SET /P c=Please make your choice[Y/N]?
- IF /I "%c%" EQU "Y" GOTO :serverSetup
- IF /I "%c%" EQU "y" GOTO :serverSetup
- IF /I "%c%" EQU "N" GOTO :exit
- IF /I "%c%" EQU "n" GOTO :exit
- GOTO :challenge
- :serverSetup
- CLS
- TITLE Installing Squad Server
- ECHO What instance number of server is this?
- ECHO Please enter a number like 1,2,3,etc
- SET /P Instance=Please enter your choice:
- SET SquadDir="C:\Games\Squad"
- ECHO.
- ECHO What is the max numbers of players allowed? (Most use 80)
- SET /P Players=Number of Players:
- ECHO.
- ECHO What is the IP Address to listen on? (0.0.0.0 for single homed servers)
- SET /P IP=IP Address:
- ECHO.
- ECHO What port do you wish to listen on? (Default is 7787)
- SET /P Port1=Listening Port:
- ECHO.
- ECHO What port do you wish to query on? (Default is 27165)
- SET /P Port2=Query Port:
- ECHO.
- CLS
- ECHO ######################################################################
- ECHO ********** CHANGES ARE ABOUT TO BE COMMITED TO THE SYSTEM **********
- ECHO ######################################################################
- ECHO.
- ECHO Do you wish to continue?
- SET /P continue=Please make your choice[Y/N]?
- IF /I "%continue%" EQU "Y" GOTO :folders
- IF /I "%continue%" EQU "y" GOTO :folders
- IF /I "%continue%" EQU "N" GOTO :exit
- IF /I "%continue%" EQU "n" GOTO :exit
- GOTO :challenge
- :folders
- CLS
- TITLE Creating folder requirements for Squad Server
- IF NOT EXIST C:\Apps MKDIR C:\Apps & cacls C:\Apps /e /g Users:F & cacls C:\Apps /e /g Administrators:F & cacls C:\Apps /e /g System:F
- IF NOT EXIST C:\Apps\Temp MKDIR C:\Apps\Temp & cacls C:\Apps\Temp /e /g Users:F & cacls C:\Apps\Temp /e /g Administrators:F & cacls C:\Apps\Temp /e /g System:F
- IF NOT EXIST C:\Games MKDIR C:\Games & cacls C:\Games /e /g Users:F & cacls C:\Games /e /g Administrators:F & cacls C:\Games /e /g System:F
- IF NOT EXIST C:\Games\Squad MKDIR C:\Games\Squad & cacls C:\Games\Squad /e /g Users:F & cacls C:\Games\Squad /e /g Administrators:F & cacls C:\Games\Squad /e /g System:F
- CLS
- GOTO download
- :download
- CLS
- TITLE Dowloading requirements for Squad Server
- SET wget="C:\Apps\wget.exe"
- SET AppsDir="C:\Apps"
- SET TempDir="C:\Apps\Temp"
- bitsadmin.exe /transfer "WGET_Download" https://s3-us-west-2.amazonaws.com/gameserverrequirements/wget.exe C:\Apps\wget.exe
- %WGET% --no-check-certificate -P %TempDir% https://s3-us-west-2.amazonaws.com/gameserverrequirements/7za.exe
- %WGET% --no-check-certificate -P %TempDir% https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip
- DEL %WGET%
- CLS
- GOTO extract
- :extract
- CLS
- TITLE Extracting downloaded requirements for Squad Server
- cd %tempDir%
- 7za.exe x steamcmd.zip
- MOVE steamcmd.exe %AppsDir%\steamcmd.exe
- DEL /S /Q steamcmd.zip
- DEL /S /Q 7za.exe
- DEL /S /Q _start-example.bat
- DEL /S /Q _start-example.sh
- CD %appsDir%
- CLS
- GOTO continue
- :continue
- IF NOT EXIST Server%Instance% MKDIR %SquadDir%\Server%Instance% & cacls %SquadDir%\Server%Instance% /e /g Users:F & cacls %SquadDir%\Server%Instance% /e /g Administrators:F & cacls %SquadDir%\Server%Instance% /e /g System:F
- SET ServerDir="%SquadDir%\Server%Instance%"
- %AppsDir%\steamcmd.exe +login anonymous +force_install_dir %ServerDir% +app_update 403240 + validate +quit
- CLS
- CD %ServerDir%
- netsh advfirewall firewall add rule name="Squad Server - Server%Instance%" dir=in action=allow program="C:\Games\Squad\Server%Instance%\Squad\Binaries\Win64\SquadServer.exe" enable=yes
- TITLE Configuring Squad Server
- CLS
- ECHO START SquadServer.exe MULTIHOME=%IP% Port=%Port1% QueryPort=%Port2% FIXEDMAXPLAYERS=%Players% RANDOM=ALWAYS -log >> StartSquadServer%Instance%.bat
- CLS
- ECHO SquadServer install complete. Next Steps...
- ECHO 1: Move your config files into %SquadDir%\Server%Instance%\Squad\ServerConfig
- ECHO 2: Start the server with the file %SquadDir%\Server%Instance%\StartSquadServer%Instance%.bat
- PAUSE
- GOTO exit
- :exit
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement