Sunday, June 15, 2014

Space Engineers Management Console (SEMC) v 1.0

hey all.

i've been working on a management console for my space engineer servers. here is a link below.
http://www.denalicomputer.com/fileserver/SEMC.zip

prereq's:
  • powershell on your computer (i developed this on windows 8, it should work on windows 7 as well)
  • an open execution-policy
  • a SE server running as a service. - you will need to rename the servers in the powershell script to match your own. mine are called 'service' and 'public server.
current features:
  • see the tail end of the log files for servers
  • start stop servers running as services
  • launch config file direct from console
future features:
  • see how many people are online in your servers
  • see who is on your servers
  • ability to create servers
  • running servers as services without having to use the dedicated server app provided. 


you will need to set your execution policy to unrestricted. click here to see how that's done. http://akmattb.blogspot.com/2014/06/ps1-cannot-be-loaded-because-running.html

If you want to see the code before you download it, here it is.

do {
    #    I run two servers, one for friends and one for the public, you should change your service names
    #    to whatever they actually are here. Mine is simply called 'Service' and 'Public Server'.
    $PrivateServer = Get-Service -name "Service"
    $PublicServer = Get-Service -name "Public Server"
   
    clear
    write-host "akmattb's Space Engineers Management Console v 1.0"
    write-host "=====  Most Recent Log File Activity  ====="
    #    This will pull all log files regardless if they are configured to show up below or not.
    Get-ChildItem C:\ProgramData\SpaceEngineersDedicated\*\SpaceEngineers-Dedicated.log -Recurse | Foreach-Object { write-host $_.FullName; Get-Content $_.Fullname | Select-Object -Last 5 }
    write-host ""
    write-host "+---------------------------------------------------------------------------------+"
    write-host "| Select a server to toggle its run state                                         |"
    write-host "|                                                                                 |"
    if ($PrivateServer.Status -eq "Running") {
        write-host "|   1  Private Server Running                                                     |"
    } else {
        write-host "|   1  Private Server Stopped                                                     |"
    }
    write-host "|   2  Edit Private Server Config (will take effect on next server restart)       |"
    write-host "|                                                                                 |"
    if ($PublicServer.Status -eq "Running") {
        write-host "|   3  Public Server Running                                                      |"
    } else {
        write-host "|   3  Public Server Stopped                                                      |"
    }
    write-host "|   4  Edit Public Server Config  (will take effect on next server restart)       |"
    write-host "|                                                                                 |"
    write-host "|   enter To Refresh                                                              |"
    write-host "|                                                                                 |"
    write-host "|   q  Exit                                                                       |"   
    write-host "+---------------------------------------------------------------------------------+"
    $function = Read-Host "    Choice"
    write-host ""
   
    switch ($function) {
        "1" {
            if ($PrivateServer.Status -eq "Running") {
                Stop-Service $PrivateServer
            } else {
                Start-Service $PrivateServer
            }
        }
        "2" {
            Invoke-Item "C:\ProgramData\SpaceEngineersDedicated\Service\SpaceEngineers-Dedicated.cfg"
        }
        "3" {
            if ($PublicServer.Status -eq "Running") {
                Stop-Service $PublicServer
            } else {
                Start-Service $PublicServer
            }
            #Start-Process "C:\Program Files (x86)\Steam\SteamApps\common\SpaceEngineers\DedicatedServer64\SpaceEngineersDedicated.exe" -args "-noconsole -path C:\ProgramData\SpaceEngineersDedicated\Public Server"
        }
        "4" {
            Invoke-Item "C:\ProgramData\SpaceEngineersDedicated\Public Server\SpaceEngineers-Dedicated.cfg"
        }
    }
} until ($function -eq "q")
clear
exit

No comments: