Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # IdiotsInc Ark Server Backup Script
- # Written by @Zebwen - 26-01-2016
- # Gets the current date and time and formats it nicely so we can name the output file at the end.
- $backuptime = Get-Date -Format "yyyy-M-d-(HH.mm)"
- # Sets the location to copy the raw saved files to.
- $backuplocation = "C:\Ark\Backups\YourServer"
- # Sets the location of the Ark save folder you want to back up.
- $arksavefolder = "C:\Ark\ArkData\YourServer-Data\ShooterGame\Saved"
- # Sets the location of the Ark profiles folder you want to back up.
- # This is the profile for Ark Server Manager. Comment this line out if you do not use this tool.
- $arkprofilefolder = "C:\Ark\ArkData\Profiles"
- # Sets the location of the off-server network share to copy the final zip file to.
- $networkcopylocation = "\\server-pc\arkshare"
- # Do a raw copy of the current save files to the backup location.
- Copy-Item $arksavefolder "$backuplocation\Saved\" -Recurse
- Copy-Item $arkprofilefolder "$backuplocation\Profiles\" -Recurse
- # Funny looking bit of code that zips up the folders we just copied.
- [Reflection.Assembly]::LoadWithPartialName( "System.IO.Compression.FileSystem" )
- $destfile = "C:\Ark\Backups\$backuptime-ArkServerBackup.zip"
- $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
- $includebasedir = $false
- [System.IO.Compression.ZipFile]::CreateFromDirectory("$backuplocation",$destfile,$compressionLevel, $includebasedir )
- # Copies the zip file to the network location.
- Copy-Item $destfile $networkcopylocation
- # Deletes the temporary files from the backup location now they have been copied to the network share.
- Remove-Item "$backuplocation\Saved\" -Recurse
- Remove-Item "$backuplocation\Profiles\" -Recurse
- # Un-comment the below line to also remove the zip file. Going to keep this on the server for now though.
- #Remove-Item $destfile
Advertisement
Add Comment
Please, Sign In to add comment