├── psrconexample.ps1 ├── LICENSE ├── update-asa-server.ps1 ├── setup-asa-server.ps1 ├── ScheduleTasks.md └── README.md /psrconexample.ps1: -------------------------------------------------------------------------------- 1 | # Set your RCON details and replace the values with your Server IP and Server Admin password. 2 | $serverHost = "Enter Ark Server IP or DNS" # Your ARK server IP address such as 192.168.1.200 3 | $port = "Enter rcon port" # Your RCON port such at 27020 4 | $password = "Enter Ark Server Admin Password" # Your RCON password which is the ark server admin password 5 | 6 | # Define the RCON command to destroy wild dinos 7 | $rconCommand = "SaveWorld" 8 | 9 | # Construct the mcrcon command pointing to the mcrcon path such as the port below 10 | $mcrconCommand = "D:\rcon\mcrcon\mcrcon.exe -H $serverHost -P $port -p $password $rconCommand" 11 | 12 | # Execute the mcrcon command 13 | Invoke-Expression -Command $mcrconCommand -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 John 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /update-asa-server.ps1: -------------------------------------------------------------------------------- 1 | # Prompt for the SteamCMD installation directory 2 | $steamCmdPath = Read-Host "Enter the path where SteamCMD is installed" 3 | 4 | # Check if the SteamCMD path exists 5 | if (-not (Test-Path $steamCmdPath)) { 6 | Write-Host "SteamCMD directory does not exist at $steamCmdPath. Please make sure it's installed first." 7 | exit 8 | } 9 | 10 | # Prompt for the ARK server installation directory 11 | $installPath = Read-Host "Enter the path where your ARK: Survival Ascended server is installed" 12 | 13 | # Check if the ARK server path exists 14 | if (-not (Test-Path $installPath)) { 15 | Write-Host "ARK server directory does not exist at $installPath. Please make sure the server is installed first." 16 | exit 17 | } 18 | 19 | # Specify the full path to your start.bat file 20 | $arkServerCmd = Join-Path $installPath "ShooterGame\Binaries\Win64\start.bat" 21 | 22 | # Check if the start.bat file exists 23 | if (-not (Test-Path $arkServerCmd)) { 24 | Write-Host "start.bat file does not exist at $arkServerCmd. Please verify the path and create it if necessary." 25 | exit 26 | } 27 | 28 | $forceInstallDir = "+force_install_dir $installPath" 29 | $appUpdate = "+app_update 2430930 validate" 30 | 31 | # Run the update command using SteamCMD 32 | $steamCmdPath = Join-Path $steamCmdPath "steamcmd.exe" 33 | & $steamCmdPath $forceInstallDir "+login anonymous" $appUpdate "+quit" 34 | 35 | # Start the ARK: Survival Ascended server 36 | Start-Process -FilePath $arkServerCmd -NoNewWindow 37 | 38 | # Check if the ARK server process is running 39 | $arkProcess = Get-Process -name "arkascendedserver" -ErrorAction SilentlyContinue 40 | if ($null -ne $arkProcess) { 41 | Write-Host "ARK: Survival Ascended server has been updated and is running." 42 | } else { 43 | Write-Host "ARK: Survival Ascended server update completed, but the server process is not running. Please check for errors." 44 | } 45 | -------------------------------------------------------------------------------- /setup-asa-server.ps1: -------------------------------------------------------------------------------- 1 | # Prompt for the SteamCMD installation directory 2 | $steamCmdPath = Read-Host "Enter the path where you want to install SteamCMD" 3 | 4 | # Create the directory if it doesn't exist 5 | if (-not (Test-Path $steamCmdPath)) { 6 | New-Item -Path $steamCmdPath -ItemType Directory 7 | } 8 | 9 | # Specify the path to the SteamCMD executable 10 | $steamCmdExecutable = Join-Path $steamCmdPath "steamcmd.exe" 11 | 12 | # Check if SteamCMD is already installed 13 | if (Test-Path $steamCmdExecutable) { 14 | Write-Host "SteamCMD is already installed at $steamCmdPath." 15 | } else { 16 | # If it doesn't exist, download and extract SteamCMD 17 | $steamCmdUrl = "https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip" 18 | $steamCmdZip = Join-Path $env:TEMP "steamcmd.zip" 19 | 20 | Invoke-WebRequest -Uri $steamCmdUrl -OutFile $steamCmdZip 21 | Expand-Archive -Path $steamCmdZip -DestinationPath $steamCmdPath 22 | Remove-Item -Path $steamCmdZip 23 | 24 | Write-Host "SteamCMD has been downloaded and extracted to $steamCmdPath." 25 | } 26 | 27 | # Store the start.bat content 28 | $startBatContent = Read-Host "Enter the start.bat content (e.g., start ArkAscendedServer.exe TheIsland_WP?listen?SessionName=ServerName?ServerAdminPassword=AdminPassword?Port=7777?QueryPort=27015?MaxPlayers=26 -UseBattlEye)" 29 | 30 | # Prompt for the ARK server installation directory 31 | $installPath = Read-Host "Enter the path where you want to install the ARK server" 32 | 33 | # Check if the ARK server path already exists 34 | if (Test-Path $installPath) { 35 | Write-Host "ARK server directory already exists at $installPath. Proceeding to update ARK server..." 36 | } else { 37 | # If it doesn't exist, create the directory and install the ARK server 38 | New-Item -Path $installPath -ItemType Directory 39 | Write-Host "ARK server directory does not exist. Continuing to install ARK server..." 40 | } 41 | 42 | # Create the necessary directory structure 43 | $gameBinPath = Join-Path $installPath "ShooterGame\Binaries\Win64" 44 | if (-not (Test-Path $gameBinPath)) { 45 | New-Item -Path $gameBinPath -ItemType Directory 46 | } 47 | 48 | # Create start.bat in the Win64 folder 49 | $startBatPath = Join-Path $gameBinPath "start.bat" 50 | Set-Content -Path $startBatPath -Value $startBatContent 51 | 52 | Write-Host "start.bat has been created in $startBatPath." 53 | 54 | # Install or update ARK server 55 | $arkServerCmd = Join-Path $steamCmdPath "steamcmd.exe" 56 | $forceInstallDir = "+force_install_dir $installPath" 57 | $appUpdate = "+app_update 2430930 validate" 58 | 59 | & $arkServerCmd $forceInstallDir "+login anonymous" $appUpdate "+quit" 60 | 61 | Write-Host "ARK server installed or updated in $installPath." 62 | 63 | # You can customize the ARK server startup command here 64 | Write-Host "You can start the ARK server with the following command:" 65 | Write-Host "$installPath\ShooterGame\Binaries\Win64\start.bat" -------------------------------------------------------------------------------- /ScheduleTasks.md: -------------------------------------------------------------------------------- 1 | Automating ARK: Survival Ascended Server Management with Scheduled Tasks 2 | 3 | If you're running an ARK: Survival Ascended server, you know how important it is to keep it updated, send RCON commands, and ensure a smooth shutdown. Automating these tasks through scheduled tasks can save you time and make server maintenance a breeze. 4 | 5 | 1. Updating the Server: 6 | 7 | One of the critical tasks is keeping your server updated with the latest patches and content. To automate this, you can create a scheduled task to run the "update-ark-ascended-server.ps1" script at a specific time, such as midnight. Here's how: 8 | 9 | Open Task Scheduler on your Windows server. 10 | Click "Create Basic Task" and follow the wizard. 11 | Choose a name for the task, e.g., "ARK Server Update." 12 | Set the trigger to "Daily" and choose the time (midnight). 13 | Select "Start a Program" as the action. 14 | Browse to the location of your PowerShell script (update-ark-ascended-server.ps1). 15 | Complete the wizard, and the task will run your script automatically at the scheduled time. 16 | 2. Sending RCON Commands: 17 | 18 | If you want to send RCON commands at specific intervals, for example, to announce a server restart, you can create another scheduled task. Here's how: 19 | 20 | Create a new scheduled task as before, but this time choose a different name like "ARK RCON Announce." 21 | Set the trigger according to your desired schedule (e.g., 15 minutes before the daily restart). 22 | Choose "Start a Program" as the action. 23 | Use PowerShell to execute the RCON command: 24 | powershell 25 | Copy code 26 | $serverHost = "Enter Ark Server IP or DNS" 27 | $port = "Enter RCON port" 28 | $password = "Enter Ark Server Admin Password" 29 | $rconCommand = "broadcast Server restart in 15 minutes. Prepare to log off." 30 | 31 | $mcrconCommand = "D:\rcon\mcrcon\mcrcon.exe -H $serverHost -P $port -p $password $rconCommand" 32 | 33 | Invoke-Expression -Command $mcrconCommand 34 | This will send an RCON command 15 minutes before your daily server restart. You can create additional tasks for the 10, 5, and 1-minute warnings. 35 | 36 | 3. Graceful Shutdown: 37 | 38 | To shut down your server gracefully, create one more scheduled task: 39 | 40 | Name it "ARK Server Shutdown." 41 | Set the trigger for the desired shutdown time (e.g., right at midnight). 42 | Choose "Start a Program" as the action. 43 | Run a command to send an RCON command for the shutdown: 44 | powershell 45 | Copy code 46 | $serverHost = "Enter Ark Server IP or DNS" 47 | $port = "Enter RCON port" 48 | $password = "Enter Ark Server Admin Password" 49 | $rconCommand = "broadcast Server is shutting down. Save your progress." 50 | 51 | $mcrconCommand = "D:\rcon\mcrcon\mcrcon.exe -H $serverHost -P $port -p $password $rconCommand" 52 | 53 | Invoke-Expression -Command $mcrconCommand 54 | After sending the RCON command, you can add a delay to allow players to prepare, and then use another command to shut down the server. This ensures that your server is handled with care, and your players have time to save their progress. 55 | 56 | By creating these scheduled tasks, you can automate essential server management processes and keep your ARK: Survival Ascended server running smoothly. It's a great way to ensure your server is always up-to-date, your players are informed, and your server shuts down gracefully when needed. Happy server management! -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ARK: Survival Ascended Server Setup Script 2 | 3 | This PowerShell script automates the process of setting up an ARK: Survival Ascended server using SteamCMD on Windows. It allows you to download SteamCMD, install or update the ARK: Survival Ascended server, and create a start.bat file for launching the server. 4 | 5 | ## Video Tutorial 6 | 7 | I made a video showcasing and explaining what the code is doing: 8 | https://youtu.be/KuX95wxdd6w 9 | 10 | ## Prerequisites 11 | 12 | - Windows operating system 13 | - PowerShell (Ensure Set-ExecutionPolicy is set to Unrestricted for script execution) 14 | - Internet connection for downloading SteamCMD and server files 15 | - DirectX: https://www.microsoft.com/en-us/download/details.aspx?id=35 16 | - Microsoft Redistributables: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170 17 | 18 | ## Instructions 19 | 20 | ### Clone or Download: 21 | 22 | Download or clone this repository to your local machine. 23 | 24 | ### Set Execution Policy: 25 | 26 | Before running the script, make sure your PowerShell execution policy is set to Unrestricted. You can do this by running PowerShell as an administrator and executing the following command: 27 | 28 | ```powershell 29 | Set-ExecutionPolicy Unrestricted 30 | ``` 31 | This is required to run scripts that are not digitally signed. 32 | 33 | ### Run the Script: 34 | Open a PowerShell terminal and navigate to the directory where the script is located. Run the script by executing: 35 | 36 | ```powershell 37 | .\setup-asa-server.ps1 38 | ``` 39 | Follow Prompts: 40 | You will be prompted to enter the path where you want to install SteamCMD. If SteamCMD is already installed at the specified path, it will not be re-downloaded. Next, you will be prompted to enter the path where you want to install the ARK: Survival Ascended server. If the directory does not exist, it will be created. The script will download SteamCMD (if needed), install or update the ARK: Survival Ascended server, and create a start.bat file in the Win64 folder for server startup. 41 | 42 | ### Start the ARK: Survival Ascended Server: 43 | After the script completes, you can start the ARK: Survival Ascended server by executing the start.bat file located in the Win64 folder within your installation directory. 44 | 45 | For example: 46 | 47 | ```powershell 48 | cd C:\ARKServer\ShooterGame\Binaries\Win64 49 | start.bat 50 | ``` 51 | Customization: 52 | You can customize the start.bat file with additional server startup options as needed. 53 | 54 | ### ARK: Survival Ascended Server Update Script 55 | This script is used to update an existing ARK: Survival Ascended server. It assumes that SteamCMD and the server files are already installed. 56 | 57 | To use the update script, follow the same instructions as above for setting the execution policy, then run the script: 58 | 59 | ```powershell 60 | .\update-ark-ascended-server.ps1 61 | ``` 62 | 63 | You will be prompted to enter the path where the ARK: Survival Ascended server is installed. The script will update the server using AppID 2430930. 64 | 65 | ### Running RCON Commands Example 66 | This example script demonstrates how to execute RCON commands on your ARK: Survival Ascended server using mcrcon. 67 | 68 | Prerequisites 69 | mcrcon - A command-line RCON client for ARK server administration. 70 | 71 | # Set your RCON details and replace the values with your Server IP, RCON port, and Server Admin password. 72 | ```powershell 73 | $serverHost = "Enter Ark Server IP or DNS" # Your ARK server IP address such as 192.168.1.200 74 | $port = "Enter RCON port" # Your RCON port such as 27020 75 | $password = "Enter Ark Server Admin Password" # Your RCON password (ARK server admin password) 76 | 77 | # Define the RCON command you want to execute (e.g., "SaveWorld"). 78 | $rconCommand = "SaveWorld" 79 | 80 | # Construct the mcrcon command pointing to the mcrcon path such as the port below 81 | $mcrconCommand = "D:\rcon\mcrcon\mcrcon.exe -H $serverHost -P $port -p $password $rconCommand" 82 | 83 | # Execute the mcrcon command 84 | Invoke-Expression -Command $mcrconCommand 85 | ``` 86 | 87 | ### License 88 | This script is provided under the MIT License. 89 | 90 | Please replace "setup-asa-server.ps1" with the actual name of your PowerShell script for setting up the ARK: Survival Ascended server if it's different. --------------------------------------------------------------------------------