To the pleasure of its fans, ARK has a really short update interval. This can however be infuriating for server administrators, so we set out to make your life a little bit easier: This script will automatically check whether there is a new update version, and in case there is, automatically update your server. The script is written in PowerShell (version 3 required). It will also inform your players before the update so that they can secure their stuff and log off in a safe location.
Requirements
- PowerShell 3.0 or higher: for Windows 2008 R2 / Windows 7 visit this Microsoft Info Page if you donât have it already.
- mcrcon
- Steamcmd
Installation
Save this text as update.cmd
[sourcecode toolbar=âtrueâ language=âplainâ title=âupdate.cmdâ]
@echo off
ver | find "2003" > nul
if %ERRORLEVEL% == 0 goto ver_2003
if not exist "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" goto install
"%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" -command "exit $PSVersionTable.PSVersion.Major"
set PSVer=%ERRORLEVEL%
if %PSVer% LSS 3 goto ps1
powershell -ExecutionPolicy unrestricted -File "%~dp0mainscript.ps1"
exit
:ps1
echo Powershell 2 is not supported.
pause
exit
:ver_2003
echo Windows 2003 is not supported.
pause
exit
:install
echo PowerShell is not installed
pause
exit
[/sourcecode]
Â
Save this text as mainscript.ps1
[sourcecode toolbar=âtrueâ language=âpowershellâ title=âmainscript.ps1âł]
$steamcmdFolder="C:\steamcmd"
$arksurvivalFolder="C:\arkserver"
$arksurvivalSteamScript="update_ark.txt"
$rconIP="127.0.0.1"
$rconPort=32330
$rconPassword="YOURPASSWORD"
$arkSurvivalStartArguments=$("TheIsland?QueryPort=27015?Port=7777?SetCheatPlayer=True?RCONEnabled=True?RCONPort="+$rconPort+"?listen")
$mcrconExec="C:\ARK-Scripts\mcrcon.exe"
$steamAppID="376030"
# Without clearing cache app_info_update may return old informations!
$clearCache=1
$scriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition
$dataPath = $scriptPath+"\data"
$steamcmdExec = $steamcmdFolder+"\steamcmd.exe"
$steamcmdCache = $steamcmdFolder+"\appcache"
$latestAppInfo = $dataPath+"\latestappinfo.json"
$updateinprogress = $arksurvivalFolder+"\updateinprogress.dat"
$latestAvailableUpdate = $dataPath+"\latestavailableupdate.txt"
$latestInstalledUpdate = $dataPath+"\latestinstalledupdate.txt"
If (Test-Path $updateinprogress) {
Write-Host Update is already in progress
} Else {
Get-Date | Out-File $updateinprogress
Write-Host Creating data Directory
New-Item -Force -ItemType directory -Path $dataPath
If ($clearCache) {
Write-Host Removing Cache Folder
Remove-Item $steamcmdCache -Force -Recurse
}
Write-Host Checking for an update
& $steamcmdExec +login anonymous +app_info_update 1 +app_info_print $steamAppID +app_info_print $steamAppID +quit | Out-File $latestAppInfo
Get-Content $latestAppInfo -RAW | Select-String -pattern â(?m)"public"\s*\{\s*"buildid"\s*"\d{6,}"â -AllMatches | %{$_.matches[0].value} | Select-String -pattern â\d{6,}â -AllMatches | %{$_.matches} | %{$_.value} | Out-File $latestAvailableUpdate
If (Test-Path $latestInstalledUpdate) {
$installedVersion = Get-Content $latestInstalledUpdate
} Else {
$installedVersion = 0
}
$availableVersion = Get-Content $latestAvailableUpdate
if ($installedVersion -ne $availableVersion) {
Write-Host Update Available
Write-Host Installed build: $installedVersion â available build: $availableVersion
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword "broadcast New update available, server is restarting in 10 minutes!"
Start-Sleep -s 300
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword "broadcast New update available, server is restarting in 5 minutes!"
Start-Sleep -s 240
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword "broadcast New update available, server is restarting in 1 minute!"
Start-Sleep -s 60
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword "broadcast New update available, server is restarting!"
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword "saveworld"
Start-Sleep -s 10
#Does not work atm
# & $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword "quit"
$pidARK = (Wmic process where "Commandline like â%$rconPort%â and Name=âShooterGameServer.exeâ" get ProcessId | findstr /r "[1-9][0-9]")
& taskkill /PID $pidARK
Start-Sleep -s 20
& $steamcmdExec +runscript $arksurvivalSteamScript
& $arksurvivalFolder"\ShooterGame\Binaries\Win64\ShooterGameServer.exe" $arkSurvivalStartArguments -nosteamclient -game -lowmemory -nosound -sm4 -server -log
$availableVersion | Out-File $latestInstalledUpdate
Write-Host Update Done!
}
Remove-Item $updateinprogress -Force
}
[/sourcecode]
This is an example of my steamscript (put this in the steamcmd root folder):
[sourcecode toolbar=âtrueâ language=âplainâ title=âupdate_ark.txtâ]
//ark
@ShutdownOnFailedCommand 1
@NoPromptForPassword 1
nSubscribedAutoDownloadMaxSimultaneous 32
@cMaxContentServersToRequest 16
@cMaxInitialDownloadSources 1
@fMinDataRateToAttemptTwoConnectionsMbps 0.01
@fDownloadRateImprovementToAddAnotherConnection 0.01
login anonymous
force_install_dir C:\arkserver\
app_update 376030
// validate
quit[/sourcecode]
How to use it?
Edit the variables of mainscript.ps1 so that it fits to your environment.
To run it in an interval just use the Windows Task Scheduler and bind the update.cmd to it.
Â
Hope we could help you with the automatic update script for windows!

âsupportedâ in English is with a âdâ at the end, just saying. Thank you for doing this đ
shame on me, sure it is đ changed it. thanks
Hi will this script work with windows 10?
(Powershell didnt say anything about win 10 support?)
Thanks
What is the $arksurvivalSteamScript=âupdate_ark-pve.txtâ?
My server runs on a PvP schedule. Wich means itâs PvP only between 18 and 21 at evening. Rest of the time is PvE. How to I implement this feature into this script?
Iâm using a program called System Scheduler Professional, to execute all my scheduled commands. Currently Iâm simply running my own version of an update script. Itâll update no matter if there is one. Ergo verify files. So this is def. needed here ^^
PvP / PvE doesnt matter. update_ark-pve.txt is a steamscript, i added my script to the post. đ
Okay so Iâve tried most things now. Pretty sure I named everything the right things. Still just get a quick black box that I canât catch with with print screen then nothing happens.
for debugging add a pause to the run.cmd
powershell -ExecutionPolicy unrestricted -File â%~dp0mainscript.ps1âłpause
exit
Done that and getting an error:
The system can not find the batch label specified â Install..
fixed that, but you need to install the PowerShell
%SystemRoot%\system32\WindowsPowerShell\v1.0 was not found on your system
Iâve just installed powershell 3, why do i need version 1?
http://stackoverflow.com/questions/13903312/where-is-the-v2-0-and-v3-0-folder-for-powershell
This should answer your question, but i wonder why it wont find your powershell folder, can u run âpowershellâ on the command line?
its not a versioncheck: http://stackoverflow.com/questions/13903312/where-is-the-v2-0-and-v3-0-folder-for-powershell
The path to powershell is correct and its installed, it opens an installer for an online casinoâŠ
Ohm a Virus?
Thats what it looks like to me. Which Os Version are you using
powershell -ExecutionPolicy unrestricted -File â%~dp0mainscript.ps1âł
thats what was loading in the installerâŠ.
i changed it to where my update.ps1 script is (your mainscript.ps1)
Getting this error now:
Get-Content : Cannot find path âE:\ARKSurvivalEvolved\autoupdate_script\data\latestinstalledupdate.txtâ
because it does not exist.
At E:\ARKSurvivalEvolved\autoupdate_script\update.ps1:33 char:21
Seems that your thing should be writing this file somewhere, but it must happen after this check.
oh that rly happens in a new environment, should be fixed with the new mainscript.ps1 đ
but my powershell script cant definitely not open casino stuff sites đ
and mainscript.ps1 is working fine for me
Getting the last updated value is working now, Theres a prob with the REGX you have posted it uses â instead of â changed that and it returns the correct version number
Well I think i have it working
Iâve deleted most of the code in the update.cmd to just:
powershell -ExecutionPolicy unrestricted -File âE:\ARKSurvivalEvolved\autoupdate_script\update.ps1â
Everythings working fine now i had to create the initial .txt files in the data directory.
At least server messages are broadcasting, have to wait to see if how the actual updating goes, once an update is released
Its not writing any values to the last updated and currerentversion files.
I dont think that reg ex you have is pulling anything out.
would be better if you could strip the response and get just the json data without all the extra steam connection stuff
Iâm not sure quite how to do that
So do you think this would run ok if I set it up with our current Firedaemon, which would turn the script into a service? Right now we run ark as a service through firedaemon and it basically takes care of everything if the server ever crashes. We have the update script ran as a pre-cursor to starting the server, but right now it takes an admin to saveworld and quit to start the updates.
I am hoping I can use your script with Firedaemon basically so that I get the automatic updating feature without losing the âif my server were to crash because its alpha lolâ it stays up.
i think it should work if use the same windows user for that service. But i have never used firedeamon before. Cant tell for sure đ
Itâs pretty nifty software. Basically, I would just turn your script into a windows service that would just automatically restart if it ever crashed. From what Iâve seen with your script, It takes care of everything else. And it all would run under the administrative user on my vds.
nice script but how can i use it when i rent a server from a hoster? in my case g-portal.com.
i dont think they use steam cmd or maybe i dont know. would love to use this script but dont know how. can you do a tutorial for server like this? where you have to edit configs @ your ftp
Would be great if the script created a back-up of the data in case an update comes with breaking changes that affects the data (like missing items). I think it may not be that hard to do, I guess it would be copying files into a directory, but Iâm not sure how ARK servers work though.
When I get the script to pause now and actually show me whatâs going on. Took me about 24 hours to get to here. Itâs just saying âPowerShell is not installedâ but when I try to go install it again, it just says that âUpdate was not installedâ. Not really sure whatâs going on here anymore. Sorry to say.
Also the version is now checked. Top says 2012 and version says 3.0.
does the folder C:\system32\WindowsPowerShell\v1.0\ exist?
Yeah it exists. Iâve done basically everything any other guide tells me to get Powershell 3.0 to work. And basically itâs installed, but the script wont read it.
http://i.imgur.com/uLQxEDF.png?1
http://i.imgur.com/W45S58d.png?1
http://i.imgur.com/c8wHykj.png?1
might be a permissions problem?
I had to perform the following in a command prompt:
powershell Set-ExecutionPolicy RemoteSigned
Still the same sadly.
Trying to get this script to work, once I launch the update.cmd it opens up the mainscript.ps1 and nothing more, then if I open up the .ps1 file in PowerShell and run it it says âUpdate is already in progressâ and then nothing happens.
Also, Iâm currently using a watchdog-script that will notice if the server crashes and will launch it if itâs down, am I suppose to use that script as the âsteamscriptâ, or is that only for the server update info?
Great release btw, been waiting for this!
Got the script to start, but when I run it this comes up.
http://i.imgur.com/6cX0eh1.png
I had a few problems like yours:
Iâve fixed most the problems in the script (thereâs no longer a check to see if powershell 3 is installed. and it works without needing any extra scripts).
The other problem i found was that the Quit server command does not exit the server so when after the server had updated it just created another server with the same settings, as the server is never actually shut down!
My script fixes that by killing the ShooterGameServer process, so its actually shut down.
You can download it from my drop box rename it to whatever.ps1
Right click it and choose edit, it should open in powershell:
Change all the settings marked #CHANGE ME â
You can run it in powershell first to check it works.
Then set it up in task manager to run every hr.
The file is at the following link
https://dl.dropboxusercontent.com/u/5769149/ark_server_updater.txt
Will definetly check this tomorrow. Hopefully it will give me ideas to what will solve my problems!
I got it to do everything but actually shutting down the process of my already running server.
Go to your task manager and click processes (while the server is running)
You should see ShooterGameServer in the list
thatâs the process that needs to be shutdown, can you see that in the processes list?
Are there any errors generated by the script?
Thank You so much for this! Got it working, but the only problem now is that the script wonât kill the current task that runs the server. I get this message:
http://i.imgur.com/FzFPJYT.png
Also a minor problem is one of the variables that shows the current version in one of those automatic announces. â$currentVersionâ doesnt seem to work, itâs just blank ingame. đ
For your script dizzy, instead of killing the actual process, there is a quit command that exists. Remote rcon does not work with cheat quit, but u can send a kill command, something like DoExit()
Ill look it up later when I get home, but I know the Arkon software implements it differently for remote users.
Have ARK changed how the info looks about build nr is showen ?
The command do not give any build nr anymore
& $steamcmdExec +login anonymous +app_info_update 1 +app_info_print $steamAppID +quit | Out-File $latestAppInfo
Get-Content $latestAppInfo -RAW | Select-String -pattern â(?m)âpublicâ\s*\{\s*âbuildidâ\s*â\d{6,}ââ -AllMatches | %{$_.matches[0].value} | Select-String -pattern â\d{6,}â -AllMatches | %{$_.matches} | %{$_.value} | Out-File $latestAvailableUpdate
it do not grab any build nr anymore
Seems thereâs a character thatâs being interpreted incorrectly when I downloaded your file⊠for line:
Get-Content $latestAppInfo -RAW | Select-String -pattern â(?m)âpublicâ\s*\{\s*âbuildidâ\s*â\d{6,}ââ -AllMatches | %{$_.matches[0].value} | Select-String -pattern â\d{6,}â -AllMatches | %{$_.matches} | %{$_.value} | Out-File $latestAvailableUpdate
the powershell window shows that it is seeing the â character (forward and backward single quotes) in â\d{6,}â as the lower case a with a caret over it and doesnât know what to do with it. What should those characters be?
There are a few other errors but I donât know if they are being caused by this one or not so I want to fix this one first.
Hi Dizzy,
Was just wondering if this was going to get updated, for some reason it is always returning a $latestAvailableUpdate of nothing.
Secondly I was wondering if you had a place to donate? Iâd love to support the development of this utility.
you need to check the data directory and make sure updateinprogress.dat is deleted,
if this file exists it thinks the update is already in progress and skips everything.
So how did you fix the âUpdate is already in progressâ message? Mineâs doing the same.
So use the one script from your dropbox vs the 3 from the start of the post?
yeah but it works best if you set up a cmd file that runs the script every hour, its much easier than using task manager, and the benefit it allows you to see the script running in the the cmd window
Hey Dizzy, first off â great utility, I love it. but I am confused when you say set up a cmd file to see it run? I have just used task scheduler to execute the script every hour, but I canât see output. The reason I ran it with task scheduler is so that I never have to touch the dedi box, the server runs at startup, with nightly reboots, all automatic. Any idea how I can get the task scheduler to show output?
a cmd file is just a simple text file with the .bat extension
my one looks like this:
@ECHO OFF
:START
CLS
ECHO ARK Server Auto Update and MOTD Script
ECHO.
powershell.exe -file E:\ARKSurvivalEvolved\autoupdate_script\update_test.ps1 cd âE:\ARKSurvivalEvolved\autoupdate_script\â
ECHO
ECHO.
GOTO START
It basically runs the cmd script as its at a cmd prompt youâll also see the output so you know its working.
once the powershell script finishes, it just runs it right again, so either updates or sends the MOTD messages instead
it will keep looping until its closed.
you can set that cmd file to run when the server starts with task scheduler, but again you wonât see the process window, thatâs the caveat with task scheduler
Hi, when i try to run the script, it only shows up a black box then it leaves.
Will this script work with PowerShell 4.0?
Never tried, so i really dont know sorry
Hi Bob, If you use the .ps1 from Dizzyâs drop box, yes â it works great just make sure you change all the variables to represent your sever.
Hey man, love the concept of the script but canât get it to work. It launches the steamcmd but just comes up with âCurrent version: 0 â Latest version: 725628â
Placed steamcmd in a folder, âD:\Arkâ and had it download the server/steam files there (D:\Ark\bin, D:\Ark\steamapps, etc) and use the following:
$steamcmdFolder=âD:\Arkâ
$arksurvivalFolder=âD:\Ark\steamapps\commonâ
Do I have that wrong?
Hi Dizzy,
Thanks for your great script but i have only one little problem. $currentVersion dont give any output. Do you have any suggestions how to fix this.
Thanks!
Iâve actually just realized mine does the same, I wonder if this will actually work as intended, or if I do not have it pointing to the right folder path. My ShooterGameServer.exe is located at C:\ArkServer\Servers\ShooterGame\Binaries\Win64
so I pointed the variable at
$arksurvivalFolder=âC:\ArkServer\Serversâ I hope this is correct. I guess weâll see tonight once 196 launches tonightâŠ
so it seems like this line;
& $steamcmdExec +login anonymous +app_info_update 1 +app_info_print $steamAppID +quit | Out-File $latestAppInfo
isnât actually printing all the the info that youâd get if you manually ran the app_info_print command from steamCMD, only part of it. I believe this might be causing the issue but I havenât found a way to fix it yet.
Did have the same problem did find some info on this web page âhttps://steamdb.info/forum/362/â about grabing buildid and from the command (csgo) ./steamcmd.sh +login anonymous +app_info_update 1 +app_info_print â740â +app_info_print â740â +quit
i did change my line to:
& $steamcmdExec +login anonymous +app_info_update 1 +app_info_print $steamAppID +app_info_print $steamAppID +quit | Out-File $latestAppInfo
I have no idea what i am doing but it do look like it works now and it grabs the build id now from the line:
PS C:\server files\ark\scripts> Get-Content $latestAppInfo -RAW | Select-String -pattern â(?m)âpublicâ\s*\{\s*âbuildidâ\s*â\d{6,}ââ -AllMatches | %{$_.matches[0].value} | Select-String -pattern â\d{6,}â -AllMatches | %{$_.matches} | %{$_.value}
725628
I keep getting this https://gyazo.com/1b1c5ae29838edc77c71d44d4117fa04
any help would be greatâŠ..btw if you have not figured it our Iâm a noob đ
Just had the same problem with the buildid just stopped working today
Thanks BlackHawk
I can confirm that change worked ok for me.
Iâve updated the files and also added a bat file so you can run that instead of using task manager
The .bat file just loops round and round until you close it, either updating if needed or displaying the MOTD
https://dl.dropboxusercontent.com/u/5769149/Voice%20Attack%20Conditions%20Tutorials.zip
think you have uploaded the wrong file to the dropbox or you have posted wrong link.
For me i am getting to âVoice Attack Conditions Tutorials.zipâ
Was going to check out your .bat file.
Thanks a ton Blackhawk, it worked, I however did notice that the $latestInstalledUpdate was never updating, so I threw this line into the bottom after everything completed;
$availableVersion | Out-File $latestInstalledUpdate â which will just keep the txt filed up to date⊠I hope- trying to get this fully automated is not as easy as I thought.
I did have same problem from the start with the latest version file. I canât remember now what I did change (il check later). I have allsow added a extra script so will be run before a upgrade so do copy the ark/world before an update and create a folder with timestamps.
And I do use a cmd file so runs with task manager every 1 hour for starting the upgrade script.
Dizzy, jacke or any one else if you want to talk about the script/ark I am to be found from time to time at teamspeak server ts.libcall.eu.
Yeah I have one set up to do the same, I also changed the line; $ArkSurvivalStartArguemnts to use Get-Content from my run_arkserver.bat so that I donâ have to update the script whenever I change something in the .bat.
One other thing Iâve noticed is more often that not it is never able to delete the updateinprogress.dat. as A resolution Iâve just commented out that if statement as it does a logical check of version numbers prior to updating anyways, and if it is already the most current version it will just end the script.
Script has been updated and i added a syntex plugin for WP so that the quotes doesnt kill the scripts
Hey,
How Can I use This Script With ARK Server Manager Can someone help me about that?
Ty,
I am having trouble hereâŠYahoo!
When I run the update cmd file it starts up cmd and goes through steam login which it said was successfulâŠ.. then it can find the server but the server gives no response!
I am running the server off a home PC and using this auto update on same said pc.
Questions are:
1. Do you know why server wont give a response? The server IP that I set in this script is 192.168.1.7 I tooled around and changed it to 192.168.1.32 and it couldnât find the server at all so I am positive that the 192.168.1.7 is correct.
2. Do I have to edit the mcrcon file at all? If so what values and which one?
Any response would make my day for sure! Thanks everyone!
Iâm getting through it. I tried to do the update logging in with my username and password but it failed â probably because Steam wasnât running so Iâm switching back to an anonymous login in steamcmd. But I do notice that in the line that checks for the update (around line 51) it fails if I have the comma after the 6.
It fails with this line. Note the comma after the 6
Get-Content $latestAppInfo -RAW | Select-String -pattern â(?m)âpublicâ\s*\{\s*âbuildidâ\s*â\d{6,}ââ -AllMatches | %{$_.matches[0].value} | Select-String -pattern â\d{6,}ââą -AllMatches | %{$_.matches} | %{$_.value} | Out-File $latestAvailableUpdate
This one works. I removed the comma after the 6,
Get-Content $latestAppInfo -RAW | Select-String -pattern â(?m)âpublicâ\s*\{\s*âbuildidâ\s*â\d{6}ââ -AllMatches | %{$_.matches[0].value} | Select-String -pattern â\d{6,}ââą -AllMatches | %{$_.matches} | %{$_.value} | Out-File $latestAvailableUpdate
So what is the purpose of the comma? With it in there, ISE shows a Missing expression after â,â
mahagon, Awesome, I was in the middle of writing a script and just came across yours.
You could just dump the scrips into pastebin and get rid of the WP â issue.
You should be able to use mcrcon to send âdoexitâ rather than killing the process
All I can say is thank you! With a few minor changes, this script works AMAZINGLY!
The script is not working any more for me!
This line seems broken:
$steamcmdExec +login anonymous +app_info_update 1 +app_info_print $steamAppID +app_info_print $steamAppID +quit | Out-File $latestAppInfo
The created file does not hold the output of the app_info_print command any more.
Looks like a problem/change on steamcmd.
LouPoh, Iâve been having the same issue. If you watch Task Manager when it calls steamcmd, steamcmd is crashing. Youâll see SteamErrorReporter.exe running and 90% of the time in the steamcmd/dump folder youâll see crashdumps from steamcmd.exe
The weird thing is, if you launch steamcmd normally it works just fine. it only crashes when another program tries to execute steamcmd. I tried with a Python script as well and Iâm getting the same results, steamcmd.exe crashing.
I found a solution!
Instead of â+app_info_print $steamAppID +app_info_print $steamAppIDâ you have to use â+app_info_print $steamAppID +app_info_print $steamAppID +app_info_print $steamAppID +app_info_print $steamAppIDâ!
So basically just double again the, already doubled command(+app_info_print $steamAppID), and it then magically works(!), but please dont ask me why or how long it took me to find this out. lol
Hope that helps.
Nice job. Steam Error Reporter still pops up but that worked. Weird.
I wonder if this is related to the issue I have been having? Basically, the server update script works fine for a few days, then one day it will quit. I have to go into the data folder and delete latestinstalledupdate.txt and then run the script again. Without that file, it forces the update. Or maybe this is a different issue all together and someone else has a fix for it. đ
I tried this and the script worked without me having to delete thelatestinstalledupdate.txt file like I have been having to do in order to get it to update. I will let it go for about a week or two and stop back to let you know the progress. Hereâs hoping for the best!
Itâs been about a week and a half since I added that line to the script. Everything has been working great ever since. Thank you!!!
This script stoped working for me to i have no idea about powershell but if anybody can edit the script so it works by grabing version number from webpageâhttp://arkdedicated.com/versionâ
I am thinking this command can be a good start
$URI = âhttp://arkdedicated.com/versionâ
$HTML = Invoke-WebRequest -Uri $URI
$HTML.content |out-file $latestAppInfo
and it will print the version number to file atm â231.0â
Then edit it so script shows the version number all understand and not the XXXXX number so steamcmd did list. ( broken atm)
There are some people who commented on this topic who get the script to work again (perhaps this will work for you)- we try to reach Mahagon, if he can fix the auto-update Script.
This updater has a fatal flaw in it that will break it should the update fail for any reason.
The updater should not be checking a text file it created for the current installed version, it should be checking the Ark/steamapps folder and reading the app manifest for the correct current version of ark.
It should be checking ArkInstallFolder/steamapps/appmanifest_376030.acf for buildid like it does from the steamcmd json it downloads. I am terrible with regex or I would fix it myself.
The command would be
Get-Content $GameDataManifest -RAW | Select-String -pattern â(?m)âbuildidâ\s*â\d{6,}ââ -AllMatches | %{$_.matches[0].value} | Select-String -pattern â\d{6,}â -AllMatches | %{$_.matches} | %{$_.value}
$GameDataManifest would be defined to the location of the .acf file.
In a similar spirit we published this info about our PS1 script that manages our testing servers StartUp and Reboot. Hope it is helpful
http://steamcommunity.com/sharedfiles/filedetails/?id=599415995
Nevermind my 2 posts. I read the comment from LouPoh and it fixed my problem, now iâm stuck with 3 posts I cannot delete.
I deleted them đ yeah the solution was found from some commentators. Have a good time in ARK!
just leave it here.
if((Test-Path âD:\ARKserver\SteamCMDâ) -eq $false) {
New-Item -Path âD:\ARKserver\SteamCMDâ -ItemType âdirectoryâ
$url = âhttps://steamcdn-a.akamaihd.net/client/installer/steamcmd.zipâ
$output = âD:\ARKserver\SteamCMD\steamcmd.zipâ
$start_time = Get-Date
Invoke-WebRequest -Uri $url -OutFile $output
Write-Output âTime taken: $((Get-Date).Subtract($start_time).Seconds) second(s)â
unzip â$outputâ âD:\ARKserver\SteamCMDâ
remove-item âD:\ARKserver\SteamCMD\steamcmd.zipâ -Recurse
}
function unzip ($archive, $destination) {
$shell = new-object -com shell.application
$zip = $shell.NameSpace($archive)
foreach($item in $zip.items()) {
$shell.Namespace($destination).copyhere($item)
}
}
For those of you who work better off of a video, I made one! I also have the modified scripts that I use available for download. Enjoy! https://www.youtube.com/watch?v=Pthu_7S8hWk
Thanks for the Video â that will help some people đ Can I link it in the article?
Hmmm it really dosenât seem to workâŠ
I am putting it up agianst a server launched with Ark Manager, why because i have never gotten the Ark Manager software to automatic update the server if there is a update to the gameâŠ
So i have powershell, can start it by the command promptâŠ
got mrcron installed and move to the ark folder
have created the update.cmd
my script
@echo off
ver | find â2003â > nul
if %ERRORLEVEL% == 0 goto ver_2003
if not exist â%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exeâ goto install
â%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exeâ -command âexit $PSVersionTable.PSVersion.Majorâ
set PSVer=%ERRORLEVEL%
if %PSVer% LSS 3 goto ps1
powershell -ExecutionPolicy unrestricted -File â%~dp0mainscript.ps1âł
exit
:ps1
echo Powershell 2 is not supported.
pause
exit
:ver_2003
echo Windows 2003 is not supported.
pause
exit
:install
echo PowerShell is not installed
pause
exit
and the mainscript.ps1
$steamcmdFolder=âC:\Ark Manager\steamcmdâ
$arksurvivalFolder=âC:\Ark Manager\steamcmd\Serversâ
$arksurvivalSteamScript=âupdate_ark.txtâ
$rconIP=â127.0.0.1âł
$rconPort=32330
$rconPassword=âThis password is hiddenâ
$arkSurvivalStartArguments=$(âTheIsland?QueryPort=27015?Port=7777?SetCheatPlayer=True?RCONEnabled=True?RCONPort=â+$rconPort+â?listenâ)
$mcrconExec=âC:\Ark Manager\mrcron\mcrcon.exeâ
$steamAppID=â376030âł
# Without clearing cache app_info_update may return old informations!
$clearCache=1
$scriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition
$dataPath = $scriptPath+â\dataâ
$steamcmdExec = $steamcmdFolder+â\steamcmd.exeâ
$steamcmdCache = $steamcmdFolder+â\appcacheâ
$latestAppInfo = $dataPath+â\latestappinfo.jsonâ
$updateinprogress = $arksurvivalFolder+â\updateinprogress.datâ
$latestAvailableUpdate = $dataPath+â\latestavailableupdate.txtâ
$latestInstalledUpdate = $dataPath+â\latestinstalledupdate.txtâ
If (Test-Path $updateinprogress) {
Write-Host Update is already in progress
} Else {
Get-Date | Out-File $updateinprogress
Write-Host Creating data Directory
New-Item -Force -ItemType directory -Path $dataPath
If ($clearCache) {
Write-Host Removing Cache Folder
Remove-Item $steamcmdCache -Force -Recurse
}
Write-Host Checking for an update
& $steamcmdExec +login anonymous +app_info_update 1 +app_info_print $steamAppID +app_info_print $steamAppID +quit | Out-File $latestAppInfo
Get-Content $latestAppInfo -RAW | Select-String -pattern â(?m)âpublicâ\s*\{\s*âbuildidâ\s*â\d{6,}ââ -AllMatches | %{$_.matches[0].value} | Select-String -pattern â\d{6,}â -AllMatches | %{$_.matches} | %{$_.value} | Out-File $latestAvailableUpdate
If (Test-Path $latestInstalledUpdate) {
$installedVersion = Get-Content $latestInstalledUpdate
} Else {
$installedVersion = 0
}
$availableVersion = Get-Content $latestAvailableUpdate
if ($installedVersion -ne $availableVersion) {
Write-Host Update Available
Write-Host Installed build: $installedVersion â available build: $availableVersion
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword âbroadcast New update available, server is restarting in 10 minutes!â
Start-Sleep -s 300
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword âbroadcast New update available, server is restarting in 5 minutes!â
Start-Sleep -s 240
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword âbroadcast New update available, server is restarting in 1 minute!â
Start-Sleep -s 60
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword âbroadcast New update available, server is restarting!â
& $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword âsaveworldâ
Start-Sleep -s 10
#Does not work atm
# & $mcrconExec -c -H $rconIP -P $rconPort -p $rconPassword âquitâ
$pidARK = (Wmic process where âCommandline like â%$rconPort%â and Name=âShooterGameServer.exe'â get ProcessId | findstr /r â[1-9][0-9]â)
& taskkill /PID $pidARK
Start-Sleep -s 20
& $steamcmdExec +runscript $arksurvivalSteamScript
& $arksurvivalFolderâ\ShooterGame\Binaries\Win64\ShooterGameServer.exeâ $arkSurvivalStartArguments -nosteamclient -game -lowmemory -nosound -sm4 -server -log
$availableVersion | Out-File $latestInstalledUpdate
Write-Host Update Done!
}
Remove-Item $updateinprogress -Force
}
and i have put it in the windows task manager to run every 15 minute, right now the server is 239.2 and Ark Manager informs me there is a 239.3 online, so i just waited for 30 minutes and nothing happends?
it donât update even that there is a update? what have i done wrong?
I finally have it running error-free but it isnât working as advertised. First, it doesnât kill the current process. An earlier post said weâd see a process called ShooterGameServer but I only see ShooterGame. When I change the script to kill ShooterGame, it says no such process, so I put it back to ShooterGameServer.
Second, it tells me that thereâs an update already in progress. It put a json file and a text file in the data directory but no .dat file. I tried deleting those two files and it still says update is already in progress and it didnât recreate those two files.
What did I miss?
Ignore my previous post⊠got all that working. Now Iâm working on small improvements.
Way back in January, Denalb suggested using Get-Content $GameDataManifest -RAW | Select-String -pattern â(?m)âbuildidâ\s*â\d{6,}ââ -AllMatches | %{$_.matches[0].value} | Select-String -pattern â\d{6,}â -AllMatches | %{$_.matches} | %{$_.value} to get the current version.
That works except it returns a value with an extra digit. The query for the latest version available returns 111667 but the installed version that appears in the .acf file is 1116672. So of course they donât match and it continues to try to do an update every cycle. So whatâs the extra digit? Am I safe only taking the first six digits from the .acf file every time?
Got it⊠just removed the comma after the 6 in the select-string portion of the line. This limits it to the first six characters only.
First of all, thank you for those amazing scripts and we really appreciate it. We usually update our servers manually.. its a hassle as you know.
my question is, we run 2 ark servers on 1 dedicated server, and the first one âShooterGameServer1.exeâ and the second one named âShooterGameServer2.exeâ
and I see in this like below you have the get ProcessID as the name ShooterGameServer.exe
$pidARK = (Wmic process where âCommandline like â%$rconPort%â and Name=âShooterGameServer.exe'â get ProcessId | findstr /r â[1-9][0-9]â)
so we got confused, and we wanted to know what do we really have to change for this script to work with our 1 and 2 server ? we woud like each one to have diff check times for the updates so they wonât be both down on the same time. can you tell us what should we be changing and thank you for your support!
I know this may be old, but I wrote my own version of dotnet core here. It should work for Linux, Mac and Windows by changing your path in code:
https://github.com/akira32810/dotnet_core/tree/master/GoogleDriveUpdate_ArkUpdate