MP Kill&Restart command? (1 Viewer)

Eso Rimmer

Portal Member
November 11, 2008
18
0
Home Country
Czech Republic Czech Republic
Maybe it was already mentioned somewhere in the forum, but I can't find it.

I have Vista 64bit and MP stops responding from time to time. Here is my "bright" idea. MP crashes but IMON continue to receive IR commands. So I'd like to asign Mediaportal.exe process kill and re-run to a button to make easy and quick MP restart when needed.:D
 

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    MediaPortal installation folder has restart.vbs script file. You can try to use it to restart the MP.
     

    Eso Rimmer

    Portal Member
    November 11, 2008
    18
    0
    Home Country
    Czech Republic Czech Republic
    Thanks, I'll try it.

    Yet one (stupid) question. I have TV Server PowerSheduler enabled to standby after 5 minutes of inactivity in home screen. I'm configuring MP through remote desktop so I'd like to add remote desktop process into powersheduler exception list but I can't identify which process belongs to remote desktop aplication in running process list.

    Edit:
    rdpclip.exe probably will do the job.
     

    Eso Rimmer

    Portal Member
    November 11, 2008
    18
    0
    Home Country
    Czech Republic Czech Republic
    I can't get restart script working. I tried the different script which was mentioned in some other topic but I'm always getting the same error:

    Line: 21
    Char: 1
    Error: The system cannot find the file specified.
    Code: 80070002
    Source: (null)

    The script kills MP but then throw up the error mentioned above.

    It's the standard script included in MP 1.0:
    Code:
    Option Explicit
    Dim process
    Dim shell
    
    set shell=createobject("WScript.Shell")
    
    ' This doesnt work always when resuming from S3 
    'For Each process in GetObject("winmgmts:").ExecQuery("select * from Win32_Process where name='MediaPortal.exe'")
    '	process.Terminate(0)
    'Next
    
    'WScript.Sleep 1750
    
    
    ' try to find a way to wait until the task is killed. This way we could use the 
    ' taskkill without /F and that would allow MP to save settings as its not forced to terminate
    
    ' shell.Run "taskkill /T /F /IM Mediaportal.exe", 0, true
    
    ' Using tskill to fix Mantis issue 1529
    shell.Run "tskill Mediaportal", 0, true
    shell.Run "mediaportal"

    I'm running Vista x64 if it helps.
     

    Eso Rimmer

    Portal Member
    November 11, 2008
    18
    0
    Home Country
    Czech Republic Czech Republic
    Ok, so after some tries and errors I put together script which seems to work OK on my Vista x64. It just kills mediaportal.exe, waits 5 seconds and then runs mediaportal.exe again. You can change the waiting time on line "WScript.Sleep 5000 ". Maybe it will help someone:

    Code:
    Option Explicit
    Dim objWMIService, objProcess, colProcess, objCalc
    Dim strComputer, strProcessKill, strShell, objProgram, strExe
    strComputer = "."
    strProcessKill = "'mediaportal.exe'" 
    strExe = "mediaportal.exe"
    
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _ 
    & strComputer & "\root\cimv2") 
    
    Set colProcess = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = " & strProcessKill )
    For Each objProcess in colProcess
    objProcess.Terminate()
    Next
    
    WScript.Sleep 5000 
    
    ' Obtain the Win32_Process class of object.
    Set objProcess = objWMIService.Get("Win32_Process")
    Set objProgram = objProcess.Methods_( _
    "Create").InParameters.SpawnInstance_
    objProgram.CommandLine = strExe 
    
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod( _
    "Win32_Process", "Create", objProgram)
     

    jonbenton

    Portal Member
    June 24, 2008
    13
    0
    Home Country
    United States of America United States of America
    I'm using Vista 64bit as well and the way I did it was "easy". I am using a Harmony remote sending Microsoft MCE signals.

    Install MPTray to redirect the green button on MCE remote to start MediaPortal.
    https://www.team-mediaportal.com/files/Download/Plugins/Input/MPTray/

    In MediaPortal configuration under Remote setting click Mapping. Map a button for Action "Remote Green Button" to start MediaPortal. Then map a button for Action "Exit".

    This has work very well with a Harmony remote as well as being able to send Microsoft MCE keyboard comands "Alt+F4".
    I don't know if this will work for you but I believe you can use your iMon remote to send MCE IR signals.
     

    Eso Rimmer

    Portal Member
    November 11, 2008
    18
    0
    Home Country
    Czech Republic Czech Republic
    Hi, I've Harmony as MCE remote too. It's not problem to exit/run MP when it works but once it hangs you are unable to restart it. MP seems to be a bit unstable so this happens from time to time to me. Your "exit MP" buton won't work if MP stops responding. With VBScript you can kill and restart MP with one button no matter if MP is or isn't responding. So you don't need to restart whole PC or take keyboard to do it manually.
     

    jonbenton

    Portal Member
    June 24, 2008
    13
    0
    Home Country
    United States of America United States of America
    I've had MediaPortal hang many of times, the mapped exit seems to work just fine for me. The only strange thing is that once it hangs and I press the "exit" key sometimes I have to press one the directional pad keys then it exits.

    Since you have a Harmony remote you can also contact Logitech and ask them to add the Alt+F4 combination from the MCE keyboard to your remote.
     

    Eso Rimmer

    Portal Member
    November 11, 2008
    18
    0
    Home Country
    Czech Republic Czech Republic
    The script I made (from tutorials) seems to work OK and it takes only one button for both exit and restart.
     

    Users who are viewing this thread

    Top Bottom